From a43965639af7dfae9616372d4134ce2c4afb29d2 Mon Sep 17 00:00:00 2001 From: jxjajs Date: Wed, 11 Dec 2024 20:12:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=87=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/SensorsProtocol.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/app/src/main/cpp/SensorsProtocol.cpp b/app/src/main/cpp/SensorsProtocol.cpp index f38a199b..c12d6809 100644 --- a/app/src/main/cpp/SensorsProtocol.cpp +++ b/app/src/main/cpp/SensorsProtocol.cpp @@ -1281,6 +1281,8 @@ void GM_StartSerialComm() { srdt.ms_dev[i].aiValue[j].AiState = SER_STARTSAMPLE; weatherpntmsg[j].AiState = SER_STARTSAMPLE; + sprintf(szbuf, "init weather_state%d=%d", j, weatherpntmsg[j].AiState); + DebugLog(8, szbuf, 'I'); } break; case RALLY_PROTOCOL: /* 拉力*/ @@ -1299,6 +1301,8 @@ void GM_StartSerialComm() { srdt.ms_dev[i].aiValue[j].AiState = SER_STARTSAMPLE; weatherpntmsg[j].AiState = SER_STARTSAMPLE; + sprintf(szbuf, "init weather_state%d=%d", j, weatherpntmsg[j].AiState); + DebugLog(8, szbuf, 'I'); } break; case SLANT_PROTOCOL: /* 倾角*/ @@ -1492,12 +1496,17 @@ void GM_IsCloseSensors() else if (SER_SAMPLE == srdt.ms_dev[i].aiValue[j].AiState) srdt.ms_dev[i].aiValue[j].AiState = SAMPLINGSUCCESS; } - for (j = 0; j < WEATHER_DATA_NUM; j++) - { - if (SER_STARTSAMPLE == weatherpntmsg[j].AiState) - weatherpntmsg[j].AiState = SER_SAMPLEFAIL; - else if (SER_SAMPLE == weatherpntmsg[j].AiState) - weatherpntmsg[j].AiState = SAMPLINGSUCCESS; + if((devparam[i].ProtocolIdx == WIND_PROTOCOL) || (WEATHER_PROTOCOL == devparam[i].ProtocolIdx)) + { + for (j = 0; j < WEATHER_DATA_NUM; j++) + { + if (SER_STARTSAMPLE == weatherpntmsg[j].AiState) + weatherpntmsg[j].AiState = SER_SAMPLEFAIL; + else if (SER_SAMPLE == weatherpntmsg[j].AiState) + weatherpntmsg[j].AiState = SAMPLINGSUCCESS; + sprintf(buf, "over weather_state%d=%d", j, weatherpntmsg[j].AiState); + DebugLog(8, buf, 'I'); + } } } break; @@ -3774,7 +3783,7 @@ int GetWeatherData(Data_DEF *data, int datano) sprintf(szbuf, "大气压"); break; case OpticalRadiationNo: - sprintf(szbuf, "大气压"); + sprintf(szbuf, "日照"); break; default: sprintf(szbuf, "未知");