diff --git a/application/main/src/driver/ssd1306/ssd1306_oled.c b/application/main/src/driver/ssd1306/ssd1306_oled.c index 20734cee..4cedafb4 100644 --- a/application/main/src/driver/ssd1306/ssd1306_oled.c +++ b/application/main/src/driver/ssd1306/ssd1306_oled.c @@ -266,7 +266,7 @@ static void status_mark_dirty() } } -static bool ssd1306_inited = false, ssd1306_init_show = false; +static bool ssd1306_inited = false, ssd1306_init_show = false, ssd1306_is_sleep = false; static void ssd1306_event_handler(enum user_event event, void* arg) { @@ -283,7 +283,8 @@ static void ssd1306_event_handler(enum user_event event, void* arg) ssd1306_show_all(); break; case KBD_STATE_SLEEP: // 睡眠 - if (ssd1306_inited) { + if (!ssd1306_is_sleep && ssd1306_inited) { + ssd1306_is_sleep = true; ssd1306_sleep(); nrf_delay_ms(10); ssd1306_oled_uninit(); @@ -294,7 +295,7 @@ static void ssd1306_event_handler(enum user_event event, void* arg) } break; case USER_EVT_POWERSAVE: // 处理省电模式 - if (ssd1306_inited) { + if (ssd1306_is_sleep && ssd1306_inited) { break; } switch (param) {