turn of axp led while sleeping

This commit is contained in:
geeksville 2020-02-02 13:55:44 -08:00
parent ef4e7911f5
commit 74adc06f89
3 changed files with 14 additions and 6 deletions

View File

@ -13,7 +13,7 @@
typedef int ErrorCode; typedef int ErrorCode;
typedef uint8_t NodeNum; typedef uint8_t NodeNum;
#define MAX_TX_QUEUE 4 // max number of packets which can be waiting for transmission #define MAX_TX_QUEUE 8 // max number of packets which can be waiting for transmission
/** /**

View File

@ -37,8 +37,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Select which T-Beam board is being used. Only uncomment one. // Select which T-Beam board is being used. Only uncomment one.
// #define T_BEAM_V10 // AKA Rev1 (second board released) #define T_BEAM_V10 // AKA Rev1 (second board released)
#define HELTEC_LORA32 // #define HELTEC_LORA32
#define DEBUG_PORT Serial // Serial debug port #define DEBUG_PORT Serial // Serial debug port
#define SERIAL_BAUD 115200 // Serial debug baud rate #define SERIAL_BAUD 115200 // Serial debug baud rate

View File

@ -79,7 +79,7 @@ void doDeepSleep(uint64_t msecToWake)
#ifdef T_BEAM_V10 #ifdef T_BEAM_V10
if (axp192_found) if (axp192_found)
{ {
// turn on after initial testing with real hardware axp.setChgLEDMode(AXP20X_LED_OFF); // turn off the AXP LED
// No need to turn this off if the power draw in sleep mode really is just 0.2uA and turning it off would // No need to turn this off if the power draw in sleep mode really is just 0.2uA and turning it off would
// leave floating input for the IRQ line // leave floating input for the IRQ line
@ -360,7 +360,7 @@ void setup()
service.init(); service.init();
BLEServer *serve = initBLE(getDeviceName()); // FIXME, use a real name based on the macaddr BLEServer *serve = initBLE(getDeviceName()); // FIXME, use a real name based on the macaddr
BLEService *bts = createMeshBluetoothService(serve); createMeshBluetoothService(serve);
} }
void loop() void loop()
@ -370,11 +370,19 @@ void loop()
service.loop(); service.loop();
loopBLE(); loopBLE();
static bool ledon;
ledon ^= 1;
#ifdef LED_PIN #ifdef LED_PIN
// toggle the led so we can get some rough sense of how often loop is pausing // toggle the led so we can get some rough sense of how often loop is pausing
digitalWrite(LED_PIN, digitalRead(LED_PIN) ? 0 : 1); digitalWrite(LED_PIN, ledon);
#endif #endif
if(axp192_found) {
// blink the axp led
axp.setChgLEDMode(ledon ? AXP20X_LED_LOW_LEVEL : AXP20X_LED_OFF);
}
#ifdef BUTTON_PIN #ifdef BUTTON_PIN
// if user presses button for more than 3 secs, discard our network prefs and reboot (FIXME, use a debounce lib instead of this boilerplate) // if user presses button for more than 3 secs, discard our network prefs and reboot (FIXME, use a debounce lib instead of this boilerplate)
static bool wasPressed = false; static bool wasPressed = false;