修复联网选择页闪烁:抑制预调度周期刷新+倒计时只更新秒数不重写整行
This commit is contained in:
parent
67fed98891
commit
2fa304d73d
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue