Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Apr 12, 2024
1 parent a901f96 commit 9b6f7ba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 47 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
4. Recommended solar panels are 4.4v to 6v **DO NOT EXCEED OR BOARD MAY BE DAMAGED**
5. When an SD card in you can not upload software in Arduino IDE since the SD card uses IO2 as CS, the SD card must be removed when uploading a new sketch.
6. The `T-A7670G` modem does not contain a GPS positioning component and requires an additional external GPS positioning module to use the positioning function. [LilyGo T-A7670G with GPS](https://www.lilygo.cc/products/t-sim-a7670e?variant=43043706077365) uses [Quectel L76K](https://www.quectel.com/cn/product/gnss-l76k) as the **T-A7670G** auxiliary positioning function, which requires a part of the IO, please refer to the [GPSShield example](./examples/GPSShield/) , How to identify whether you have an external GPS module please see [#issues56](https://github.com/Xinyuan-LilyGO/LilyGO-T-A76XX/issues/56#issuecomment-1672628977)
7. Known issues, ESP32 (V1.2) version of [T-A7670][1], [T-A7608][4], when using battery power supply mode, BOARD_POWERON_PIN (IO12) must be set to high level after esp32 starts, otherwise a reset will occur.

# 6️⃣ FAQ

Expand Down
62 changes: 15 additions & 47 deletions examples/ModemPowerOff/ModemPowerOff.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* @license MIT
* @copyright Copyright (c) 2024 Shenzhen Xin Yuan Electronic Technology Co., Ltd
* @date 2024-04-11
*
* @note Known issues, ESP32 (V1.2) version of T-A7670, T-A7608,
* when using battery power supply mode, BOARD_POWERON_PIN (IO12) must be set to high level after esp32 starts, otherwise a reset will occur.
*/
#define TINY_GSM_RX_BUFFER 1024 // Set RX buffer to 1Kb

Expand Down Expand Up @@ -32,45 +33,16 @@ void setup()

SerialAT.begin(115200, SERIAL_8N1, MODEM_RX_PIN, MODEM_TX_PIN);

// Set Power control pin output
/* Set Power control pin output
* * @note Known issues, ESP32 (V1.2) version of T-A7670, T-A7608,
* when using battery power supply mode, BOARD_POWERON_PIN (IO12) must be set to high level after esp32 starts, otherwise a reset will occur.
* */
#ifdef BOARD_POWERON_PIN
pinMode(BOARD_POWERON_PIN, OUTPUT);
digitalWrite(BOARD_POWERON_PIN, LOW);
#endif

}



void loopAT(uint32_t delay_ms)
{
uint32_t interval = millis() + delay_ms;
while (millis() < interval) {
while (SerialAT.available()) {
Serial.write(SerialAT.read());
}
while (Serial.available()) {
SerialAT.write(Serial.read());
}
delay(1);
}
}


void loop()
{
int i = 10;
while (i--) {
Serial.printf("Turn on the modem after %d seconds\n", i); delay(1000);
}

// Turn on the modem power supply
#ifdef BOARD_POWERON_PIN
digitalWrite(BOARD_POWERON_PIN, HIGH);
delay(100);
#endif

// Set modem reset pin ,reset modem
// Set modem reset pin ,reset modem
pinMode(MODEM_RESET_PIN, OUTPUT);
digitalWrite(MODEM_RESET_PIN, !MODEM_RESET_LEVEL); delay(100);
digitalWrite(MODEM_RESET_PIN, MODEM_RESET_LEVEL); delay(2600);
Expand All @@ -84,20 +56,16 @@ void loop()
delay(100);
digitalWrite(BOARD_PWRKEY_PIN, LOW);

// Test modem connected
// Test modem connected
while (!modem.testAT()) {
delay(1);
}

Serial.println("Modem has power on!");

// 20s
loopAT(20000);

i = 5;
int i = 10;
while (i--) {
Serial.printf("Turn off the modem after %d seconds\n", i);
delay(1000);
Serial.printf("Turn off the modem after %d seconds\n", i); delay(1000);
}

// AT Command send poweroff cmd
Expand All @@ -106,10 +74,10 @@ void loop()

delay(10000);

// Turn off the modem power supply
#ifdef BOARD_POWERON_PIN
digitalWrite(BOARD_POWERON_PIN, LOW);
#endif
}

loopAT(10000);

void loop()
{
delay(10);
}

0 comments on commit 9b6f7ba

Please sign in to comment.