File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed
examples/companion_radio/ui-new Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -551,7 +551,22 @@ void UITask::loop() {
551551 if (millis () > next_batt_chck) {
552552 uint16_t milliVolts = getBattMilliVolts ();
553553 if (milliVolts > 0 && milliVolts < AUTO_SHUTDOWN_MILLIVOLTS) {
554+
555+ // show low battery shutdown alert
556+ // we should only do this for eink displays, which will persist after power loss
557+ #ifdef THINKNODE_M1
558+ if (_display != NULL ) {
559+ _display->startFrame ();
560+ _display->setTextSize (2 );
561+ _display->setColor (DisplayDriver::RED);
562+ _display->drawTextCentered (_display->width () / 2 , 20 , " Low Battery." );
563+ _display->drawTextCentered (_display->width () / 2 , 40 , " Shutting Down!" );
564+ _display->endFrame ();
565+ }
566+ #endif
567+
554568 shutdown ();
569+
555570 }
556571 next_batt_chck = millis () + 8000 ;
557572 }
Original file line number Diff line number Diff line change @@ -57,6 +57,14 @@ class ThinkNodeM1Board : public mesh::MainBoard {
5757 }
5858
5959 void powerOff () override {
60+
61+ // turn off all leds, sd_power_system_off will not do this for us
62+ #ifdef P_LORA_TX_LED
63+ digitalWrite (P_LORA_TX_LED, LOW);
64+ #endif
65+
66+ // power off board
6067 sd_power_system_off ();
68+
6169 }
6270};
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ build_flags =
7777 -D DISPLAY_CLASS =GxEPDDisplay
7878 -D OFFLINE_QUEUE_SIZE =256
7979 -D PIN_BUZZER =6
80+ -D AUTO_SHUTDOWN_MILLIVOLTS =3300
8081; -D MESH_PACKET_LOGGING=1
8182; -D MESH_DEBUG=1
8283build_src_filter = ${ThinkNode_M1.build_src_filter}
You can’t perform that action at this time.
0 commit comments