From 7ecacd7ab9a1816173a7c61c5dc4225ead2f571a Mon Sep 17 00:00:00 2001 From: susabolca Date: Mon, 13 May 2024 22:08:15 +0800 Subject: [PATCH] upd: chinese week for 2in13. --- src/app/epd_2in13.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/app/epd_2in13.c b/src/app/epd_2in13.c index b30295e..0da2338 100644 --- a/src/app/epd_2in13.c +++ b/src/app/epd_2in13.c @@ -22,6 +22,7 @@ #include "OneBitDisplay.h" #include "font64.h" #include "font24.h" +#include "font24zh.h" #include "font16.h" // One Bit Display @@ -299,7 +300,7 @@ void EPD_SSD_Update_Clock(void) } // full update on every hour. - bool full_upd = (clock_last > 60 || (l->tm_min == 0)) ? true : false; + bool full_upd = (clock_last > 60 || (l->tm_hour== 0 && l->tm_min == 0)) ? true : false; // clock started. clock_last = l->tm_min; @@ -328,21 +329,28 @@ void EPD_SSD_Update_Clock(void) #endif obdWriteStringCustom(&obd, (GFXfont *)&Dialog_plain_16, 0, 118, buf, 1); - // battery voltage - uint16_t v = epd_battery; + // temperature epd_temperature = EPD_2IN13_ReadTemp(); - System_snprintf(buf, 32, "%3uc %u.%uv", epd_temperature, INTFRAC_V(v), INTFRAC_mV(v)/100); - obdWriteStringCustom(&obd, (GFXfont *)&Dialog_plain_16, 164, 118, buf, 1); + System_snprintf(buf, 32, "%3uc", epd_temperature); + obdWriteStringCustom(&obd, (GFXfont *)&Dialog_plain_16, 158, 118, buf, 1); + + // battery + uint8_t v = EPD_BATT_Percent(); + System_snprintf(buf, 32, "%3u%%", v); + obdWriteStringCustom(&obd, (GFXfont *)&Dialog_plain_16, 200, 118, buf, 1); // time System_snprintf(buf, 32, "%02d:%02d", l->tm_hour, l->tm_min); obdWriteStringCustom(&obd, (GFXfont *)&DSEG7_Classic_Regular_64, 12, 28+70, buf, 1); // date - const char *wstr[]={"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}; - System_snprintf(buf, 32, "%u-%02u-%02u %s", 1900+l->tm_year, l->tm_mon+1, l->tm_mday, wstr[l->tm_wday]); + System_snprintf(buf, 32, "%u-%02u-%02u", 1900+l->tm_year, l->tm_mon+1, l->tm_mday); obdWriteStringCustom(&obd, (GFXfont *)&Dialog_plain_24, 0, 24, buf, 1); + // week + char fmt[] = {0x37, 0x38, 0x30 + l->tm_wday, '\0'}; // chinese week day + obdWriteStringCustom(&obd, (GFXfont *)&Hei24pt, 158, 21, fmt, 1); + // edian and invent for (int i=0; i