M350b版本
This commit is contained in:
@ -1,9 +1,23 @@
|
||||
#include "Widget_M300RTK.h"
|
||||
enum AireType
|
||||
{
|
||||
Aire_Aire = 1,
|
||||
Aire_N2=0,
|
||||
};
|
||||
|
||||
enum Target_Gas {
|
||||
Target_CO2 = 0,
|
||||
Target_H2O = 1,
|
||||
};
|
||||
int32_t CuttrentGasValue = 0;
|
||||
int32_t ZZ_Widget_M300RTK::m_siDjiWidgetValueBtn = 0;
|
||||
int32_t ZZ_Widget_M300RTK::m_siDjiWidgetValueList_CaptureMode = 1;
|
||||
int32_t ZZ_Widget_M300RTK::m_siDjiWidgetValueList_DecisionHeight = 1;
|
||||
int32_t ZZ_Widget_M300RTK::m_siDjiWidgetValueList_SamplingRate = 0;
|
||||
AireType CurrentAireType = Aire_Aire;
|
||||
Target_Gas CurrentTargetGas = Target_CO2;
|
||||
float NowTempreature = 0;
|
||||
bool isnowsystemWorking = false;
|
||||
|
||||
ZZ_Widget_M300RTK::ZZ_Widget_M300RTK(QObject* parent /*= nullptr*/)
|
||||
{
|
||||
@ -71,7 +85,14 @@ int ZZ_Widget_M300RTK::PreparteEnvironment()
|
||||
{0, DJI_WIDGET_TYPE_SWITCH, ZZ_Widget_M300RTK::OnUpdateWidgetValue, ZZ_Widget_M300RTK::OnLoadWidgetValue, this},
|
||||
{1, DJI_WIDGET_TYPE_LIST, ZZ_Widget_M300RTK::OnUpdateWidgetValue, ZZ_Widget_M300RTK::OnLoadWidgetValue, this},
|
||||
{2, DJI_WIDGET_TYPE_LIST, ZZ_Widget_M300RTK::OnUpdateWidgetValue, ZZ_Widget_M300RTK::OnLoadWidgetValue, this},
|
||||
{3, DJI_WIDGET_TYPE_LIST, ZZ_Widget_M300RTK::OnUpdateWidgetValue, ZZ_Widget_M300RTK::OnLoadWidgetValue, this}
|
||||
{3, DJI_WIDGET_TYPE_LIST, ZZ_Widget_M300RTK::OnUpdateWidgetValue, ZZ_Widget_M300RTK::OnLoadWidgetValue, this},
|
||||
{4, DJI_WIDGET_TYPE_INT_INPUT_BOX, ZZ_Widget_M300RTK::OnUpdateWidgetValue, ZZ_Widget_M300RTK::OnLoadWidgetValue, this},
|
||||
{5, DJI_WIDGET_TYPE_BUTTON, ZZ_Widget_M300RTK::OnUpdateWidgetValue, ZZ_Widget_M300RTK::OnLoadWidgetValue, this},
|
||||
{6, DJI_WIDGET_TYPE_LIST, ZZ_Widget_M300RTK::OnUpdateWidgetValue, ZZ_Widget_M300RTK::OnLoadWidgetValue, this},
|
||||
{7, DJI_WIDGET_TYPE_BUTTON, ZZ_Widget_M300RTK::OnUpdateWidgetValue, ZZ_Widget_M300RTK::OnLoadWidgetValue, this},
|
||||
{8, DJI_WIDGET_TYPE_LIST, ZZ_Widget_M300RTK::OnUpdateWidgetValue, ZZ_Widget_M300RTK::OnLoadWidgetValue, this},
|
||||
{9, DJI_WIDGET_TYPE_INT_INPUT_BOX, ZZ_Widget_M300RTK::OnUpdateWidgetValue, ZZ_Widget_M300RTK::OnLoadWidgetValue, this},
|
||||
{10, DJI_WIDGET_TYPE_BUTTON, ZZ_Widget_M300RTK::OnUpdateWidgetValue, ZZ_Widget_M300RTK::OnLoadWidgetValue, this}
|
||||
};
|
||||
|
||||
djiStat = DjiWidget_Init();
|
||||
@ -82,7 +103,7 @@ int ZZ_Widget_M300RTK::PreparteEnvironment()
|
||||
}
|
||||
|
||||
djiStat = DjiWidget_RegDefaultUiConfigByDirPath(m_qstrFilePath.toLatin1());
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||
{
|
||||
qDebug() << m_qstrFilePath.toLatin1();
|
||||
qDebug() << "ZZ_Widget_M300RTK: Func DjiWidget_RegDefaultUiConfigByDirPath.Add default widget ui config error";
|
||||
@ -120,11 +141,91 @@ int ZZ_Widget_M300RTK::test_UpdatePSDKFloatMessage(QString qstrMessage)
|
||||
T_DjiReturnCode ZZ_Widget_M300RTK::OnUpdateWidgetValue(E_DjiWidgetType widgetType, uint32_t index, int32_t value, void* userData)
|
||||
{
|
||||
ZZ_Widget_M300RTK* pCaller = (ZZ_Widget_M300RTK*)userData;
|
||||
|
||||
|
||||
|
||||
if (pCaller->m_iFlagIsVehicleCapturing)
|
||||
{
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
if (widgetType == DJI_WIDGET_TYPE_INT_INPUT_BOX) {
|
||||
if (index == 4)
|
||||
{
|
||||
qDebug()<<"now tempreatrue is "<<value;
|
||||
NowTempreature=value;
|
||||
}
|
||||
if (index == 9)
|
||||
{
|
||||
qDebug() << "now gas value is " << value;
|
||||
CuttrentGasValue = value;
|
||||
}
|
||||
}
|
||||
if (widgetType== DJI_WIDGET_TYPE_BUTTON) {
|
||||
if (index==5)
|
||||
{
|
||||
//qDebug()<<"now value is "<<value;
|
||||
|
||||
|
||||
|
||||
if (value==1)
|
||||
{
|
||||
if (isnowsystemWorking==true) return 0;
|
||||
if (NowTempreature==0) {
|
||||
pCaller->emit Signal_UpdatePSDKFloatMessage("please set correct temperature first");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
isnowsystemWorking= true;
|
||||
pCaller->emit Signal_UpdatePSDKFloatMessage("calibrating wind Sensor temperature:"+QString::number(NowTempreature*1.0/10));
|
||||
pCaller->emit SendCommand("WDA", "StartCalibrate#"+QString::number(NowTempreature*1.0/10));
|
||||
|
||||
}
|
||||
}
|
||||
if (index==7) {
|
||||
if (value==1)
|
||||
{
|
||||
if (isnowsystemWorking==true) return 0;
|
||||
isnowsystemWorking= true;
|
||||
QString AiretypeStr;
|
||||
if (CurrentAireType==Aire_Aire) {
|
||||
AiretypeStr="Air";
|
||||
}
|
||||
else {
|
||||
AiretypeStr="N2";
|
||||
}
|
||||
qDebug()<<"start gas sensor zero calibrate with "+AiretypeStr;
|
||||
pCaller->emit Signal_UpdatePSDKFloatMessage("ZeroCalibrate with "+AiretypeStr);
|
||||
pCaller->emit SendCommand("GAS", "ZeroCalibrate#"+AiretypeStr);
|
||||
}
|
||||
}
|
||||
if (index==10) {
|
||||
if (value==1)
|
||||
{
|
||||
if (isnowsystemWorking==true) return 0;
|
||||
isnowsystemWorking= true;
|
||||
QString TargetGasStr;
|
||||
if (CurrentTargetGas==Target_CO2) {
|
||||
TargetGasStr="CO2";
|
||||
}
|
||||
else {
|
||||
TargetGasStr="H2O";
|
||||
}
|
||||
//确保当前气体值不为0
|
||||
if (CuttrentGasValue==0) {
|
||||
pCaller->emit Signal_UpdatePSDKFloatMessage("please set correct gas value first");
|
||||
isnowsystemWorking=false;
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
|
||||
qDebug()<<"start gas sensor span calibrate with "+TargetGasStr+" value is "+QString::number(CuttrentGasValue);
|
||||
pCaller->emit Signal_UpdatePSDKFloatMessage(TargetGasStr+" Span Calibrating gas value is "+QString::number(CuttrentGasValue));
|
||||
pCaller->emit SendCommand("GAS", "SpanCalibrate#"+TargetGasStr+"#"+QString::number(CuttrentGasValue));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (widgetType == DJI_WIDGET_TYPE_SWITCH )
|
||||
{
|
||||
@ -135,17 +236,29 @@ T_DjiReturnCode ZZ_Widget_M300RTK::OnUpdateWidgetValue(E_DjiWidgetType widgetTyp
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (value==1)
|
||||
{
|
||||
if (isnowsystemWorking==true) {
|
||||
// ZZ_Widget_M300RTK::m_siDjiWidgetValueBtn = !value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
isnowsystemWorking= true;
|
||||
pCaller->emit Signal_UpdatePSDKFloatMessage("start capture");
|
||||
pCaller->emit Signal_StartCapture();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isnowsystemWorking==false) {
|
||||
// ZZ_Widget_M300RTK::m_siDjiWidgetValueBtn = !value;
|
||||
return 0;
|
||||
}
|
||||
isnowsystemWorking= false;
|
||||
pCaller->emit Signal_UpdatePSDKFloatMessage("capture stopped");
|
||||
pCaller->emit Signal_StopCapture();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
ZZ_Widget_M300RTK::m_siDjiWidgetValueBtn = value;
|
||||
|
||||
@ -156,12 +269,12 @@ T_DjiReturnCode ZZ_Widget_M300RTK::OnUpdateWidgetValue(E_DjiWidgetType widgetTyp
|
||||
//pCaller->test_UpdatePSDKFloatMessage(qstrTest);
|
||||
//qstrTest = "12345";
|
||||
//pCaller->emit Signal_UpdatePSDKFloatMessage(qstrTest);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (widgetType == DJI_WIDGET_TYPE_LIST )
|
||||
if (widgetType == DJI_WIDGET_TYPE_LIST )
|
||||
{
|
||||
if (index==1)
|
||||
{
|
||||
@ -176,14 +289,22 @@ T_DjiReturnCode ZZ_Widget_M300RTK::OnUpdateWidgetValue(E_DjiWidgetType widgetTyp
|
||||
{
|
||||
ZZ_Widget_M300RTK::m_siDjiWidgetValueList_SamplingRate = value;
|
||||
}
|
||||
|
||||
else if (index==6)
|
||||
{
|
||||
CurrentAireType = (AireType)value;
|
||||
}
|
||||
else if (index==8)
|
||||
{
|
||||
CurrentTargetGas = (Target_Gas)value;
|
||||
}
|
||||
|
||||
|
||||
#ifdef ZZ_FLAG_TEST
|
||||
qDebug() << "OnUpdateWidgetValue " << "widgetType " << widgetType << "index " << index << "value " << value;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -193,7 +314,7 @@ T_DjiReturnCode ZZ_Widget_M300RTK::OnLoadWidgetValue(E_DjiWidgetType widgetType,
|
||||
if (widgetType == DJI_WIDGET_TYPE_SWITCH)
|
||||
{
|
||||
//qDebug() << "OnLoadWidgetValue " << "widgetType " << widgetType << "index " << index << "value " << value;
|
||||
|
||||
|
||||
*value= ZZ_Widget_M300RTK::m_siDjiWidgetValueBtn;
|
||||
}
|
||||
|
||||
@ -212,8 +333,27 @@ T_DjiReturnCode ZZ_Widget_M300RTK::OnLoadWidgetValue(E_DjiWidgetType widgetType,
|
||||
{
|
||||
*value = ZZ_Widget_M300RTK::m_siDjiWidgetValueList_SamplingRate;
|
||||
}
|
||||
|
||||
else if (index == 6)
|
||||
{
|
||||
*value = (int32_t)CurrentAireType;
|
||||
} else if (index == 8)
|
||||
{
|
||||
*value = (int32_t)CurrentTargetGas;
|
||||
}
|
||||
|
||||
}
|
||||
if (widgetType==DJI_WIDGET_TYPE_INT_INPUT_BOX)
|
||||
{
|
||||
if (index == 4)
|
||||
{
|
||||
*value = NowTempreature;
|
||||
}
|
||||
if (index == 9)
|
||||
{
|
||||
*value = CuttrentGasValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
@ -231,4 +371,21 @@ int ZZ_Widget_M300RTK::Slot_UpdatePSDKFloatMessage(QString qstrMessage)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ZZ_Widget_M300RTK::BackCommand(QString Worker, QString Command) {
|
||||
if (Worker=="WDA") {
|
||||
if (Command=="Finish") {
|
||||
isnowsystemWorking= false;
|
||||
qDebug()<<"wind calibrate finished";
|
||||
emit Signal_UpdatePSDKFloatMessage("wind calibrate finished");
|
||||
}
|
||||
}
|
||||
else if (Worker == "GAS") {
|
||||
if (Command == "Finish") {
|
||||
isnowsystemWorking = false;
|
||||
qDebug() << "gas zero calibrate finished";
|
||||
emit Signal_UpdatePSDKFloatMessage("gas zero calibrate finished");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user