|
|
@@ -778,7 +778,15 @@ static void hmi_refresh_pages(const struct tm *ptm)
|
|
|
DTU_Write("%s",readinfo);
|
|
|
rt_free(readinfo);
|
|
|
list_mem();
|
|
|
- device_status.hmi_fresh = 1;
|
|
|
+ /* 2026-10-15 修复:不得覆盖云端 read 触发的待补发上报标志(hmi_fresh==2)。
|
|
|
+ * 原实现无条件置 1,会把 read→getinfo→sync→补发上报 链路上的待办请求吃掉:
|
|
|
+ * 本屏幕刷新周期(refresh_num==5)恰好落在 RTU 应答 synchronization 的
|
|
|
+ * 1.5~2.2s 窗口内时,==2 判定失效 → 补发被吞 → read 无应答、RTU 等待超时
|
|
|
+ * (设备实测 2026-10-15:read 后数百 ms 内即被覆盖)。 */
|
|
|
+ if(device_status.hmi_fresh!=2)
|
|
|
+ {
|
|
|
+ device_status.hmi_fresh = 1;
|
|
|
+ }
|
|
|
rt_thread_delay(100);
|
|
|
}
|
|
|
//在解析getinfo中清除超时0
|
|
|
@@ -1798,7 +1806,9 @@ static void hmi_refresh_debug1(void)
|
|
|
* 说明:屏幕心跳里 SwversionV** 可能与 getFullData 一样每秒都发,
|
|
|
* 若每次都复位重复过滤表会让去重完全失效;因此只在"版本串发生变化"时复位
|
|
|
* (换型号/换页面工程才会变)。屏幕重启但版本不变的情况由 HMI_DEDUPE_RESYNC_SEC
|
|
|
- * 周期复位兜底(最坏 10s 后恢复全量刷新)。 */
|
|
|
+ * 周期复位兜底(最坏 10s 后恢复全量刷新)。
|
|
|
+ * 2026-10-15:版本串变化还用于触发版本类型切换(hmi_switch_version),
|
|
|
+ * 见 HMI_Decode 的 SwversionV 分支。 */
|
|
|
static char s_last_hmi_ver[16] = {0};
|
|
|
|
|
|
static rt_bool_t hmi_ver_changed(const char *frame)
|
|
|
@@ -1823,6 +1833,180 @@ static rt_bool_t hmi_ver_changed(const char *frame)
|
|
|
return RT_FALSE;
|
|
|
}
|
|
|
|
|
|
+/* ==================== 屏幕版本串 → 版本类型切换(2026-10-15) ====================
|
|
|
+ * 触发:HMI_Decode 的 SwversionV 分支中,hmi_ver_changed() 检测到屏幕版本握手串
|
|
|
+ * 发生变化时调用一次——即连接/更换不同版本的屏幕工程时,按串切换
|
|
|
+ * dtype/version_type/driver 并写 EF(MA_save/param_mirror_sync)。
|
|
|
+ * 历史:本逻辑原为 HMI_Decode 内一段 else-if 链(V12/V11/V1/V43/V42/V41/V4/V6/
|
|
|
+ * V30/V7),自 SwversionV 整页刷新分支加入后所有版本帧都被其先命中,
|
|
|
+ * 原链永远不可达(死代码);现迁移为本函数并改由版本串变化事件触发,
|
|
|
+ * 逐分支语义与原链一致(分包防误切仍用 hmi_cmd_match 严格匹配)。 */
|
|
|
+static void hmi_switch_version(const char *frame)
|
|
|
+{
|
|
|
+ //高空-带拍照
|
|
|
+ if (strstr(frame,"SwversionV12")!=NULL)
|
|
|
+ {
|
|
|
+ device_status.dtype = 3;
|
|
|
+ if(device_status.version_type != 12)
|
|
|
+ {
|
|
|
+ device_status.version_type = 12;
|
|
|
+ sprintf(device_status.driver, "%s",VERSION_GK);
|
|
|
+ ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
+ ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型
|
|
|
+ MA_save();
|
|
|
+ param_mirror_sync();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //高空
|
|
|
+ else if (strstr(frame,"SwversionV11")!=NULL)
|
|
|
+ {
|
|
|
+ device_status.dtype = 3;
|
|
|
+ if(device_status.version_type != 11)
|
|
|
+ {
|
|
|
+ device_status.version_type = 11;
|
|
|
+ sprintf(device_status.driver, "%s",VERSION_GK);
|
|
|
+ ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
+ ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型
|
|
|
+ MA_save();
|
|
|
+ param_mirror_sync();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //1.0
|
|
|
+ /* 注意:必须用严格匹配——"SwversionV1" 是 "SwversionV11/12" 的前缀,
|
|
|
+ * 串口分包时残段会误切到本分支(同 V4 的问题,见 hmi_cmd_match 说明) */
|
|
|
+ else if (hmi_cmd_match(frame,"SwversionV1"))
|
|
|
+ {
|
|
|
+ if(device_status.version_type != 1)
|
|
|
+ {
|
|
|
+ device_status.dtype = 3;
|
|
|
+ device_status.version_type = 1;
|
|
|
+ sprintf(device_status.driver, "%s",VERSION_ZP);
|
|
|
+ ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
+ ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型
|
|
|
+ MA_save();
|
|
|
+ param_mirror_sync();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //中端款
|
|
|
+ else if (strstr(frame,"SwversionV43")!=NULL) {
|
|
|
+ device_status.dtype = 3;
|
|
|
+ if(device_status.version_type != 43)
|
|
|
+ {
|
|
|
+ device_status.dtype = 3;
|
|
|
+ device_status.version_type = 43;
|
|
|
+ sprintf(device_status.driver, "%s",VERSION_HK_2000W);
|
|
|
+ ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
+ ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型+
|
|
|
+ MA_save();
|
|
|
+ param_mirror_sync();
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //低端款
|
|
|
+ else if (strstr(frame,"SwversionV42")!=NULL) {
|
|
|
+ device_status.dtype = 3;
|
|
|
+ if(device_status.version_type != 42)
|
|
|
+ {
|
|
|
+ device_status.dtype = 3;
|
|
|
+ device_status.version_type = 42;
|
|
|
+ sprintf(device_status.driver, "%s",VERSION_HK_2000W);
|
|
|
+ ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
+ ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型+
|
|
|
+ MA_save();
|
|
|
+ param_mirror_sync();
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //4.0
|
|
|
+ else if (strstr(frame,"SwversionV41")!=NULL) {
|
|
|
+ device_status.dtype = 3;
|
|
|
+ if(device_status.version_type != 41)
|
|
|
+ {
|
|
|
+ device_status.dtype = 3;
|
|
|
+ device_status.version_type = 41;
|
|
|
+ sprintf(device_status.driver, "%s",VERSION_HK);
|
|
|
+ ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
+ ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型+
|
|
|
+ DTU_Write("SwversionV41");
|
|
|
+ MA_save();
|
|
|
+ param_mirror_sync();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //水稻
|
|
|
+ /* 注意:必须用严格匹配——"SwversionV4" 是 "SwversionV41/42/43" 的前缀。
|
|
|
+ * 实测(2026-10-08):串口分包时 "SwversionV43" 的前段 "SwversionV4" 会误切到
|
|
|
+ * 本分支(version_type 43→4、误报 RTU、写 Flash),随后完整帧又切回 43,
|
|
|
+ * 造成配置来回翻转。见 hmi_cmd_match 说明。 */
|
|
|
+ else if (hmi_cmd_match(frame,"SwversionV4"))
|
|
|
+ {
|
|
|
+ device_status.dtype = 3;
|
|
|
+ if(device_status.version_type != 4)
|
|
|
+ {
|
|
|
+ device_status.version_type = 4;
|
|
|
+ sprintf(device_status.driver, "%s",VERSION_HK_2000W);
|
|
|
+ ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
+ ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型
|
|
|
+ MA_save();
|
|
|
+ param_mirror_sync();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //吸虫塔
|
|
|
+ else if (strstr(frame,"SwversionV6")!=NULL) {
|
|
|
+ device_status.dtype = 3;
|
|
|
+ if(device_status.version_type != 6)
|
|
|
+ {
|
|
|
+ device_status.version_type = 6;
|
|
|
+ sprintf(device_status.driver, "%s",VERSION_XCT);
|
|
|
+ ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
+ ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型
|
|
|
+ MA_save();
|
|
|
+ param_mirror_sync();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (strstr(frame,"SwversionV30")!=NULL) {
|
|
|
+ if(device_status.version_type != 30)
|
|
|
+ {
|
|
|
+ device_status.version_type = 30;
|
|
|
+ sprintf(device_status.driver, "%s",VERSION_Robot);
|
|
|
+ ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
+ MA_save();
|
|
|
+ param_mirror_sync();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if((strstr(frame,"SwversionV7")!=NULL)) {
|
|
|
+ if(device_status.dtype!=7)
|
|
|
+ {
|
|
|
+ LOG_D("设置版本类型:7");
|
|
|
+ device_status.dtype = 7;
|
|
|
+ device_status.version_type = 7;
|
|
|
+ ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //设备类型
|
|
|
+ ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
+ DTU_Write("SwversionV7");
|
|
|
+ MA_save();
|
|
|
+ param_mirror_sync();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
static void HMI_Decode(void)
|
|
|
{
|
|
|
char tmp[128];
|
|
|
@@ -1851,10 +2035,13 @@ static void HMI_Decode(void)
|
|
|
}
|
|
|
else if(strstr(rx_buffer,"SwversionV") != NULL || strstr(rx_buffer,"getFullData") != NULL)
|
|
|
{
|
|
|
- /* 屏幕版本握手串变化(换型号/换页面工程) → 复位重复过滤表,立即整页全量刷新 */
|
|
|
+ /* 屏幕版本握手串变化(换型号/换页面工程) → 复位重复过滤表 + 按串切换版本类型,
|
|
|
+ * 并立即整页全量刷新 */
|
|
|
if (strstr(rx_buffer,"SwversionV") != NULL && hmi_ver_changed(rx_buffer))
|
|
|
{
|
|
|
hmi_dedupe_reset();
|
|
|
+ /* 2026-10-15:版本串变化后按字符设置版本类型(见 hmi_switch_version 说明) */
|
|
|
+ hmi_switch_version(rx_buffer);
|
|
|
}
|
|
|
HMI_BATCH_BEGIN();
|
|
|
hmi_refresh_pages(&tm);
|
|
|
@@ -2621,168 +2808,10 @@ static void HMI_Decode(void)
|
|
|
else if (strstr(rx_buffer,"DebugDisable")!=NULL) {
|
|
|
Debug_log_OFF();
|
|
|
}
|
|
|
- //高空-带拍照
|
|
|
- else if (strstr(rx_buffer,"SwversionV12")!=NULL)
|
|
|
- {
|
|
|
- device_status.dtype = 3;
|
|
|
- if(device_status.version_type != 12)
|
|
|
- {
|
|
|
- device_status.version_type = 12;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_GK);
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型
|
|
|
- MA_save();
|
|
|
- param_mirror_sync();
|
|
|
- }
|
|
|
- else {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- //高空
|
|
|
- else if (strstr(rx_buffer,"SwversionV11")!=NULL)
|
|
|
- {
|
|
|
- device_status.dtype = 3;
|
|
|
- if(device_status.version_type != 11)
|
|
|
- {
|
|
|
- device_status.version_type = 11;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_GK);
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型
|
|
|
- MA_save();
|
|
|
- param_mirror_sync();
|
|
|
- }
|
|
|
- else {
|
|
|
-
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
- //1.0
|
|
|
- /* 注意:必须用严格匹配——"SwversionV1" 是 "SwversionV11/12" 的前缀,
|
|
|
- * 串口分包时残段会误切到本分支(同 V4 的问题,见 hmi_cmd_match 说明) */
|
|
|
- else if (hmi_cmd_match(rx_buffer,"SwversionV1"))
|
|
|
- {
|
|
|
- if(device_status.version_type != 1)
|
|
|
- {
|
|
|
- device_status.dtype = 3;
|
|
|
- device_status.version_type = 1;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_ZP);
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型
|
|
|
- MA_save();
|
|
|
- param_mirror_sync();
|
|
|
- }
|
|
|
- else {
|
|
|
-
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
- //中端款
|
|
|
- else if (strstr(rx_buffer,"SwversionV43")!=NULL) {
|
|
|
- device_status.dtype = 3;
|
|
|
- if(device_status.version_type != 43)
|
|
|
- {
|
|
|
- device_status.dtype = 3;
|
|
|
- device_status.version_type = 43;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_HK_2000W);
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型+
|
|
|
- MA_save();
|
|
|
- param_mirror_sync();
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
- //低端款
|
|
|
- else if (strstr(rx_buffer,"SwversionV42")!=NULL) {
|
|
|
- device_status.dtype = 3;
|
|
|
- if(device_status.version_type != 42)
|
|
|
- {
|
|
|
- device_status.dtype = 3;
|
|
|
- device_status.version_type = 42;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_HK_2000W);
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型+
|
|
|
- MA_save();
|
|
|
- param_mirror_sync();
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
- //4.0
|
|
|
- else if (strstr(rx_buffer,"SwversionV41")!=NULL) {
|
|
|
- device_status.dtype = 3;
|
|
|
- if(device_status.version_type != 41)
|
|
|
- {
|
|
|
- device_status.dtype = 3;
|
|
|
- device_status.version_type = 41;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_HK);
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型+
|
|
|
- DTU_Write("SwversionV41");
|
|
|
- MA_save();
|
|
|
- param_mirror_sync();
|
|
|
- }
|
|
|
- else {
|
|
|
-
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
- //水稻
|
|
|
- /* 注意:必须用严格匹配——"SwversionV4" 是 "SwversionV41/42/43" 的前缀。
|
|
|
- * 实测(2026-10-08):串口分包时 "SwversionV43" 的前段 "SwversionV4" 会误切到
|
|
|
- * 本分支(version_type 43→4、误报 RTU、写 Flash),随后完整帧又切回 43,
|
|
|
- * 造成配置来回翻转。见 hmi_cmd_match 说明。 */
|
|
|
- else if (hmi_cmd_match(rx_buffer,"SwversionV4"))
|
|
|
- {
|
|
|
- device_status.dtype = 3;
|
|
|
- if(device_status.version_type != 4)
|
|
|
- {
|
|
|
- device_status.version_type = 4;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_HK_2000W);
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型
|
|
|
- MA_save();
|
|
|
- param_mirror_sync();
|
|
|
- }
|
|
|
- else {
|
|
|
-
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
- //吸虫塔
|
|
|
- else if (strstr(rx_buffer,"SwversionV6")!=NULL) {
|
|
|
- device_status.dtype = 3;
|
|
|
- if(device_status.version_type != 6)
|
|
|
- {
|
|
|
- device_status.version_type = 6;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_XCT);
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型
|
|
|
- MA_save();
|
|
|
- param_mirror_sync();
|
|
|
- }
|
|
|
- }
|
|
|
- else if (strstr(rx_buffer,"SwversionV30")!=NULL) {
|
|
|
- if(device_status.version_type != 30)
|
|
|
- {
|
|
|
- device_status.version_type = 30;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_Robot);
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- MA_save();
|
|
|
- param_mirror_sync();
|
|
|
- }
|
|
|
- }
|
|
|
- else if((strstr(rx_buffer,"SwversionV7")!=NULL)) {
|
|
|
- if(device_status.dtype!=7)
|
|
|
- {
|
|
|
- LOG_D("设置版本类型:7");
|
|
|
- device_status.dtype = 7;
|
|
|
- device_status.version_type = 7;
|
|
|
- ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //设备类型
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- DTU_Write("SwversionV7");
|
|
|
- MA_save();
|
|
|
- param_mirror_sync();
|
|
|
- }
|
|
|
- }
|
|
|
+ /* 屏幕版本类型切换(SwversionV12/V11/V1/V43/V42/V41/V4/V6/V30/V7)已迁移:
|
|
|
+ * 原链位于本 else-if 阶梯内,因上方“SwversionV 整页刷新”分支会先命中所有
|
|
|
+ * 版本帧而永远不可达(死代码);现改由“版本串变化检测”分支在
|
|
|
+ * hmi_ver_changed() 为真时调用 hmi_switch_version() 完成切换(2026-10-15)。 */
|
|
|
else if (strstr(rx_buffer,"putTest.switchFAN_PU=1")!=NULL) {
|
|
|
ctr_Fan_PUT(ON);
|
|
|
}
|