Power down OLED before deep sleep
This commit is contained in:
@@ -12,6 +12,7 @@ void display_set_last_meter(const MeterData &data);
|
||||
void display_set_last_read(bool ok, uint32_t ts_utc);
|
||||
void display_set_last_tx(bool ok, uint32_t ts_utc);
|
||||
void display_set_receiver_status(bool ap_mode, const char *ssid, bool mqtt_ok);
|
||||
void display_power_down();
|
||||
void display_tick();
|
||||
#ifdef ENABLE_TEST_MODE
|
||||
void display_set_test_code(const char *code);
|
||||
|
||||
@@ -50,6 +50,17 @@ static void oled_set_power(bool on) {
|
||||
}
|
||||
}
|
||||
|
||||
void display_power_down() {
|
||||
if (!g_display_ready) {
|
||||
return;
|
||||
}
|
||||
display.clearDisplay();
|
||||
display.display();
|
||||
oled_set_power(false);
|
||||
g_oled_on = false;
|
||||
g_last_oled_on = false;
|
||||
}
|
||||
|
||||
void display_init() {
|
||||
pinMode(PIN_OLED_CTRL, INPUT_PULLDOWN);
|
||||
Wire.begin(PIN_OLED_SDA, PIN_OLED_SCL);
|
||||
|
||||
@@ -121,6 +121,7 @@ static void sender_cycle() {
|
||||
}
|
||||
|
||||
delay(50);
|
||||
display_power_down();
|
||||
lora_sleep();
|
||||
go_to_deep_sleep(SENDER_WAKE_INTERVAL_SEC);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user