Merge branch 'master'

MQTTtest
陈曦 9 months ago
commit 151e7b1ac1

@ -277,7 +277,7 @@ add_library( # Sets the name of the library.
SerialPort.cpp SerialPort.cpp
#WeatherComm.cpp #WeatherComm.cpp
SensorsProtocol.cpp SensorsProtocol.cpp
serialComm.cpp SerialComm.cpp
ncnn/yolov5ncnn.cpp ncnn/yolov5ncnn.cpp
@ -323,6 +323,7 @@ add_library( # Sets the name of the library.
${TERM_CORE_ROOT}/Client/Terminal_NW.cpp ${TERM_CORE_ROOT}/Client/Terminal_NW.cpp
${TERM_CORE_ROOT}/Client/UpgradeReceiver.cpp ${TERM_CORE_ROOT}/Client/UpgradeReceiver.cpp
${TERM_CORE_ROOT}/Client/Database.cpp ${TERM_CORE_ROOT}/Client/Database.cpp
${TERM_CORE_ROOT}/Client/SimulatorDevice.cpp
) )

@ -1929,7 +1929,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 Collect_sensor_data(); //15s
Data_DEF airt; Data_DEF airt;
@ -1938,26 +1938,24 @@ int CPhoneDevice::GetIceData(IDevice::ICE_INFO *iceInfo, IDevice::ICE_TAIL *iceT
iceInfo->tension = 0; iceInfo->tension = 0;
iceInfo->tension_difference = 0; iceInfo->tension_difference = 0;
GetPullValue(2, &airt); int pullno = 0;
iceInfo->t_sensor_data[0].original_tension = airt.EuValue; int angleno = 0;
GetPullValue(4, &airt); for(int num = 0; num < MAX_SERIAL_DEV_NUM; num++)
iceInfo->t_sensor_data[1].original_tension = airt.EuValue; {
GetPullValue(5, &airt); if(sensorParam[num].SensorsType == RALLY_PROTOCOL)
iceInfo->t_sensor_data[2].original_tension = airt.EuValue; {
GetPullValue(num, &airt);
iceInfo->t_sensor_data[pullno].original_tension = airt.EuValue;
GetAngleValue(6, &airt, 0); pullno++;
iceInfo->t_sensor_data[0].deflection_angle = airt.EuValue; } else if(sensorParam[num].SensorsType == SLANT_PROTOCOL)
GetAngleValue(6, &airt, 1); {
iceInfo->t_sensor_data[0].windage_yaw_angle = airt.EuValue; GetAngleValue(num, &airt, 0);
GetAngleValue(7, &airt, 0); iceInfo->t_sensor_data[angleno].deflection_angle = airt.EuValue;
iceInfo->t_sensor_data[1].deflection_angle = airt.EuValue; GetAngleValue(num, &airt, 1);
GetAngleValue(7, &airt, 1); iceInfo->t_sensor_data[angleno].windage_yaw_angle = airt.EuValue;
iceInfo->t_sensor_data[1].windage_yaw_angle = airt.EuValue; angleno++;
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;
GetWindSpeedData(&airt); GetWindSpeedData(&airt);
iceTail->instantaneous_windspeed = airt.EuValue; iceTail->instantaneous_windspeed = airt.EuValue;
@ -2000,6 +1998,73 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo)
return true; return true;
} }
bool CPhoneDevice::OpenSensors()
{
GpioControl::setInt(CMD_SET_CAM_3V3_EN_STATE, true ? 1 : 0);
GpioControl::setInt(CMD_SET_485_EN_STATE, true ? 1 : 0);
int igpio;
GpioControl::setInt(CMD_SET_WTH_POWER, 1);
GpioControl::setInt(CMD_SET_PULL_POWER, 1);
GpioControl::setInt(CMD_SET_ANGLE_POWER, 1);
GpioControl::setInt(CMD_SET_OTHER_POWER, 1);
GpioControl::setInt(CMD_SET_PIC1_POWER, 1);
igpio = GpioControl::getInt(CMD_SET_WTH_POWER);
igpio = GpioControl::getInt(CMD_SET_PULL_POWER);
igpio = GpioControl::getInt(CMD_SET_ANGLE_POWER);
igpio = GpioControl::getInt(CMD_SET_OTHER_POWER);
igpio = GpioControl::getInt(CMD_SET_PIC1_POWER);
GpioControl::setInt(CMD_SET_SPI_POWER, 1);
GpioControl::setInt(CMD_SET_485_en0, 1);
GpioControl::setInt(CMD_SET_485_en1, 1);
GpioControl::setInt(CMD_SET_485_en2, 1);
GpioControl::setInt(CMD_SET_485_en3, 1);
GpioControl::setInt(CMD_SET_485_en4, 1);
igpio = GpioControl::getInt(CMD_SET_SPI_POWER);
igpio = GpioControl::getInt(CMD_SET_485_en0);
igpio = GpioControl::getInt(CMD_SET_485_en1);
igpio = GpioControl::getInt(CMD_SET_485_en2);
igpio = GpioControl::getInt(CMD_SET_485_en3);
igpio = GpioControl::getInt(CMD_SET_485_en4);
return 0;
}
bool CPhoneDevice::CloseSensors()
{
GpioControl::setInt(CMD_SET_12V_EN_STATE, false ? 1 : 0);
GpioControl::setInt(CMD_SET_CAM_3V3_EN_STATE, false ? 1 : 0);
GpioControl::setInt(CMD_SET_485_EN_STATE, false ? 1 : 0);
int igpio;
GpioControl::setInt(CMD_SET_WTH_POWER, 0);
GpioControl::setInt(CMD_SET_PULL_POWER, 0);
GpioControl::setInt(CMD_SET_ANGLE_POWER, 0);
GpioControl::setInt(CMD_SET_OTHER_POWER, 0);
GpioControl::setInt(CMD_SET_PIC1_POWER, 0);
igpio = GpioControl::getInt(CMD_SET_WTH_POWER);
igpio = GpioControl::getInt(CMD_SET_PULL_POWER);
igpio = GpioControl::getInt(CMD_SET_ANGLE_POWER);
igpio = GpioControl::getInt(CMD_SET_OTHER_POWER);
igpio = GpioControl::getInt(CMD_SET_PIC1_POWER);
GpioControl::setInt(CMD_SET_SPI_POWER, 0);
GpioControl::setInt(CMD_SET_485_en0, 0);
GpioControl::setInt(CMD_SET_485_en1, 0);
GpioControl::setInt(CMD_SET_485_en2, 0);
GpioControl::setInt(CMD_SET_485_en3, 0);
GpioControl::setInt(CMD_SET_485_en4, 0);
//sleep(3);
igpio = GpioControl::getInt(CMD_SET_SPI_POWER);
igpio = GpioControl::getInt(CMD_SET_485_en0);
igpio = GpioControl::getInt(CMD_SET_485_en1);
igpio = GpioControl::getInt(CMD_SET_485_en2);
igpio = GpioControl::getInt(CMD_SET_485_en3);
igpio = GpioControl::getInt(CMD_SET_485_en4);
return 0;
}
bool CPhoneDevice::OpenSensors() bool CPhoneDevice::OpenSensors()
{ {

@ -212,7 +212,7 @@ public:
virtual bool ReleaseWakelock(unsigned long wakelock); virtual bool ReleaseWakelock(unsigned long wakelock);
virtual int GetWData(WEATHER_INFO *weatherInfo); 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 OpenSensors();
virtual bool CloseSensors(); virtual bool CloseSensors();

Loading…
Cancel
Save