From 2fa304d73d0afdd03321cfaf4a2cd6b6738c5fdd Mon Sep 17 00:00:00 2001 From: helei Date: Fri, 18 Sep 2026 15:25:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=81=94=E7=BD=91=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E9=A1=B5=E9=97=AA=E7=83=81:=E6=8A=91=E5=88=B6?= =?UTF-8?q?=E9=A2=84=E8=B0=83=E5=BA=A6=E5=91=A8=E6=9C=9F=E5=88=B7=E6=96=B0?= =?UTF-8?q?+=E5=80=92=E8=AE=A1=E6=97=B6=E5=8F=AA=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=A7=92=E6=95=B0=E4=B8=8D=E9=87=8D=E5=86=99=E6=95=B4=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- STM32F103_App1/HardWare/SYSINIT/app_loop.c | 25 ++++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/STM32F103_App1/HardWare/SYSINIT/app_loop.c b/STM32F103_App1/HardWare/SYSINIT/app_loop.c index 784fb9e..2281618 100644 --- a/STM32F103_App1/HardWare/SYSINIT/app_loop.c +++ b/STM32F103_App1/HardWare/SYSINIT/app_loop.c @@ -59,7 +59,7 @@ void storage_unlock(void) } /*==== 业务模块初始化(调度器启动前调用,与裸机版一致)====*/ -static volatile uint8_t s_qr_showing = 0; /* 开机二维码页显示中: 抑制预调度周期刷新 */ +static volatile uint8_t s_oled_boot_page = 0; /* 开机页(二维码/联网选择)显示中: 抑制预调度周期刷新防覆盖 */ /*==== 开机联网方式选择(V1.7.1 新板按键): 10s 倒计时 ==== * KEY1(PC6)=4G KEY2(PC7)=WiFi固定热点 KEY3(PB14)=SmartConfig 配网, 低电平=按下; @@ -98,6 +98,14 @@ static uint8_t net_mode_select(void) oled_locate(1, 0); oled_print("1:4G 2:WiFi热点"); oled_locate(2, 0); oled_print("3:智能配网"); + s_oled_boot_page = 1; /* 抑制预调度周期刷新, 防止联网进度页覆盖本页 */ + + /* 第 3 行: 标签只写一次, 之后每秒仅更新秒数(整行重写要读字库 IC, 会闪) */ + char label[24]; + snprintf(label, sizeof(label), "上次:%s", names[mode]); + oled_locate(3, 0); oled_print_line(label); + uint8_t num_col8 = (uint8_t)((oled_text_w(label) + 7) / 8); + uint32_t start = HAL_GetTick(); int last_sec = -1; int key = 0; @@ -106,10 +114,12 @@ static uint8_t net_mode_select(void) int remain = (int)(10000u - elapsed) / 1000; if (remain < 0) remain = 0; if (remain != last_sec) { - char buf[24]; + char num[6]; last_sec = remain; - snprintf(buf, sizeof(buf), "上次:%s %2ds", names[mode], remain); - oled_locate(3, 0); oled_print_line(buf); + snprintf(num, sizeof(num), " %2ds", remain); + oled_locate(3, num_col8); + oled_print(num); + oled_print(" "); /* 清掉长尾 */ } key = key_scan_once(); if (key) break; @@ -128,6 +138,7 @@ static uint8_t net_mode_select(void) oled_print((char *)names[mode]); bg_delay(800); oled_clear(); + s_oled_boot_page = 0; return mode; } @@ -182,11 +193,11 @@ void app_init(void) oled_init(); if (g_mqtt_configured) { /* 开机显示设备 ID 二维码 10s(内容=ClientID, 右侧附 ID 文本), 便于现场扫码绑定 */ - s_qr_showing = 1; + s_oled_boot_page = 1; oled_show_qrcode(MqttInfoStr.ClientID); log_info("> OLED: 开机显示设备ID二维码 10s"); bg_delay(1000); - s_qr_showing = 0; + s_oled_boot_page = 0; oled_clear(); } if (g_feed_scale_on) { oled_locate(1, 1); oled_print("智能水产投料机"); } @@ -339,7 +350,7 @@ static void oled_home_refresh(uint32_t up_ms); void app_oled_presched_tick(void) { static uint32_t last = 0; - if (s_qr_showing) return; + if (s_oled_boot_page) return; if (HAL_GetTick() - last < 500) return; last = HAL_GetTick(); oled_home_refresh(0);