mirror of
https://github.com/tsl0922/EPD-nRF5.git
synced 2025-12-06 15:42:48 +08:00
remember display mode
This commit is contained in:
26
GUI/GUI.c
26
GUI/GUI.c
@@ -119,16 +119,30 @@ static bool GetFestival(uint16_t year, uint8_t mon, uint8_t day, uint8_t week,
|
||||
if (GetJieQi(year, mon, day, &JQdate) && JQdate == day) {
|
||||
uint8_t JQ = (mon - 1) * 2;
|
||||
if (day >= 15) JQ++;
|
||||
strcpy(festival, JieQiStr[JQ]);
|
||||
if (JQ == 6) // 清明
|
||||
sprintf(festival, "%s节", JieQiStr[JQ]);
|
||||
else
|
||||
strcpy(festival, JieQiStr[JQ]);
|
||||
strcat(festival, "节");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void DrawTimeSyncTip(Adafruit_GFX *gfx)
|
||||
{
|
||||
GFX_setFont(gfx, u8g2_font_wqy12_t_lunar);
|
||||
GFX_fillRect(gfx, gfx->_width / 2 - 100, gfx->_height / 2 - 25, 200, 50, GFX_WHITE);
|
||||
GFX_drawRoundRect(gfx, gfx->_width / 2 - 100, gfx->_height / 2 - 25, 200, 50, 5, GFX_BLACK);
|
||||
GFX_setTextColor(gfx, GFX_RED, GFX_WHITE);
|
||||
GFX_setCursor(gfx, 149, 145);
|
||||
GFX_printf(gfx, "SYNC TIME!");
|
||||
GFX_setTextColor(gfx, GFX_BLACK, GFX_WHITE);
|
||||
GFX_setCursor(gfx, 110, 164);
|
||||
GFX_setFont(gfx, u8g2_font_wqy9_t_lunar);
|
||||
GFX_printf(gfx, "https://tsl0922.github.io/EPD-nRF5");
|
||||
}
|
||||
|
||||
static void DrawBattery(Adafruit_GFX *gfx, int16_t x, int16_t y, float voltage)
|
||||
{
|
||||
uint8_t level = (uint8_t)(voltage * 100 / 4.2);
|
||||
@@ -165,7 +179,7 @@ static void DrawDateHeader(Adafruit_GFX *gfx, int16_t x, int16_t y, tm_t *tm, st
|
||||
GFX_setFont(gfx, u8g2_font_wqy9_t_lunar);
|
||||
GFX_printf(gfx, "星期%s", Lunar_DayString[tm->tm_wday]);
|
||||
|
||||
DrawBattery(gfx, 365, 4, data->voltage);
|
||||
DrawBattery(gfx, 365, 6, data->voltage);
|
||||
|
||||
GFX_setCursor(gfx, x + 270, y);
|
||||
GFX_printf(gfx, "%s%s%s %s%s", Lunar_MonthLeapString[Lunar->IsLeap], Lunar_MonthString[Lunar->Month],
|
||||
@@ -357,6 +371,10 @@ void DrawGUI(gui_data_t *data, buffer_callback draw, display_mode_t mode)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if ((mode == MODE_CALENDAR || mode == MODE_CLOCK) &&
|
||||
(tm.tm_year + YEAR0 == 2025 && tm.tm_mon + 1 == 1)) {
|
||||
DrawTimeSyncTip(&gfx);
|
||||
}
|
||||
} while(GFX_nextPage(&gfx, draw));
|
||||
|
||||
GFX_end(&gfx);
|
||||
|
||||
Reference in New Issue
Block a user