From ebc1ca525571cda132a7c2fd6d485e93062f2ac2 Mon Sep 17 00:00:00 2001 From: helei Date: Sat, 22 Aug 2026 19:58:06 +0800 Subject: [PATCH] =?UTF-8?q?V1.5:=20=E6=81=A2=E5=A4=8DOLED=E9=98=B2?= =?UTF-8?q?=E7=83=A7=E5=B1=8F=E5=83=8F=E7=B4=A0=E5=81=8F=E7=A7=BB=E5=B9=B6?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B7=A6=E4=BE=A7=E6=AE=8B=E7=95=99(?= =?UTF-8?q?=E7=A7=BB=E4=BD=8D=E5=89=8D=E5=85=88=E6=B8=85=E8=85=BE=E7=A9=BA?= =?UTF-8?q?=E5=88=97)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HardWare/SYSINIT/app_loop.c | 51 ++++++++++++------- V1.5/版本说明.md | 1 + 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/V1.5/STM32F103_App1/HardWare/SYSINIT/app_loop.c b/V1.5/STM32F103_App1/HardWare/SYSINIT/app_loop.c index c431137..1091f44 100644 --- a/V1.5/STM32F103_App1/HardWare/SYSINIT/app_loop.c +++ b/V1.5/STM32F103_App1/HardWare/SYSINIT/app_loop.c @@ -244,9 +244,24 @@ void app_oled_presched_tick(void) oled_home_refresh(0); } +/* дһУƫƣдոڳУٴƫƴд */ +static void oled_row(uint8_t row, uint8_t xoff, const char *s) +{ + if (xoff) { + oled_locate(row, 0); + oled_print(" "); /* ڳУֹ */ + oled_locate(row, 0); + } + oled_locate(row, 0); + oled_xoff(xoff); + oled_print_line(s); +} + static void oled_home_refresh(uint32_t up_ms) { char buf[24]; + /* ÿ 10s һˮƽƫƣ0/2/4px */ + uint8_t xoff = (uint8_t)((HAL_GetTick() / 10000u) % 3u) * 2u; if (g_net_mqtt_ready) { /*---- ----*/ @@ -257,19 +272,19 @@ static void oled_home_refresh(uint32_t up_ms) (unsigned)(mins / 1440u), (unsigned)((mins % 1440u) / 60u), (unsigned)(mins % 60u)); - oled_locate(0, 0); oled_print_line(buf); + oled_row(0, xoff, buf); /* R1/R2: ܲ */ if (hlw8032_online()) { snprintf(buf, sizeof(buf), "%.1fV %.2fA", (double)hlw8032_get_voltage_v(), (double)hlw8032_get_current_a()); - oled_locate(1, 0); oled_print_line(buf); + oled_row(1, xoff, buf); snprintf(buf, sizeof(buf), "%.1fW %.2fkWh", (double)hlw8032_get_power_w(), (double)hlw8032_get_energy_kwh()); - oled_locate(2, 0); oled_print_line(buf); + oled_row(2, xoff, buf); } else { - oled_locate(1, 0); oled_print_line("оƬ"); - oled_locate(2, 0); oled_print_line(""); + oled_row(1, xoff, "оƬ"); + oled_row(2, xoff, ""); } /* R3: ģʽʾʾԭ򣩣޳ģʽʾ״̬ */ @@ -289,34 +304,34 @@ static void oled_home_refresh(uint32_t up_ms) } snprintf(buf, sizeof(buf), ":%s", reason); } - oled_locate(3, 0); oled_print_line(buf); + oled_row(3, xoff, buf); } else { snprintf(buf, sizeof(buf), ":%s%s%s%s", MqttInfoStr.Relay_State[1] ? "" : "", MqttInfoStr.Relay_State[2] ? "" : "", MqttInfoStr.Relay_State[3] ? "" : "", MqttInfoStr.Relay_State[4] ? "" : ""); - oled_locate(3, 0); oled_print_line(buf); + oled_row(3, xoff, buf); } } else { /*---- δ棺 ----*/ net_ui_phase_t ph = g_net_ui_phase; - oled_locate(0, 0); oled_print_line(""); + oled_row(0, xoff, ""); if (ph == NET_UI_WIFI_FIXED || ph == NET_UI_WIFI_SMART || NET_GetActiveBackend() == NET_BACKEND_WIFI) { if (ph == NET_UI_WIFI_FIXED) { - oled_locate(1, 0); oled_print_line("WiFi̶ģʽ"); - oled_locate(2, 0); oled_print_line("ȵ"); + oled_row(1, xoff, "WiFi̶ģʽ"); + oled_row(2, xoff, "ȵ"); } else if (ph == NET_UI_WIFI_SMART) { - oled_locate(1, 0); oled_print_line(""); - oled_locate(2, 0); oled_print_line("APP㲥"); + oled_row(1, xoff, ""); + oled_row(2, xoff, "APP㲥"); } else { - oled_locate(1, 0); oled_print_line("WiFiģʽ"); - oled_locate(2, 0); oled_print_line("ʼ..."); + oled_row(1, xoff, "WiFiģʽ"); + oled_row(2, xoff, "ʼ..."); } snprintf(buf, sizeof(buf), "ʣ %ds", g_net_ui_countdown); - oled_locate(3, 0); oled_print_line(g_net_ui_countdown > 0 ? buf : ""); + oled_row(3, xoff, g_net_ui_countdown > 0 ? buf : ""); } else { /* 4G ȣʾɵĽ׶ */ const char *step = "ʼ"; @@ -329,9 +344,9 @@ static void oled_home_refresh(uint32_t up_ms) case NET_UI_4G_NOSIM: step = "SIM!"; break; default: break; } - oled_locate(1, 0); oled_print_line("ڵȴ4G"); - oled_locate(2, 0); oled_print_line(step); - oled_locate(3, 0); oled_print_line(""); + oled_row(1, xoff, "ڵȴ4G"); + oled_row(2, xoff, step); + oled_row(3, xoff, ""); } } } diff --git a/V1.5/版本说明.md b/V1.5/版本说明.md index 8efc937..9634577 100644 --- a/V1.5/版本说明.md +++ b/V1.5/版本说明.md @@ -200,3 +200,4 @@ - 485 接收架构重写为 DMA+IDLE(DMA1_Channel6 + 空闲中断定帧,与 4G/WiFi 同架构): 根治字节中断+软件超时方案的丢帧/停摆问题;实测秒回/慢回全部一次成功。 过程:DWT 硬件观察点抓到合法写点无误,定位为原中断接收路径在特定时序下字节丢失 +- 恢复 OLED 防烧屏像素偏移(每10s 右移 0/2/4px),并修复左侧残留(移位前先写空格清腾空列)