Browse Source

Merge pull request #692 from liamcottle/feature/thinknode-m1-poweroff

ThinkNode M1: low battery auto shutdown
pull/696/head
ripplebiz 9 months ago
committed by GitHub
parent
commit
e8d4ab5977
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 15
      examples/companion_radio/ui-new/UITask.cpp
  2. 8
      src/helpers/nrf52/ThinkNodeM1Board.h
  3. 1
      variants/thinknode_m1/platformio.ini

15
examples/companion_radio/ui-new/UITask.cpp

@ -551,7 +551,22 @@ void UITask::loop() {
if (millis() > next_batt_chck) {
uint16_t milliVolts = getBattMilliVolts();
if (milliVolts > 0 && milliVolts < AUTO_SHUTDOWN_MILLIVOLTS) {
// show low battery shutdown alert
// we should only do this for eink displays, which will persist after power loss
#ifdef THINKNODE_M1
if (_display != NULL) {
_display->startFrame();
_display->setTextSize(2);
_display->setColor(DisplayDriver::RED);
_display->drawTextCentered(_display->width() / 2, 20, "Low Battery.");
_display->drawTextCentered(_display->width() / 2, 40, "Shutting Down!");
_display->endFrame();
}
#endif
shutdown();
}
next_batt_chck = millis() + 8000;
}

8
src/helpers/nrf52/ThinkNodeM1Board.h

@ -57,6 +57,14 @@ public:
}
void powerOff() override {
// turn off all leds, sd_power_system_off will not do this for us
#ifdef P_LORA_TX_LED
digitalWrite(P_LORA_TX_LED, LOW);
#endif
// power off board
sd_power_system_off();
}
};

1
variants/thinknode_m1/platformio.ini

@ -77,6 +77,7 @@ build_flags =
-D DISPLAY_CLASS=GxEPDDisplay
-D OFFLINE_QUEUE_SIZE=256
-D PIN_BUZZER=6
-D AUTO_SHUTDOWN_MILLIVOLTS=3300
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${ThinkNode_M1.build_src_filter}

Loading…
Cancel
Save