From 9e4690e5f4fe40687358a5d272c25581f1694006 Mon Sep 17 00:00:00 2001 From: "XI.CHEN" Date: Tue, 3 Sep 2024 09:44:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96=E8=A6=86?= =?UTF-8?q?=E5=86=B0=E6=95=B0=E6=8D=AE=EF=BC=88=E9=80=9A=E7=94=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 40 +++++++++---------- app/src/main/cpp/PhoneDevice.h | 2 +- .../cpp/{serialComm.cpp => SerialComm.cpp} | 0 .../main/cpp/{serialComm.h => SerialComm.h} | 0 4 files changed, 20 insertions(+), 22 deletions(-) rename app/src/main/cpp/{serialComm.cpp => SerialComm.cpp} (100%) rename app/src/main/cpp/{serialComm.h => SerialComm.h} (100%) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 94a6d133..07152646 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -1798,7 +1798,7 @@ void CPhoneDevice::UpdateSimcard(const std::string& simcard) } -int CPhoneDevice::GetIceData(IDevice::ICE_INFO *iceInfo, IDevice::ICE_TAIL *iceTail, SENSOR_PARAM sensorParam) +int CPhoneDevice::GetIceData(IDevice::ICE_INFO *iceInfo, IDevice::ICE_TAIL *iceTail, SENSOR_PARAM *sensorParam) { Collect_sensor_data(); //15s Data_DEF airt; @@ -1807,26 +1807,24 @@ int CPhoneDevice::GetIceData(IDevice::ICE_INFO *iceInfo, IDevice::ICE_TAIL *iceT iceInfo->tension = 0; iceInfo->tension_difference = 0; - GetPullValue(2, &airt); - iceInfo->t_sensor_data[0].original_tension = airt.EuValue; - GetPullValue(4, &airt); - iceInfo->t_sensor_data[1].original_tension = airt.EuValue; - GetPullValue(5, &airt); - iceInfo->t_sensor_data[2].original_tension = airt.EuValue; - - - GetAngleValue(6, &airt, 0); - iceInfo->t_sensor_data[0].deflection_angle = airt.EuValue; - GetAngleValue(6, &airt, 1); - iceInfo->t_sensor_data[0].windage_yaw_angle = airt.EuValue; - GetAngleValue(7, &airt, 0); - iceInfo->t_sensor_data[1].deflection_angle = airt.EuValue; - GetAngleValue(7, &airt, 1); - iceInfo->t_sensor_data[1].windage_yaw_angle = airt.EuValue; - GetAngleValue(13, &airt, 0); - iceInfo->t_sensor_data[2].deflection_angle = airt.EuValue; - GetAngleValue(13, &airt, 1); - iceInfo->t_sensor_data[2].windage_yaw_angle = airt.EuValue; + int pullno = 0; + int angleno = 0; + for(int num = 0; num < MAX_SERIAL_DEV_NUM; num++) + { + if(sensorParam[num].SensorsType == RALLY_PROTOCOL) + { + GetPullValue(num, &airt); + iceInfo->t_sensor_data[pullno].original_tension = airt.EuValue; + pullno++; + } else if(sensorParam[num].SensorsType == SLANT_PROTOCOL) + { + GetAngleValue(num, &airt, 0); + iceInfo->t_sensor_data[angleno].deflection_angle = airt.EuValue; + GetAngleValue(num, &airt, 1); + iceInfo->t_sensor_data[angleno].windage_yaw_angle = airt.EuValue; + angleno++; + } + } GetWindSpeedData(&airt); iceTail->instantaneous_windspeed = airt.EuValue; diff --git a/app/src/main/cpp/PhoneDevice.h b/app/src/main/cpp/PhoneDevice.h index 0a338a68..61ada62a 100644 --- a/app/src/main/cpp/PhoneDevice.h +++ b/app/src/main/cpp/PhoneDevice.h @@ -199,7 +199,7 @@ public: virtual bool ReleaseWakelock(unsigned long wakelock); virtual int GetWData(WEATHER_INFO *weatherInfo); - virtual int GetIceData(ICE_INFO *iceInfo, ICE_TAIL *icetail, SENSOR_PARAM sensorParam); + virtual int GetIceData(ICE_INFO *iceInfo, ICE_TAIL *icetail, SENSOR_PARAM *sensorParam); virtual bool OpenSensors(); virtual bool CloseSensors(); diff --git a/app/src/main/cpp/serialComm.cpp b/app/src/main/cpp/SerialComm.cpp similarity index 100% rename from app/src/main/cpp/serialComm.cpp rename to app/src/main/cpp/SerialComm.cpp diff --git a/app/src/main/cpp/serialComm.h b/app/src/main/cpp/SerialComm.h similarity index 100% rename from app/src/main/cpp/serialComm.h rename to app/src/main/cpp/SerialComm.h