* some fixes around the powerOff(). Tidy ups
This commit is contained in:
@@ -26,7 +26,6 @@ static const uint8_t meshcore_logo [] PROGMEM = {
|
||||
};
|
||||
|
||||
void UITask::begin(const char* node_name, const char* build_date, uint32_t pin_code) {
|
||||
_prevBtnState = HIGH;
|
||||
_auto_off = millis() + AUTO_OFF_MILLIS;
|
||||
clearMsgPreview();
|
||||
_node_name = node_name;
|
||||
@@ -66,7 +65,8 @@ void UITask::newMsg(uint8_t path_len, const char* from_name, const char* text, i
|
||||
}
|
||||
|
||||
void UITask::renderCurrScreen() {
|
||||
if (_display != NULL) {
|
||||
if (_display == NULL) return; // assert() ??
|
||||
|
||||
char tmp[80];
|
||||
if (_origin[0] && _msg[0]) {
|
||||
// render message preview
|
||||
@@ -105,7 +105,6 @@ void UITask::renderCurrScreen() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UITask::userLedHandler() {
|
||||
#ifdef PIN_STATUS_LED
|
||||
@@ -135,7 +134,7 @@ void UITask::userLedHandler() {
|
||||
|
||||
void UITask::buttonHandler() {
|
||||
#ifdef PIN_USER_BTN
|
||||
static int prev_btn_state = HIGH;
|
||||
static int prev_btn_state = !USER_BTN_PRESSED;
|
||||
static unsigned long btn_state_change_time = 0;
|
||||
static unsigned long next_read = 0;
|
||||
int cur_time = millis();
|
||||
@@ -153,7 +152,6 @@ void UITask::buttonHandler() {
|
||||
}
|
||||
} else { // unpressed ? check pressed time ...
|
||||
if ((cur_time - btn_state_change_time) > 5000) {
|
||||
Serial.println("power off");
|
||||
#ifdef PIN_STATUS_LED
|
||||
digitalWrite(PIN_STATUS_LED, LOW);
|
||||
delay(10);
|
||||
|
||||
@@ -7,7 +7,6 @@ class UITask {
|
||||
DisplayDriver* _display;
|
||||
mesh::MainBoard* _board;
|
||||
unsigned long _next_refresh, _auto_off;
|
||||
int _prevBtnState;
|
||||
bool _connected;
|
||||
uint32_t _pin_code;
|
||||
const char* _node_name;
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
virtual void onBeforeTransmit() { }
|
||||
virtual void onAfterTransmit() { }
|
||||
virtual void reboot() = 0;
|
||||
virtual void powerOff() { while (1) { }}; // hope it's overriden or never called ;)
|
||||
virtual void powerOff() { /* no op */ }
|
||||
virtual uint8_t getStartupReason() const = 0;
|
||||
virtual bool startOTAUpdate() { return false; } // not supported
|
||||
};
|
||||
|
||||
@@ -68,7 +68,8 @@ public:
|
||||
}
|
||||
|
||||
void powerOff() override {
|
||||
enterDeepSleep(0);
|
||||
// TODO: re-enable this when there is a definite wake-up source pin:
|
||||
// enterDeepSleep(0);
|
||||
}
|
||||
|
||||
uint16_t getBattMilliVolts() override {
|
||||
|
||||
Reference in New Issue
Block a user