added Going-to-sleep display message

This commit is contained in:
cyberman54 2021-04-06 21:35:25 +02:00
parent d098d6ada3
commit 4d7d92900e
3 changed files with 17 additions and 4 deletions

View File

@ -81,12 +81,13 @@ const uint8_t QR_SCALEFACTOR = (MY_DISPLAY_HEIGHT - 4) / 29; // 4px borderlines
extern uint8_t DisplayIsOn, displaybuf[];
extern hw_timer_t *displayIRQ;
extern uint8_t volatile channel; // wifi channel rotation counter
extern uint8_t volatile channel; // wifi channel rotation counter
void dp_setup(int contrast = 0);
void dp_refresh(bool nextPage = false);
void dp_init(bool verbose = false);
void dp_shutdown(void);
void dp_message(const char *msg, int line, bool invers);
void dp_drawPage(time_t t, bool nextpage);
void dp_println(int lines = 1);
void dp_printf(const char *format, ...);

View File

@ -345,7 +345,7 @@ void dp_drawPage(time_t t, bool nextpage) {
dp_println();
#endif // TIME_SYNC_INTERVAL
// line 7: LORA network status
// line 7: LMIC status
// yyyyyyyyyyyyy xx SFab
#if (HAS_LORA)
@ -355,7 +355,6 @@ void dp_drawPage(time_t t, bool nextpage) {
dp_setFont(MY_FONT_SMALL, !cfg.adrmode);
dp_printf("%-4s", getSfName(updr2rps(LMIC.datarate)));
dp_setFont(MY_FONT_SMALL, 0);
dp_println();
#endif // HAS_LORA
break;
@ -617,6 +616,14 @@ void dp_shutdown(void) {
#endif
}
// print static message on display
void dp_message(const char *msg, int line, bool invers) {
dp_setTextCursor(0, line);
dp_setFont(MY_FONT_NORMAL, invers ? 1 : 0);
dp_printf("%-16s", msg);
dp_dump(displaybuf);
} // dp_message
// ------------- QR code plotter -----------------
void dp_printqr(uint16_t offset_x, uint16_t offset_y, const char *Message) {

View File

@ -97,6 +97,11 @@ void enter_deepsleep(const uint64_t wakeup_sec, gpio_num_t wakeup_gpio) {
RTC_runmode = RUNMODE_SLEEP;
int i;
// show message on display
#ifdef HAS_DISPLAY
dp_message("-GOING TO SLEEP-", 7, true);
#endif
// validate wake up pin, if we have
if (!GPIO_IS_VALID_GPIO(wakeup_gpio))
wakeup_gpio = GPIO_NUM_MAX;
@ -117,7 +122,7 @@ void enter_deepsleep(const uint64_t wakeup_sec, gpio_num_t wakeup_gpio) {
vTaskDelay(pdMS_TO_TICKS(1000));
}
// shutdown LMIC safely, waiting max 100 sec
/// wait until LMIC is idle
#if (HAS_LORA)
ESP_LOGI(TAG, "Waiting until LMIC is idle...");
for (i = 100; i > 0; i--) {