From 8259c932880571e4ef4c61c4455115055a26a811 Mon Sep 17 00:00:00 2001 From: smiling boy Date: Fri, 19 Dec 2025 16:11:47 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=B1=8F=E8=94=BD=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E6=8E=A5=E8=BF=91=E6=BB=A1=E7=94=B5=E7=8A=B6=E6=80=81=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E5=85=85=E7=94=B5=E7=8A=B6=E6=80=81=E5=8F=98=E5=8C=96?= =?UTF-8?q?=EF=BC=8C=E9=98=B2=E6=AD=A2=E5=9B=A0=E4=B8=BA=E7=A1=AC=E4=BB=B6?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E5=AF=BC=E8=87=B4=E7=94=BB=E9=9D=A2=E4=B8=8D?= =?UTF-8?q?=E6=96=AD=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epdiy-epub/src/boards/battery/ADCBattery.cpp | 4 ++-- epdiy-epub/src/main.cpp | 24 ++++++++++++++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/epdiy-epub/src/boards/battery/ADCBattery.cpp b/epdiy-epub/src/boards/battery/ADCBattery.cpp index 6dc6b5c..72703f1 100644 --- a/epdiy-epub/src/boards/battery/ADCBattery.cpp +++ b/epdiy-epub/src/boards/battery/ADCBattery.cpp @@ -16,10 +16,10 @@ rt_err_t ADCBattery::charge_event_callback(rt_device_t dev, rt_size_t size) { case RT_CHARGE_EVENT_DETECT: { - rt_kprintf("Charge detect event\n"); extern rt_mq_t ui_queue; if (ui_queue) { + //rt_kprintf("Charge detect event\n"); // 发送刷新充电状态的消息 UIAction msg = MSG_UPDATE_CHARGE_STATUS; rt_mq_send(ui_queue, &msg, sizeof(UIAction)); @@ -154,7 +154,7 @@ void ADCBattery::battery_check_callback(void* parameter) uint8_t percentage = battery_calculator_get_percent(&battery->battery_calc, (uint32_t)(voltage * 10)); bool is_charging = battery->is_charging(); rt_kprintf("[ADCBattery] Battery Level %f, percent %d\n", voltage, (int)percentage); - + // 发送消息到UI队列 if (percentage < 2.0f && !is_charging && battery->low_power != 1) { battery->low_power = 1; diff --git a/epdiy-epub/src/main.cpp b/epdiy-epub/src/main.cpp index 835fa0f..7ac9654 100644 --- a/epdiy-epub/src/main.cpp +++ b/epdiy-epub/src/main.cpp @@ -61,6 +61,7 @@ void handleEpubList(Renderer *renderer, UIAction action, bool needs_redraw); static EpubList *epub_list = nullptr; static EpubReader *reader = nullptr; static EpubToc *contents = nullptr; +static bool charge_full = false; Battery *battery = nullptr; // 声明全局变量,以便open_tp_lcd和close_tp_lcd函数可以访问 Renderer *renderer = nullptr; @@ -576,13 +577,26 @@ while (rt_tick_get_millisecond() - last_user_interaction < 60 * 1000 * 60 *5) // // 检查是否是更新充电状态的消息 if (ui_action == MSG_UPDATE_CHARGE_STATUS) - { - rt_kprintf("Charge status changed\n"); + { + if (battery) { - draw_charge_status(renderer, battery); - draw_battery_level(renderer, battery->get_voltage(), battery->get_percentage()); - renderer->flush_display(); + int percentage = battery->get_percentage(); + if (percentage >= 98 && charge_full == false) + { + clear_charge_icon(renderer); + renderer->flush_display(); + charge_full = true; + rt_kprintf("Battery level is full, skip sending charge status update message\n"); + } + else + { + rt_kprintf("Charge status changed\n"); + charge_full = false; + draw_charge_status(renderer, battery); + draw_battery_level(renderer, battery->get_voltage(), battery->get_percentage()); + renderer->flush_display(); + } } continue; } From 222e3e71ea40ffcc4b8ab99dab3cdda092d46908 Mon Sep 17 00:00:00 2001 From: smiling boy Date: Fri, 19 Dec 2025 16:15:07 +0800 Subject: [PATCH 2/3] 11 --- epdiy-epub/src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epdiy-epub/src/main.cpp b/epdiy-epub/src/main.cpp index 7ac9654..171f083 100644 --- a/epdiy-epub/src/main.cpp +++ b/epdiy-epub/src/main.cpp @@ -589,7 +589,7 @@ while (rt_tick_get_millisecond() - last_user_interaction < 60 * 1000 * 60 *5) // charge_full = true; rt_kprintf("Battery level is full, skip sending charge status update message\n"); } - else + else if(percentage < 98) { rt_kprintf("Charge status changed\n"); charge_full = false; From 0e74401211c4cec7264265f851fd55a2c1651e8f Mon Sep 17 00:00:00 2001 From: smiling boy Date: Fri, 9 Jan 2026 19:22:58 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=A2=A8=E6=B0=B4?= =?UTF-8?q?=E5=B1=8F=E7=94=B5=E6=B1=A0=E6=9B=B2=E7=BA=BF=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epdiy-epub/sf32-oed-epd_v11/battery_table.c | 619 +++++++++++++------- 1 file changed, 416 insertions(+), 203 deletions(-) diff --git a/epdiy-epub/sf32-oed-epd_v11/battery_table.c b/epdiy-epub/sf32-oed-epd_v11/battery_table.c index 8075f17..962b4fb 100644 --- a/epdiy-epub/sf32-oed-epd_v11/battery_table.c +++ b/epdiy-epub/sf32-oed-epd_v11/battery_table.c @@ -4,214 +4,427 @@ // Discharging curve table const battery_lookup_point_t discharge_curve_table[] = { - { 100, 41808}, - { 99, 41401}, - { 98, 41109}, - { 97, 40921}, - { 96, 40762}, - { 95, 40647}, - { 94, 40546}, - { 93, 40481}, - { 92, 40404}, - { 91, 40354}, - { 90, 40317}, - { 89, 40279}, - { 88, 40255}, - { 87, 40234}, - { 86, 40214}, - { 85, 40195}, - { 84, 40183}, - { 83, 40161}, - { 82, 40161}, - { 81, 40142}, - { 80, 40131}, - { 79, 40128}, - { 78, 40119}, - { 77, 40106}, - { 76, 40093}, - { 75, 40086}, - { 74, 40068}, - { 73, 40046}, - { 72, 40015}, - { 71, 39984}, - { 70, 39958}, - { 69, 39923}, - { 68, 39893}, - { 67, 39848}, - { 66, 39818}, - { 65, 39778}, - { 64, 39734}, - { 63, 39714}, - { 62, 39660}, - { 61, 39640}, - { 60, 39606}, - { 59, 39582}, - { 58, 39543}, - { 57, 39502}, - { 56, 39438}, - { 55, 39390}, - { 54, 39310}, - { 53, 39243}, - { 52, 39157}, - { 51, 39087}, - { 50, 39002}, - { 49, 38949}, - { 48, 38890}, - { 47, 38832}, - { 46, 38797}, - { 45, 38748}, - { 44, 38717}, - { 43, 38680}, - { 42, 38660}, - { 41, 38631}, - { 40, 38612}, - { 39, 38601}, - { 38, 38583}, - { 37, 38565}, - { 36, 38534}, - { 35, 38517}, - { 34, 38503}, - { 33, 38478}, - { 32, 38449}, - { 31, 38426}, - { 30, 38387}, - { 29, 38365}, - { 28, 38320}, - { 27, 38289}, - { 26, 38241}, - { 25, 38198}, - { 24, 38150}, - { 23, 38098}, - { 22, 38046}, - { 21, 38022}, - { 20, 37962}, - { 19, 37896}, - { 18, 37826}, - { 17, 37757}, - { 16, 37692}, - { 15, 37605}, - { 14, 37529}, - { 13, 37446}, - { 12, 37351}, - { 11, 37244}, - { 10, 37194}, - { 9, 37132}, - { 8, 37057}, - { 7, 36986}, - { 6, 36918}, - { 5, 36813}, - { 4, 36698}, - { 3, 36473}, - { 2, 36163}, - { 1, 35629}, - { 0, 35042}, + { 100, 41950}, + { 99, 41926}, + { 98, 41860}, + { 97, 41791}, + { 96, 41720}, + { 95, 41650}, + { 94, 41580}, + { 93, 41510}, + { 92, 41439}, + { 91, 41370}, + { 90, 41300}, + { 89, 41230}, + { 88, 41160}, + { 87, 41090}, + { 86, 41020}, + { 85, 40949}, + { 84, 40881}, + { 83, 40810}, + { 82, 40740}, + { 81, 40670}, + { 80, 40600}, + { 79, 40530}, + { 78, 40460}, + { 77, 40390}, + { 76, 40322}, + { 75, 40250}, + { 74, 40180}, + { 73, 40110}, + { 72, 40040}, + { 71, 39970}, + { 70, 39900}, + { 69, 39830}, + { 68, 39760}, + { 67, 39690}, + { 66, 39620}, + { 65, 39550}, + { 64, 39480}, + { 63, 39410}, + { 62, 39340}, + { 61, 39270}, + { 60, 39200}, + { 59, 39130}, + { 58, 39060}, + { 57, 38990}, + { 56, 38920}, + { 55, 38850}, + { 54, 38780}, + { 53, 38710}, + { 52, 38640}, + { 51, 38571}, + { 50, 38500}, + { 49, 38430}, + { 48, 38360}, + { 47, 38290}, + { 46, 38220}, + { 45, 38150}, + { 44, 38080}, + { 43, 38011}, + { 42, 37940}, + { 41, 37870}, + { 40, 37800}, + { 39, 37730}, + { 38, 37660}, + { 37, 37590}, + { 36, 37521}, + { 35, 37451}, + { 34, 37380}, + { 33, 37310}, + { 32, 37240}, + { 31, 37170}, + { 30, 37100}, + { 29, 37029}, + { 28, 36960}, + { 27, 36890}, + { 26, 36820}, + { 25, 36750}, + { 24, 36680}, + { 23, 36610}, + { 22, 36540}, + { 21, 36470}, + { 20, 36400}, + { 19, 36330}, + { 18, 36260}, + { 17, 36190}, + { 16, 36120}, + { 15, 36050}, + { 14, 35980}, + { 13, 35910}, + { 12, 35840}, + { 11, 35770}, + { 10, 35700}, + { 9, 35630}, + { 8, 35560}, + { 7, 35490}, + { 6, 35420}, + { 5, 35350}, + { 4, 35280}, + { 3, 35210}, + { 2, 35139}, + { 1, 35070}, + { 0, 35007}, + }; -//charging table +//新换的1k电阻数据 const battery_lookup_point_t charging_curve_table[] = { - { 100, 41998 }, - { 99, 41864 }, - { 98, 41572 }, - { 97, 41384 }, - { 96, 41225 }, - { 95, 41110 }, - { 94, 41009 }, - { 93, 40944 }, - { 92, 40867 }, - { 91, 40817 }, - { 90, 40780 }, - { 89, 40742 }, - { 88, 40718 }, - { 87, 40697 }, - { 86, 40677 }, - { 85, 40658 }, - { 84, 40646 }, - { 83, 40624 }, - { 82, 40624 }, - { 81, 40605 }, - { 80, 40594 }, - { 79, 40591 }, - { 78, 40582 }, - { 77, 40569 }, - { 76, 40556 }, - { 75, 40549 }, - { 74, 40531 }, - { 73, 40509 }, - { 72, 40478 }, - { 71, 40447 }, - { 70, 40421 }, - { 69, 40386 }, - { 68, 40356 }, - { 67, 40311 }, - { 66, 40281 }, - { 65, 40241 }, - { 64, 40197 }, - { 63, 40177 }, - { 62, 40123 }, - { 61, 40103 }, - { 60, 40069 }, - { 59, 40045 }, - { 58, 40006 }, - { 57, 39965 }, - { 56, 39901 }, - { 55, 39853 }, - { 54, 39773 }, - { 53, 39706 }, - { 52, 39620 }, - { 51, 39550 }, - { 50, 39465 }, - { 49, 39412 }, - { 48, 39353 }, - { 47, 39295 }, - { 46, 39260 }, - { 45, 39211 }, - { 44, 39180 }, - { 43, 39143 }, - { 42, 39123 }, - { 41, 39094 }, - { 40, 39075 }, - { 39, 39064 }, - { 38, 39046 }, - { 37, 39028 }, - { 36, 38997 }, - { 35, 38980 }, - { 34, 38966 }, - { 33, 38941 }, - { 32, 38912 }, - { 31, 38889 }, - { 30, 38850 }, - { 29, 38828 }, - { 28, 38783 }, - { 27, 38752 }, - { 26, 38704 }, - { 25, 38661 }, - { 24, 38613 }, - { 23, 38561 }, - { 22, 38509 }, - { 21, 38485 }, - { 20, 38425 }, - { 19, 38359 }, - { 18, 38289 }, - { 17, 38220 }, - { 16, 38155 }, - { 15, 38068 }, - { 14, 37992 }, - { 13, 37909 }, - { 12, 37814 }, - { 11, 37707 }, - { 10, 37657 }, - { 9, 37595 }, - { 8, 37520 }, - { 7, 37449 }, - { 6, 37381 }, - { 5, 37276 }, - { 4, 37161 }, - { 3, 36973 }, - { 2, 36698 }, - { 1, 36164 }, - { 0, 35577 } + { 100, 42180}, + { 99, 42162}, + { 98, 42136}, + { 97, 42109}, + { 96, 42094}, + { 95, 42060}, + { 94, 42039}, + { 93, 42026}, + { 92, 41990}, + { 91, 41965}, + { 90, 41944}, + { 89, 41924}, + { 88, 41892}, + { 87, 41875}, + { 86, 41845}, + { 85, 41822}, + { 84, 41791}, + { 83, 41760}, + { 82, 41750}, + { 81, 41728}, + { 80, 41692}, + { 79, 41654}, + { 78, 41631}, + { 77, 41599}, + { 76, 41580}, + { 75, 41544}, + { 74, 41510}, + { 73, 41495}, + { 72, 41458}, + { 71, 41429}, + { 70, 41410}, + { 69, 41370}, + { 68, 41340}, + { 67, 41310}, + { 66, 41295}, + { 65, 41253}, + { 64, 41206}, + { 63, 41160}, + { 62, 41099}, + { 61, 41029}, + { 60, 40959}, + { 59, 40889}, + { 58, 40819}, + { 57, 40749}, + { 56, 40679}, + { 55, 40609}, + { 54, 40539}, + { 53, 40469}, + { 52, 40399}, + { 51, 40330}, + { 50, 40259}, + { 49, 40195}, + { 48, 40125}, + { 47, 40055}, + { 46, 39985}, + { 45, 39915}, + { 44, 39845}, + { 43, 39779}, + { 42, 39710}, + { 41, 39640}, + { 40, 39570}, + { 39, 39500}, + { 38, 39430}, + { 37, 39360}, + { 36, 39291}, + { 35, 39221}, + { 34, 39153}, + { 33, 39083}, + { 32, 39013}, + { 31, 38943}, + { 30, 38873}, + { 29, 38802}, + { 28, 38740}, + { 27, 38673}, + { 26, 38606}, + { 25, 38540}, + { 24, 38475}, + { 23, 38417}, + { 22, 38340}, + { 21, 38299}, + { 20, 38241}, + { 19, 38185}, + { 18, 38127}, + { 17, 38072}, + { 16, 38012}, + { 15, 37960}, + { 14, 37890}, + { 13, 37820}, + { 12, 37790}, + { 11, 37720}, + { 10, 37650}, + { 9, 37580}, + { 8, 37510}, + { 7, 37440}, + { 6, 37370}, + { 5, 37333}, + { 4, 37263}, + { 3, 37193}, + { 2, 37122}, + { 1, 37053}, + { 0, 36990} }; +//charging table //原始1k电阻数据 +// const battery_lookup_point_t charging_curve_table[] = +// { +// { 100, 42210}, +// { 99, 42186}, +// { 98, 42176}, +// { 97, 42137}, +// { 96, 42115}, +// { 95, 42094}, +// { 94, 42058}, +// { 93, 42030}, +// { 92, 41997}, +// { 91, 41967}, +// { 90, 41951}, +// { 89, 41911}, +// { 88, 41893}, +// { 87, 41869}, +// { 86, 41825}, +// { 85, 41793}, +// { 84, 41771}, +// { 83, 41740}, +// { 82, 41715}, +// { 81, 41667}, +// { 80, 41640}, +// { 79, 41620}, +// { 78, 41590}, +// { 77, 41563}, +// { 76, 41545}, +// { 75, 41510}, +// { 74, 41467}, +// { 73, 41454}, +// { 72, 41417}, +// { 71, 41401}, +// { 70, 41371}, +// { 69, 41358}, +// { 68, 41316}, +// { 67, 41287}, +// { 66, 41226}, +// { 65, 41151}, +// { 64, 41108}, +// { 63, 41040}, +// { 62, 40965}, +// { 61, 40910}, +// { 60, 40834}, +// { 59, 40770}, +// { 58, 40708}, +// { 57, 40650}, +// { 56, 40583}, +// { 55, 40538}, +// { 54, 40450}, +// { 53, 40380}, +// { 52, 40300}, +// { 51, 40240}, +// { 50, 40165}, +// { 49, 40100}, +// { 48, 40034}, +// { 47, 39962}, +// { 46, 39900}, +// { 45, 39832}, +// { 44, 39764}, +// { 43, 39695}, +// { 42, 39615}, +// { 41, 39556}, +// { 40, 39490}, +// { 39, 39410}, +// { 38, 39340}, +// { 37, 39260}, +// { 36, 39196}, +// { 35, 39119}, +// { 34, 39054}, +// { 33, 38977}, +// { 32, 38924}, +// { 31, 38846}, +// { 30, 38769}, +// { 29, 38711}, +// { 28, 38650}, +// { 27, 38597}, +// { 26, 38540}, +// { 25, 38472}, +// { 24, 38408}, +// { 23, 38354}, +// { 22, 38287}, +// { 21, 38230}, +// { 20, 38186}, +// { 19, 38124}, +// { 18, 38067}, +// { 17, 38015}, +// { 16, 37953}, +// { 15, 37858}, +// { 14, 37801}, +// { 13, 37745}, +// { 12, 37680}, +// { 11, 37610}, +// { 10, 37540}, +// { 9, 37470}, +// { 8, 37400}, +// { 7, 37330}, +// { 6, 37260}, +// { 5, 37190}, +// { 4, 37120}, +// { 3, 37050}, +// { 2, 36979}, +// { 1, 36910}, +// { 0, 36847} +// }; + +// //charging table 6.2k电阻数据 +// const battery_lookup_point_t charging_curve_table[] = +// { +// { 100, 42250}, +// { 99, 42138}, +// { 98, 42125}, +// { 97, 42099}, +// { 96, 42075}, +// { 95, 42014}, +// { 94, 41939}, +// { 93, 41852}, +// { 92, 41783}, +// { 91, 41706}, +// { 90, 41638}, +// { 89, 41568}, +// { 88, 41513}, +// { 87, 41447}, +// { 86, 41405}, +// { 85, 41334}, +// { 84, 41266}, +// { 83, 41195}, +// { 82, 41125}, +// { 81, 41055}, +// { 80, 40985}, +// { 79, 40915}, +// { 78, 40845}, +// { 77, 40775}, +// { 76, 40707}, +// { 75, 40635}, +// { 74, 40565}, +// { 73, 40495}, +// { 72, 40425}, +// { 71, 40355}, +// { 70, 40285}, +// { 69, 40215}, +// { 68, 40145}, +// { 67, 40075}, +// { 66, 40005}, +// { 65, 39935}, +// { 64, 39865}, +// { 63, 39795}, +// { 62, 39725}, +// { 61, 39655}, +// { 60, 39585}, +// { 59, 39515}, +// { 58, 39445}, +// { 57, 39375}, +// { 56, 39305}, +// { 55, 39235}, +// { 54, 39165}, +// { 53, 39095}, +// { 52, 39014}, +// { 51, 38945}, +// { 50, 38874}, +// { 49, 38804}, +// { 48, 38734}, +// { 47, 38664}, +// { 46, 38594}, +// { 45, 38524}, +// { 44, 38454}, +// { 43, 38385}, +// { 42, 38314}, +// { 41, 38244}, +// { 40, 38174}, +// { 39, 38104}, +// { 38, 38034}, +// { 37, 37964}, +// { 36, 37889}, +// { 35, 37819}, +// { 34, 37748}, +// { 33, 37678}, +// { 32, 37608}, +// { 31, 37538}, +// { 30, 37468}, +// { 29, 37397}, +// { 28, 37328}, +// { 27, 37258}, +// { 26, 37188}, +// { 25, 37118}, +// { 24, 37048}, +// { 23, 36978}, +// { 22, 36908}, +// { 21, 36838}, +// { 20, 36768}, +// { 19, 36660}, +// { 18, 36590}, +// { 17, 36520}, +// { 16, 36450}, +// { 15, 36380}, +// { 14, 36310}, +// { 13, 36240}, +// { 12, 36170}, +// { 11, 36100}, +// { 10, 36030}, +// { 9, 35960}, +// { 8, 35890}, +// { 7, 35820}, +// { 6, 35750}, +// { 5, 35680}, +// { 4, 35610}, +// { 3, 35540}, +// { 2, 35469}, +// { 1, 35390}, +// { 0, 35327} +// }; const uint32_t discharge_curve_table_size = sizeof(discharge_curve_table) / sizeof(discharge_curve_table[0]); const uint32_t charging_curve_table_size = sizeof(charging_curve_table) / sizeof(charging_curve_table[0]); +