V1.5: 去掉OLED防烧屏左右偏移

This commit is contained in:
helei 2026-08-22 10:19:07 +08:00
parent d9af7ec0f2
commit a8f0ccc6c7
3 changed files with 19 additions and 21 deletions

View File

@ -245,8 +245,6 @@ void app_oled_presched_tick(void)
static void oled_home_refresh(uint32_t up_ms) static void oled_home_refresh(uint32_t up_ms)
{ {
char buf[24]; char buf[24];
/* 防烧屏:每 10s 换一档水平偏移0/2/4px */
uint8_t xoff = (uint8_t)((HAL_GetTick() / 10000u) % 3u) * 2u;
if (g_net_mqtt_ready) { if (g_net_mqtt_ready) {
/*---- 已联网界面 ----*/ /*---- 已联网界面 ----*/
@ -257,19 +255,19 @@ static void oled_home_refresh(uint32_t up_ms)
(unsigned)(mins / 1440u), (unsigned)(mins / 1440u),
(unsigned)((mins % 1440u) / 60u), (unsigned)((mins % 1440u) / 60u),
(unsigned)(mins % 60u)); (unsigned)(mins % 60u));
oled_locate(0, 0); oled_xoff(xoff); oled_print_line(buf); oled_locate(0, 0); oled_print_line(buf);
/* R1/R2: 电能参数 */ /* R1/R2: 电能参数 */
if (hlw8032_online()) { if (hlw8032_online()) {
snprintf(buf, sizeof(buf), "%.1fV %.2fA", snprintf(buf, sizeof(buf), "%.1fV %.2fA",
(double)hlw8032_get_voltage_v(), (double)hlw8032_get_current_a()); (double)hlw8032_get_voltage_v(), (double)hlw8032_get_current_a());
oled_locate(1, 0); oled_xoff(xoff); oled_print_line(buf); oled_locate(1, 0); oled_print_line(buf);
snprintf(buf, sizeof(buf), "%.1fW %.2fkWh", snprintf(buf, sizeof(buf), "%.1fW %.2fkWh",
(double)hlw8032_get_power_w(), (double)hlw8032_get_energy_kwh()); (double)hlw8032_get_power_w(), (double)hlw8032_get_energy_kwh());
oled_locate(2, 0); oled_xoff(xoff); oled_print_line(buf); oled_locate(2, 0); oled_print_line(buf);
} else { } else {
oled_locate(1, 0); oled_xoff(xoff); oled_print_line("计量芯片离线"); oled_locate(1, 0); oled_print_line("计量芯片离线");
oled_locate(2, 0); oled_xoff(xoff); oled_print_line(""); oled_locate(2, 0); oled_print_line("");
} }
/* R3: 带秤模式显示重量(读不到显示原因),无秤模式显示开关状态 */ /* R3: 带秤模式显示重量(读不到显示原因),无秤模式显示开关状态 */
@ -289,34 +287,34 @@ static void oled_home_refresh(uint32_t up_ms)
} }
snprintf(buf, sizeof(buf), "重量:%s", reason); snprintf(buf, sizeof(buf), "重量:%s", reason);
} }
oled_locate(3, 0); oled_xoff(xoff); oled_print_line(buf); oled_locate(3, 0); oled_print_line(buf);
} else { } else {
snprintf(buf, sizeof(buf), "开关:%s%s%s%s", snprintf(buf, sizeof(buf), "开关:%s%s%s%s",
MqttInfoStr.Relay_State[1] ? "" : "", MqttInfoStr.Relay_State[1] ? "" : "",
MqttInfoStr.Relay_State[2] ? "" : "", MqttInfoStr.Relay_State[2] ? "" : "",
MqttInfoStr.Relay_State[3] ? "" : "", MqttInfoStr.Relay_State[3] ? "" : "",
MqttInfoStr.Relay_State[4] ? "" : ""); MqttInfoStr.Relay_State[4] ? "" : "");
oled_locate(3, 0); oled_xoff(xoff); oled_print_line(buf); oled_locate(3, 0); oled_print_line(buf);
} }
} else { } else {
/*---- 未联网界面:联网进度 ----*/ /*---- 未联网界面:联网进度 ----*/
net_ui_phase_t ph = g_net_ui_phase; net_ui_phase_t ph = g_net_ui_phase;
oled_locate(0, 0); oled_xoff(xoff); oled_print_line("断网"); oled_locate(0, 0); oled_print_line("断网");
if (ph == NET_UI_WIFI_FIXED || ph == NET_UI_WIFI_SMART || if (ph == NET_UI_WIFI_FIXED || ph == NET_UI_WIFI_SMART ||
NET_GetActiveBackend() == NET_BACKEND_WIFI) { NET_GetActiveBackend() == NET_BACKEND_WIFI) {
if (ph == NET_UI_WIFI_FIXED) { if (ph == NET_UI_WIFI_FIXED) {
oled_locate(1, 0); oled_xoff(xoff); oled_print_line("WiFi固定模式"); oled_locate(1, 0); oled_print_line("WiFi固定模式");
oled_locate(2, 0); oled_xoff(xoff); oled_print_line("正在搜索热点"); oled_locate(2, 0); oled_print_line("正在搜索热点");
} else if (ph == NET_UI_WIFI_SMART) { } else if (ph == NET_UI_WIFI_SMART) {
oled_locate(1, 0); oled_xoff(xoff); oled_print_line("智能配网"); oled_locate(1, 0); oled_print_line("智能配网");
oled_locate(2, 0); oled_xoff(xoff); oled_print_line("请打开APP广播"); oled_locate(2, 0); oled_print_line("请打开APP广播");
} else { } else {
oled_locate(1, 0); oled_xoff(xoff); oled_print_line("WiFi模式"); oled_locate(1, 0); oled_print_line("WiFi模式");
oled_locate(2, 0); oled_xoff(xoff); oled_print_line("初始化中..."); oled_locate(2, 0); oled_print_line("初始化中...");
} }
snprintf(buf, sizeof(buf), "剩余 %ds", g_net_ui_countdown); snprintf(buf, sizeof(buf), "剩余 %ds", g_net_ui_countdown);
oled_locate(3, 0); oled_xoff(xoff); oled_print_line(g_net_ui_countdown > 0 ? buf : ""); oled_locate(3, 0); oled_print_line(g_net_ui_countdown > 0 ? buf : "");
} else { } else {
/* 4G 进度:显示最近完成的阶段 */ /* 4G 进度:显示最近完成的阶段 */
const char *step = "初始化中"; const char *step = "初始化中";
@ -329,9 +327,9 @@ static void oled_home_refresh(uint32_t up_ms)
case NET_UI_4G_NOSIM: step = "无SIM卡!"; break; case NET_UI_4G_NOSIM: step = "无SIM卡!"; break;
default: break; default: break;
} }
oled_locate(1, 0); oled_xoff(xoff); oled_print_line("正在等待4G联网"); oled_locate(1, 0); oled_print_line("正在等待4G联网");
oled_locate(2, 0); oled_xoff(xoff); oled_print_line(step); oled_locate(2, 0); oled_print_line(step);
oled_locate(3, 0); oled_xoff(xoff); oled_print_line(""); oled_locate(3, 0); oled_print_line("");
} }
} }
} }

View File

@ -126,7 +126,6 @@
- 字符串直接写中文(工程源文件即 GBK 编码,字库 IC 按 GB2312 地址换算取字模) - 字符串直接写中文(工程源文件即 GBK 编码,字库 IC 按 GB2312 地址换算取字模)
- **已联网界面**sys_task 每 1s 刷新):第 0 行 网络 + 运行时间(`WiFi 00:02:35`,天:时:分),第 1 行 电压/电流,第 2 行 功率/电能(计量芯片离线时显示"计量芯片离线"),第 3 行 继电器状态中文(`开关:开开关关` - **已联网界面**sys_task 每 1s 刷新):第 0 行 网络 + 运行时间(`WiFi 00:02:35`,天:时:分),第 1 行 电压/电流,第 2 行 功率/电能(计量芯片离线时显示"计量芯片离线"),第 3 行 继电器状态中文(`开关:开开关关`
- **未联网界面**:只显示联网进度,不显示电能/开关——4G 模式显示"正在等待4G联网"+ 最近完成阶段(模块复位成功/AT指令成功/SIM卡检测成功/附着网络成功/连接服务器中/无SIM卡状态由 `g_net_ui_phase` 从 air780e.c 各阶段更新WiFi 固定热点显示"WiFi固定模式 正在搜索热点"+倒计时SmartConfig 显示"智能配网 请打开APP广播"+倒计时(倒计时由 esp_wait_countdown 写入 `g_net_ui_countdown` - **未联网界面**:只显示联网进度,不显示电能/开关——4G 模式显示"正在等待4G联网"+ 最近完成阶段(模块复位成功/AT指令成功/SIM卡检测成功/附着网络成功/连接服务器中/无SIM卡状态由 `g_net_ui_phase` 从 air780e.c 各阶段更新WiFi 固定热点显示"WiFi固定模式 正在搜索热点"+倒计时SmartConfig 显示"智能配网 请打开APP广播"+倒计时(倒计时由 esp_wait_countdown 写入 `g_net_ui_countdown`
- **防烧屏**:每 10s 内容整体右移 0/2/4px 轮换
- 开机欢迎页按产品模式显示标题(带秤=`智能水产投料机`,无秤=`继电器控制终端`+ `V1.5.0 RTOS`4G 阻塞建链期间由 bg_delay 钩子每 500ms 刷进度页(调度器启动前 sys_task 未运行,曾一直卡在欢迎页) - 开机欢迎页按产品模式显示标题(带秤=`智能水产投料机`,无秤=`继电器控制终端`+ `V1.5.0 RTOS`4G 阻塞建链期间由 bg_delay 钩子每 500ms 刷进度页(调度器启动前 sys_task 未运行,曾一直卡在欢迎页)
## 双通道网络4G 优先WiFi 兜底) ## 双通道网络4G 优先WiFi 兜底)

View File

@ -179,3 +179,4 @@
- OLED 带秤模式第 3 行改显示重量(`重量:xx.xKG`),读不到时显示原因 - OLED 带秤模式第 3 行改显示重量(`重量:xx.xKG`),读不到时显示原因
(无应答/帧短/CRC错/秤异常帧/站号不符);无秤模式仍显示开关状态 (无应答/帧短/CRC错/秤异常帧/站号不符);无秤模式仍显示开关状态
- 断电预警时 OLED 关显示0xAE 黑屏,省电+避免残影) - 断电预警时 OLED 关显示0xAE 黑屏,省电+避免残影)
- 去掉 OLED 防烧屏左右偏移(断电已关屏,偏移意义不大)