From 9b6f7baa1f68332fdd3793cca59817279b43e835 Mon Sep 17 00:00:00 2001 From: lewisxhe Date: Fri, 12 Apr 2024 16:01:49 +0800 Subject: [PATCH] Update examples --- README.md | 1 + examples/ModemPowerOff/ModemPowerOff.ino | 62 ++++++------------------ 2 files changed, 16 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 5f24f3c..6f3a51b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/examples/ModemPowerOff/ModemPowerOff.ino b/examples/ModemPowerOff/ModemPowerOff.ino index 4a54e15..dd29f55 100644 --- a/examples/ModemPowerOff/ModemPowerOff.ino +++ b/examples/ModemPowerOff/ModemPowerOff.ino @@ -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 @@ -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); @@ -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 @@ -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); }