Compare commits
5 Commits
47153346cd
...
3.33.39.21
Author | SHA1 | Date | |
---|---|---|---|
884cd90ac4 | |||
1b12e68f84 | |||
db81ffe5cc | |||
9f76699bc2 | |||
23153193a6 |
@ -30,6 +30,9 @@
|
|||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "dji_typedef.h"
|
#include "dji_typedef.h"
|
||||||
#include "dji_power_management.h"
|
#include "dji_power_management.h"
|
||||||
|
#include <wiringPi.h>
|
||||||
|
|
||||||
|
#define HIGH_POWER_APPLY_PIN 11
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -54,6 +54,7 @@ static T_DjiReturnCode PsdkTestWidget_SetWidgetValue_StartRecord(E_DjiWidgetType
|
|||||||
|
|
||||||
static void *PsdkTest_IrisRecordSystemChanged(void *arg);
|
static void *PsdkTest_IrisRecordSystemChanged(void *arg);
|
||||||
static void extractSpectralBinAndBandnumber(bool isModifyBin);
|
static void extractSpectralBinAndBandnumber(bool isModifyBin);
|
||||||
|
static void closeXimeaRecordSystem();
|
||||||
|
|
||||||
/* Private values ------------------------------------------------------------*/
|
/* Private values ------------------------------------------------------------*/
|
||||||
static T_DjiTaskHandle s_widgetTestThread;
|
static T_DjiTaskHandle s_widgetTestThread;
|
||||||
@ -79,11 +80,12 @@ int systemON_Control = 0;
|
|||||||
|
|
||||||
char s_strUIMessage[100]=" ";
|
char s_strUIMessage[100]=" ";
|
||||||
static char * s_strStateOfSbg=" ";
|
static char * s_strStateOfSbg=" ";
|
||||||
static char * s_strSbgSatelliteCounter=" ";
|
char s_strSbgSatelliteCounter[100]=" ";
|
||||||
static char * s_strSbgAccuracy=" ";
|
char s_strSbgAccuracy[100]=" ";
|
||||||
char XimeaFramerate[100]=" ";
|
char XimeaFramerate[100]=" ";
|
||||||
int framerate = 0;
|
int framerate = 0;
|
||||||
char XimeaExposeTime[100]=" ";
|
char XimeaExposeTime[100]=" ";
|
||||||
|
int exposeTimeInt = 0;
|
||||||
char XimeaExposeMaxValue[100]=" ";
|
char XimeaExposeMaxValue[100]=" ";
|
||||||
char s_spectralBin[100]=" ";
|
char s_spectralBin[100]=" ";
|
||||||
int spectralBinInt = 0;
|
int spectralBinInt = 0;
|
||||||
@ -111,14 +113,13 @@ static const T_DjiWidgetHandlerListItem s_widgetHandlerList[] = {
|
|||||||
{1, DJI_WIDGET_TYPE_LIST, DjiTestWidget_SetWidgetValue, DjiTestWidget_GetWidgetValue, NULL},
|
{1, DJI_WIDGET_TYPE_LIST, DjiTestWidget_SetWidgetValue, DjiTestWidget_GetWidgetValue, NULL},
|
||||||
{2, DJI_WIDGET_TYPE_SWITCH, DjiTestWidget_SetWidgetValue, DjiTestWidget_GetWidgetValue, NULL},
|
{2, DJI_WIDGET_TYPE_SWITCH, DjiTestWidget_SetWidgetValue, DjiTestWidget_GetWidgetValue, NULL},
|
||||||
{3, DJI_WIDGET_TYPE_SCALE, DjiTestWidget_SetWidgetValue, DjiTestWidget_GetWidgetValue, NULL},
|
{3, DJI_WIDGET_TYPE_SCALE, DjiTestWidget_SetWidgetValue, DjiTestWidget_GetWidgetValue, NULL},
|
||||||
{4, DJI_WIDGET_TYPE_BUTTON, DjiTestWidget_SetWidgetValue, DjiTestWidget_GetWidgetValue, NULL},
|
{4, DJI_WIDGET_TYPE_LIST, PsdkTestWidget_SetWidgetValue_StartRecord, DjiTestWidget_GetWidgetValue, NULL},
|
||||||
{5, DJI_WIDGET_TYPE_SWITCH, PsdkTestWidget_SetWidgetValue_StartRecord, DjiTestWidget_GetWidgetValue, NULL},
|
{5, DJI_WIDGET_TYPE_SWITCH, PsdkTestWidget_SetWidgetValue_StartRecord, DjiTestWidget_GetWidgetValue, NULL},
|
||||||
{6, DJI_WIDGET_TYPE_INT_INPUT_BOX, PsdkTestWidget_SetWidgetValue_StartRecord, DjiTestWidget_GetWidgetValue, NULL},
|
{6, DJI_WIDGET_TYPE_INT_INPUT_BOX, PsdkTestWidget_SetWidgetValue_StartRecord, DjiTestWidget_GetWidgetValue, NULL},
|
||||||
{7, DJI_WIDGET_TYPE_BUTTON, PsdkTestWidget_SetWidgetValue_StartRecord, DjiTestWidget_GetWidgetValue, NULL},
|
{7, DJI_WIDGET_TYPE_BUTTON, PsdkTestWidget_SetWidgetValue_StartRecord, DjiTestWidget_GetWidgetValue, NULL},
|
||||||
{8, DJI_WIDGET_TYPE_INT_INPUT_BOX, PsdkTestWidget_SetWidgetValue_StartRecord, DjiTestWidget_GetWidgetValue, NULL},
|
{8, DJI_WIDGET_TYPE_INT_INPUT_BOX, PsdkTestWidget_SetWidgetValue_StartRecord, DjiTestWidget_GetWidgetValue, NULL},
|
||||||
{9, DJI_WIDGET_TYPE_SWITCH, PsdkTestWidget_SetWidgetValue_StartRecord, DjiTestWidget_GetWidgetValue, NULL},
|
{9, DJI_WIDGET_TYPE_SWITCH, PsdkTestWidget_SetWidgetValue_StartRecord, DjiTestWidget_GetWidgetValue, NULL},
|
||||||
{10, DJI_WIDGET_TYPE_LIST, PsdkTestWidget_SetWidgetValue_StartRecord, DjiTestWidget_GetWidgetValue, NULL},//PsdkTestWidget_SetWidgetValue
|
{10, DJI_WIDGET_TYPE_LIST, PsdkTestWidget_SetWidgetValue_StartRecord, DjiTestWidget_GetWidgetValue, NULL},//PsdkTestWidget_SetWidgetValue
|
||||||
{11, DJI_WIDGET_TYPE_LIST, PsdkTestWidget_SetWidgetValue_StartRecord, DjiTestWidget_GetWidgetValue, NULL},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *s_widgetTypeNameArray[] = {
|
static const char *s_widgetTypeNameArray[] = {
|
||||||
@ -285,18 +286,24 @@ static void *DjiTest_WidgetTask(void *arg)
|
|||||||
T_DjiReturnCode djiStat;
|
T_DjiReturnCode djiStat;
|
||||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
|
|
||||||
extractSpectralBinAndBandnumber(false);
|
|
||||||
|
|
||||||
USER_UTIL_UNUSED(arg);
|
USER_UTIL_UNUSED(arg);
|
||||||
|
|
||||||
while (1) {
|
while (1)
|
||||||
|
{
|
||||||
|
s_widgetValueList[6] = framerate;
|
||||||
|
s_widgetValueList[8] = exposeTimeInt;
|
||||||
|
if (systemON_Control == 4)
|
||||||
|
{
|
||||||
|
s_widgetValueList[5] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
djiStat = osalHandler->GetTimeMs(&sysTimeMs);
|
djiStat = osalHandler->GetTimeMs(&sysTimeMs);
|
||||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Get system time ms error, stat = 0x%08llX", djiStat);
|
USER_LOG_ERROR("Get system time ms error, stat = 0x%08llX", djiStat);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef USER_FIRMWARE_MAJOR_VERSION
|
#ifndef USER_FIRMWARE_MAJOR_VERSION
|
||||||
snprintf(message, DJI_WIDGET_FLOATING_WINDOW_MSG_MAX_LEN, "%s\n高光谱: %s; 惯导: %s;\n卫星: %s; 惯导状态: %s;\n帧率: %s;曝光: %s;max: %s;\nP: %s; R: %s; Y: %s;\n光谱bin: %s;\n时间: %s min; 空间: %s G;\n",
|
snprintf(message, DJI_WIDGET_FLOATING_WINDOW_MSG_MAX_LEN, "%s\n高光谱: %s 惯导: %s\n卫星: %s 惯导状态: %s\n帧率: %s 曝光: %s μs %s \nP: %s R: %s Y: %s \n光谱bin: %s \n时间: %s min 空间: %s G\n",
|
||||||
s_strUIMessage, s_strStateOfXimea, s_strStateOfSbg, s_strSbgSatelliteCounter, s_strSbgSolutionMode, XimeaFramerate, XimeaExposeTime, XimeaExposeMaxValue, s_strPitch, s_strRoll, s_strYaw, s_spectralBin, s_remainingTime, s_remainingSpace);
|
s_strUIMessage, s_strStateOfXimea, s_strStateOfSbg, s_strSbgSatelliteCounter, s_strSbgSolutionMode, XimeaFramerate, XimeaExposeTime, XimeaExposeMaxValue, s_strPitch, s_strRoll, s_strYaw, s_spectralBin, s_remainingTime, s_remainingSpace);
|
||||||
#else
|
#else
|
||||||
snprintf(message, DJI_WIDGET_FLOATING_WINDOW_MSG_MAX_LEN,
|
snprintf(message, DJI_WIDGET_FLOATING_WINDOW_MSG_MAX_LEN,
|
||||||
@ -367,6 +374,8 @@ static void *DjiTest_WidgetTask(void *arg)
|
|||||||
// 关闭文件指针
|
// 关闭文件指针
|
||||||
pclose(fp);
|
pclose(fp);
|
||||||
|
|
||||||
|
extractSpectralBinAndBandnumber(false);
|
||||||
|
|
||||||
|
|
||||||
//判断ximeaAirborneSystem系统是否存活
|
//判断ximeaAirborneSystem系统是否存活
|
||||||
// if(ximeaAirborneSystemSurvivalTime > 10)
|
// if(ximeaAirborneSystemSurvivalTime > 10)
|
||||||
@ -467,21 +476,11 @@ static void *PsdkTest_IrisRecordSystemChanged(void *arg)//
|
|||||||
case 0:
|
case 0:
|
||||||
s_strStateOfSbg="未打开";
|
s_strStateOfSbg="未打开";
|
||||||
|
|
||||||
if (systemON_Control == 0 || systemON_Control == 4)
|
strcpy(s_strUIMessage,"系统已就绪!");
|
||||||
{
|
messageTimeCounter = 0;
|
||||||
strcpy(s_strUIMessage,"系统已就绪!");
|
messageTimespan = 1000;
|
||||||
messageTimeCounter = 0;
|
|
||||||
messageTimespan = 1000;
|
|
||||||
|
|
||||||
systemON_Control = 1;//ximeaAirborneSystem系统一启动就会发送此信息 → 代表采集系统就绪;
|
systemON_Control = 1;//ximeaAirborneSystem系统一启动就会发送此信息 → 代表采集系统就绪;
|
||||||
}
|
|
||||||
|
|
||||||
if (systemON_Control == 3)
|
|
||||||
{
|
|
||||||
strcpy(s_strUIMessage,"数据量过大,采集系统已经停止,请重新上电!");
|
|
||||||
messageTimeCounter = 0;
|
|
||||||
messageTimespan = 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
@ -492,7 +491,6 @@ static void *PsdkTest_IrisRecordSystemChanged(void *arg)//
|
|||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
s_strStateOfSbg="采集中";
|
s_strStateOfSbg="采集中";
|
||||||
systemON_Control = 3;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -502,9 +500,10 @@ static void *PsdkTest_IrisRecordSystemChanged(void *arg)//
|
|||||||
else if (strcmp(result[0],"Accuracy") == 0)
|
else if (strcmp(result[0],"Accuracy") == 0)
|
||||||
{
|
{
|
||||||
// printf("惯导定位精度为: %s\n\n", result[1]);
|
// printf("惯导定位精度为: %s\n\n", result[1]);
|
||||||
|
// printf("卫星数为: %s\n\n", result[2]);
|
||||||
|
|
||||||
s_strSbgAccuracy=result[1];
|
strcpy(s_strSbgAccuracy,result[1]);
|
||||||
s_strSbgSatelliteCounter=result[2];
|
strcpy(s_strSbgSatelliteCounter,result[2]);
|
||||||
|
|
||||||
ximeaAirborneSystemSurvivalTime++;
|
ximeaAirborneSystemSurvivalTime++;
|
||||||
|
|
||||||
@ -531,19 +530,19 @@ static void *PsdkTest_IrisRecordSystemChanged(void *arg)//
|
|||||||
switch (s_sbgMagState)
|
switch (s_sbgMagState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
s_strSbgSolutionMode="UNINITI";//UNINITIALIZED
|
s_strSbgSolutionMode="dis_UNINIT";//UNINITIALIZED
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
s_strSbgSolutionMode="GYRO";//VERTICAL_GYRO
|
s_strSbgSolutionMode="dis_GYRO";//VERTICAL_GYRO
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
s_strSbgSolutionMode="AHRS";
|
s_strSbgSolutionMode="dis_AHRS";
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
s_strSbgSolutionMode="VELOCITY";//NAV_VELOCITY
|
s_strSbgSolutionMode="dis_VELOCITY";//NAV_VELOCITY
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
s_strSbgSolutionMode="FULL";//NAV_POSITION
|
s_strSbgSolutionMode="en_FULL";//NAV_POSITION
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -586,21 +585,25 @@ static void *PsdkTest_IrisRecordSystemChanged(void *arg)//
|
|||||||
messageTimespan = 200;
|
messageTimespan = 200;
|
||||||
break;
|
break;
|
||||||
case 100:
|
case 100:
|
||||||
s_strStateOfXimea="未打开";
|
s_strStateOfXimea="未连接";
|
||||||
break;
|
break;
|
||||||
case 101:
|
case 101:
|
||||||
s_strStateOfXimea="打开成功";
|
s_strStateOfXimea="连接成功";
|
||||||
|
|
||||||
strcpy(s_strUIMessage,"系统启动成功!");
|
if(s_stateOfXimea == 100)
|
||||||
messageTimeCounter = 0;
|
{
|
||||||
messageTimespan = 20;
|
strcpy(s_strUIMessage,"系统启动成功!");
|
||||||
|
messageTimeCounter = 0;
|
||||||
|
messageTimespan = 20;
|
||||||
|
}
|
||||||
|
systemON_Control = 3;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 102:
|
case 102:
|
||||||
s_strStateOfXimea="帧率完成";
|
s_strStateOfXimea="连接成功";
|
||||||
break;
|
break;
|
||||||
case 103:
|
case 103:
|
||||||
s_strStateOfXimea="曝光完成";
|
s_strStateOfXimea="连接成功";
|
||||||
break;
|
break;
|
||||||
case 104:
|
case 104:
|
||||||
s_strStateOfXimea="采集中";
|
s_strStateOfXimea="采集中";
|
||||||
@ -614,9 +617,9 @@ static void *PsdkTest_IrisRecordSystemChanged(void *arg)//
|
|||||||
{
|
{
|
||||||
strcpy(XimeaExposeMaxValue, result[1]);
|
strcpy(XimeaExposeMaxValue, result[1]);
|
||||||
|
|
||||||
int exposeTimeTmp = atoi(result[2]);
|
exposeTimeInt = atoi(result[2]);
|
||||||
sprintf(XimeaExposeTime,"%d",exposeTimeTmp);
|
sprintf(XimeaExposeTime,"%d",exposeTimeInt);
|
||||||
s_widgetValueList[8] = exposeTimeTmp;
|
s_widgetValueList[8] = exposeTimeInt;
|
||||||
|
|
||||||
strcpy(s_strUIMessage,"曝光时间设置成功!");
|
strcpy(s_strUIMessage,"曝光时间设置成功!");
|
||||||
messageTimeCounter = 0;
|
messageTimeCounter = 0;
|
||||||
@ -667,7 +670,6 @@ static T_DjiReturnCode DjiTestWidget_GetWidgetValue(E_DjiWidgetType widgetType,
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int frameRateGlobel = 0;
|
|
||||||
static T_DjiReturnCode PsdkTestWidget_SetWidgetValue_StartRecord(E_DjiWidgetType widgetType, uint32_t index, int32_t value,
|
static T_DjiReturnCode PsdkTestWidget_SetWidgetValue_StartRecord(E_DjiWidgetType widgetType, uint32_t index, int32_t value,
|
||||||
void *userData)
|
void *userData)
|
||||||
{
|
{
|
||||||
@ -675,17 +677,47 @@ static T_DjiReturnCode PsdkTestWidget_SetWidgetValue_StartRecord(E_DjiWidgetType
|
|||||||
|
|
||||||
USER_LOG_INFO("Set widget value, widgetType = %s, widgetIndex = %d ,widgetValue = %d",
|
USER_LOG_INFO("Set widget value, widgetType = %s, widgetIndex = %d ,widgetValue = %d",
|
||||||
s_widgetTypeNameArray[widgetType], index, value);
|
s_widgetTypeNameArray[widgetType], index, value);
|
||||||
|
int32_t valueTmp = s_widgetValueList[index];
|
||||||
s_widgetValueList[index] = value;
|
s_widgetValueList[index] = value;
|
||||||
|
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
|
case 4:
|
||||||
|
if (value==0)//等待指令
|
||||||
|
{
|
||||||
|
}
|
||||||
|
if (value==1)
|
||||||
|
{
|
||||||
|
system("reboot");
|
||||||
|
}
|
||||||
|
else if (value==2)
|
||||||
|
{
|
||||||
|
system("shutdown now");
|
||||||
|
}
|
||||||
|
else if (value==3)
|
||||||
|
{
|
||||||
|
system("/home/300tc/projects/udpClient/udpClient 127.0.0.1 9,1");
|
||||||
|
}
|
||||||
|
else if (value==4)
|
||||||
|
{
|
||||||
|
system("/home/300tc/projects/udpClient/udpClient 127.0.0.1 9,0");
|
||||||
|
}
|
||||||
|
else if (value==5)
|
||||||
|
{
|
||||||
|
strcpy(s_strUIMessage,"系统正在更新,稍后会自动重启!");
|
||||||
|
messageTimeCounter = 0;
|
||||||
|
messageTimespan = 10000;
|
||||||
|
|
||||||
|
system("/home/pi/tc_ShellScripts/update0.sh &> /media/nvme/300TC/update/log");
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 5://系统启动关闭
|
case 5://系统启动关闭
|
||||||
if (value==0)//系统关闭
|
if (value==0)//系统关闭
|
||||||
{
|
{
|
||||||
printf("systemON_Control的值为:%d\n", systemON_Control);
|
printf("systemON_Control的值为:%d\n", systemON_Control);
|
||||||
if (0 <= systemON_Control && systemON_Control <= 4)
|
if (0 <= systemON_Control && systemON_Control <= 4)
|
||||||
{
|
{
|
||||||
strcpy(s_strUIMessage,"系统已经关闭!");
|
strcpy(s_strUIMessage,"系统正在关闭!");
|
||||||
messageTimeCounter = 0;
|
messageTimeCounter = 0;
|
||||||
messageTimespan = 1000;
|
messageTimespan = 1000;
|
||||||
|
|
||||||
@ -700,25 +732,7 @@ static T_DjiReturnCode PsdkTestWidget_SetWidgetValue_StartRecord(E_DjiWidgetType
|
|||||||
// printf("命令行指令为:%s\n",commandtmp);
|
// printf("命令行指令为:%s\n",commandtmp);
|
||||||
// system(commandtmp);
|
// system(commandtmp);
|
||||||
|
|
||||||
FILE *fp;
|
closeXimeaRecordSystem();
|
||||||
fp = popen("kill $(ps aux | grep ximeaAirborneSystem | grep -v grep | awk \'{print $2}\')", "r");
|
|
||||||
if (fp == NULL)
|
|
||||||
{
|
|
||||||
perror("popen");
|
|
||||||
}
|
|
||||||
|
|
||||||
s_strStateOfXimea=" ";
|
|
||||||
s_strStateOfSbg=" ";
|
|
||||||
s_strSbgSatelliteCounter=" ";
|
|
||||||
s_strSbgSolutionMode=" ";
|
|
||||||
sprintf(XimeaFramerate,"%s"," ");
|
|
||||||
sprintf(XimeaExposeTime,"%s"," ");
|
|
||||||
sprintf(XimeaExposeMaxValue,"%s"," ");
|
|
||||||
sprintf(s_spectralBin,"%s"," ");
|
|
||||||
s_remainingTime=" ";
|
|
||||||
|
|
||||||
s_widgetValueList[6] = 0;
|
|
||||||
s_widgetValueList[8] = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (value==1)//系统启动
|
else if (value==1)//系统启动
|
||||||
@ -763,6 +777,13 @@ static T_DjiReturnCode PsdkTestWidget_SetWidgetValue_StartRecord(E_DjiWidgetType
|
|||||||
messageTimeCounter = 0;
|
messageTimeCounter = 0;
|
||||||
messageTimespan = 10;
|
messageTimespan = 10;
|
||||||
|
|
||||||
|
// printf("index-------:%d\n", index);
|
||||||
|
// printf("valueTmp-------:%d\n", valueTmp);
|
||||||
|
|
||||||
|
//下面的代码没有作用:无法恢复界面的值为默认值(valueTmp)
|
||||||
|
// DjiTestWidget_SetWidgetValue(widgetType, index, valueTmp, userData);
|
||||||
|
// s_widgetValueList[index] = valueTmp;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (s_stateOfXimea > 103)
|
else if (s_stateOfXimea > 103)
|
||||||
@ -794,12 +815,10 @@ static T_DjiReturnCode PsdkTestWidget_SetWidgetValue_StartRecord(E_DjiWidgetType
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
frameRateGlobel = value;
|
|
||||||
|
|
||||||
char command[50] = "5,";
|
char command[50] = "5,";
|
||||||
char framerate[20];
|
char framerate_str[20];
|
||||||
sprintf(framerate,"%d",value);
|
sprintf(framerate_str,"%d",value);
|
||||||
strcat(command,framerate);
|
strcat(command,framerate_str);
|
||||||
sendto(s_sockfd, command,strlen(command),0,(struct sockaddr *)&s_server,sizeof(s_server));
|
sendto(s_sockfd, command,strlen(command),0,(struct sockaddr *)&s_server,sizeof(s_server));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -855,24 +874,13 @@ static T_DjiReturnCode PsdkTestWidget_SetWidgetValue_StartRecord(E_DjiWidgetType
|
|||||||
}
|
}
|
||||||
|
|
||||||
//曝光时间有效性判断
|
//曝光时间有效性判断
|
||||||
if(frameRateGlobel == 0)
|
float maxExposureTime = 1 / (float)framerate * 1000;//单位是ms
|
||||||
{
|
|
||||||
strcpy(s_strUIMessage,"请先设置帧率!");
|
|
||||||
messageTimeCounter = 0;
|
|
||||||
messageTimespan = 10;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
float maxExposureTime = 1 / (float)frameRateGlobel * 1000;//单位是ms
|
|
||||||
|
|
||||||
if(value > maxExposureTime)
|
if(value > maxExposureTime)
|
||||||
{
|
{
|
||||||
strcpy(s_strUIMessage,"曝光时间超过上限,无效!");
|
strcpy(s_strUIMessage,"曝光时间已设置为最大!");
|
||||||
messageTimeCounter = 0;
|
messageTimeCounter = 0;
|
||||||
messageTimespan = 10;
|
messageTimespan = 10;
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else if(value == 0)
|
else if(value == 0)
|
||||||
{
|
{
|
||||||
@ -895,6 +903,11 @@ static T_DjiReturnCode PsdkTestWidget_SetWidgetValue_StartRecord(E_DjiWidgetType
|
|||||||
case 9:
|
case 9:
|
||||||
if (value==0)//停止采集
|
if (value==0)//停止采集
|
||||||
{
|
{
|
||||||
|
if (s_stateOfXimea != 104)
|
||||||
|
{
|
||||||
|
s_strStateOfXimea="连接成功";
|
||||||
|
}
|
||||||
|
|
||||||
char* command = "4";
|
char* command = "4";
|
||||||
sendto(s_sockfd, command,strlen(command),0,(struct sockaddr *)&s_server,sizeof(s_server));
|
sendto(s_sockfd, command,strlen(command),0,(struct sockaddr *)&s_server,sizeof(s_server));
|
||||||
}
|
}
|
||||||
@ -908,57 +921,13 @@ static T_DjiReturnCode PsdkTestWidget_SetWidgetValue_StartRecord(E_DjiWidgetType
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (s_stateOfXimea == 101)
|
|
||||||
{
|
|
||||||
strcpy(s_strUIMessage,"请先设置帧率!");
|
|
||||||
messageTimeCounter = 0;
|
|
||||||
messageTimespan = 10;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (s_stateOfXimea == 102)
|
|
||||||
{
|
|
||||||
strcpy(s_strUIMessage,"请先设置曝光时间!");
|
|
||||||
messageTimeCounter = 0;
|
|
||||||
messageTimespan = 10;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
s_strStateOfXimea="预约采集";
|
||||||
char* command = "3";
|
char* command = "3";
|
||||||
sendto(s_sockfd, command,strlen(command),0,(struct sockaddr *)&s_server,sizeof(s_server));
|
sendto(s_sockfd, command,strlen(command),0,(struct sockaddr *)&s_server,sizeof(s_server));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
if (value==0)//等待指令
|
|
||||||
{
|
|
||||||
}
|
|
||||||
if (value==1)
|
|
||||||
{
|
|
||||||
system("reboot");
|
|
||||||
}
|
|
||||||
else if (value==2)
|
|
||||||
{
|
|
||||||
system("shutdown now");
|
|
||||||
}
|
|
||||||
else if (value==3)
|
|
||||||
{
|
|
||||||
system("/home/300tc/projects/udpClient/udpClient 127.0.0.1 9,1");
|
|
||||||
}
|
|
||||||
else if (value==4)
|
|
||||||
{
|
|
||||||
system("/home/300tc/projects/udpClient/udpClient 127.0.0.1 9,0");
|
|
||||||
}
|
|
||||||
else if (value==5)
|
|
||||||
{
|
|
||||||
strcpy(s_strUIMessage,"系统正在更新,稍后会自动重启!");
|
|
||||||
messageTimeCounter = 0;
|
|
||||||
messageTimespan = 10000;
|
|
||||||
|
|
||||||
system("/home/pi/tc_ShellScripts/update0.sh &> /media/nvme/300TC/update/log");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
if (value==0)//等待指令
|
if (value==0)//等待指令
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -970,10 +939,11 @@ static T_DjiReturnCode PsdkTestWidget_SetWidgetValue_StartRecord(E_DjiWidgetType
|
|||||||
{
|
{
|
||||||
system("sudo sed -i 's/spectralBin =.*/spectralBin = 2;/g' /media/nvme/300TC/config/ximea.cfg");
|
system("sudo sed -i 's/spectralBin =.*/spectralBin = 2;/g' /media/nvme/300TC/config/ximea.cfg");
|
||||||
}
|
}
|
||||||
|
closeXimeaRecordSystem();
|
||||||
|
|
||||||
extractSpectralBinAndBandnumber(true);
|
extractSpectralBinAndBandnumber(true);
|
||||||
|
|
||||||
strcpy(s_strUIMessage,"请重新上电!");
|
strcpy(s_strUIMessage,"请等待采集系统重启!");
|
||||||
messageTimeCounter = 0;
|
messageTimeCounter = 0;
|
||||||
messageTimespan = 10000;
|
messageTimespan = 10000;
|
||||||
|
|
||||||
@ -985,6 +955,34 @@ static T_DjiReturnCode PsdkTestWidget_SetWidgetValue_StartRecord(E_DjiWidgetType
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void closeXimeaRecordSystem()
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
fp = popen("kill $(ps aux | grep ximeaAirborneSystem | grep -v grep | awk \'{print $2}\')", "r");
|
||||||
|
if (fp == NULL)
|
||||||
|
{
|
||||||
|
perror("popen");
|
||||||
|
}
|
||||||
|
|
||||||
|
s_strStateOfXimea=" ";
|
||||||
|
s_strStateOfSbg=" ";
|
||||||
|
sprintf(s_strSbgSatelliteCounter,"%s"," ");
|
||||||
|
s_strSbgSolutionMode=" ";
|
||||||
|
sprintf(XimeaFramerate,"%s"," ");
|
||||||
|
sprintf(XimeaExposeTime,"%s"," ");
|
||||||
|
sprintf(XimeaExposeMaxValue,"%s"," ");
|
||||||
|
sprintf(s_spectralBin,"%s"," ");
|
||||||
|
s_remainingTime=" ";
|
||||||
|
|
||||||
|
s_widgetValueList[5] = 0;
|
||||||
|
// s_widgetValueList[6] = 0;
|
||||||
|
// s_widgetValueList[8] = 0;
|
||||||
|
framerate = 0;
|
||||||
|
exposeTimeInt = 0;
|
||||||
|
|
||||||
|
system("sudo gpio write 10 0");
|
||||||
|
}
|
||||||
|
|
||||||
static void extractSpectralBinAndBandnumber(bool isModifyBin)
|
static void extractSpectralBinAndBandnumber(bool isModifyBin)
|
||||||
{
|
{
|
||||||
unsigned long long spectralBin, height;
|
unsigned long long spectralBin, height;
|
||||||
@ -1029,17 +1027,7 @@ static void extractSpectralBinAndBandnumber(bool isModifyBin)
|
|||||||
pclose(fp);
|
pclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
char command[256];
|
s_widgetValueList[10] = spectralBin;
|
||||||
memset(command, 0, sizeof(command));
|
|
||||||
|
|
||||||
sprintf(command,"sudo sed -i 's/.*bin.*/ \"widget_name\": \"bin%d_%d\",/g' %s", spectralBin, height, jsonPathCn);
|
|
||||||
// printf("command: %s", command);
|
|
||||||
system(command);
|
|
||||||
|
|
||||||
memset(command, 0, sizeof(command));
|
|
||||||
sprintf(command,"sudo sed -i 's/.*bin.*/ \"widget_name\": \"bin%d_%d\",/g' %s", spectralBin, height, jsonPathEn);
|
|
||||||
// printf("command: %s", command);
|
|
||||||
system(command);
|
|
||||||
|
|
||||||
if (!isModifyBin)
|
if (!isModifyBin)
|
||||||
{
|
{
|
||||||
|
@ -8,128 +8,18 @@
|
|||||||
"is_enable": true
|
"is_enable": true
|
||||||
},
|
},
|
||||||
"speaker": {
|
"speaker": {
|
||||||
"is_enable_tts": true,
|
"is_enable_tts": false,
|
||||||
"is_enable_voice": false
|
"is_enable_voice": false
|
||||||
},
|
},
|
||||||
"widget_list": [
|
"widget_list": [
|
||||||
{
|
|
||||||
"widget_index": 0,
|
|
||||||
"widget_type": "button",
|
|
||||||
"widget_name": "按钮",
|
|
||||||
"icon_file_set": {
|
|
||||||
"icon_file_name_selected": "icon_button1.png",
|
|
||||||
"icon_file_name_unselected": "icon_button1.png"
|
|
||||||
},
|
|
||||||
"customize_rc_buttons_config": {
|
|
||||||
"is_enable": true,
|
|
||||||
"mapping_config_display_order": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 1,
|
|
||||||
"widget_type": "list",
|
|
||||||
"widget_name": "列表",
|
|
||||||
"list_item": [
|
|
||||||
{
|
|
||||||
"item_name": "选项_1",
|
|
||||||
"icon_file_set": {
|
|
||||||
"icon_file_name_selected": "icon_list_item1.png",
|
|
||||||
"icon_file_name_unselected": "icon_list_item1.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"item_name": "选项_2",
|
|
||||||
"icon_file_set": {
|
|
||||||
"icon_file_name_selected": "icon_list_item2.png",
|
|
||||||
"icon_file_name_unselected": "icon_list_item2.png"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"customize_rc_buttons_config": {
|
|
||||||
"is_enable": true,
|
|
||||||
"mapping_config_display_order": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 2,
|
|
||||||
"widget_type": "switch",
|
|
||||||
"widget_name": "开关",
|
|
||||||
"icon_file_set": {
|
|
||||||
"icon_file_name_selected": "icon_switch_select.png",
|
|
||||||
"icon_file_name_unselected": "icon_switch_unselect.png"
|
|
||||||
},
|
|
||||||
"customize_rc_buttons_config": {
|
|
||||||
"is_enable": true,
|
|
||||||
"mapping_config_display_order": 2
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 3,
|
|
||||||
"widget_type": "scale",
|
|
||||||
"widget_name": "范围条",
|
|
||||||
"icon_file_set": {
|
|
||||||
"icon_file_name_selected": "icon_scale.png",
|
|
||||||
"icon_file_name_unselected": "icon_scale.png"
|
|
||||||
},
|
|
||||||
"customize_rc_buttons_config": {
|
|
||||||
"is_enable": true,
|
|
||||||
"mapping_config_display_order": 3,
|
|
||||||
"button_value_step_length": 5
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 4,
|
|
||||||
"widget_type": "button",
|
|
||||||
"widget_name": "按钮",
|
|
||||||
"icon_file_set": {
|
|
||||||
"icon_file_name_selected": "icon_button1.png",
|
|
||||||
"icon_file_name_unselected": "icon_button1.png"
|
|
||||||
},
|
|
||||||
"customize_rc_buttons_config": {
|
|
||||||
"is_enable": true,
|
|
||||||
"mapping_config_display_order": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"config_interface": {
|
"config_interface": {
|
||||||
"text_input_box": {
|
|
||||||
"widget_name": "文本输入框",
|
|
||||||
"placeholder_text": "请输入消息",
|
|
||||||
"is_enable": true
|
|
||||||
},
|
|
||||||
"widget_list": [
|
"widget_list": [
|
||||||
{
|
{
|
||||||
"widget_index": 5,
|
"widget_index": 4,
|
||||||
"widget_type": "switch",
|
|
||||||
"widget_name": "系统启动"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 6,
|
|
||||||
"widget_type": "int_input_box",
|
|
||||||
"widget_name": "帧率",
|
|
||||||
"int_input_box_hint": "单位:hz"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 7,
|
|
||||||
"widget_type": "button",
|
|
||||||
"widget_name": "自动曝光"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 8,
|
|
||||||
"widget_type": "int_input_box",
|
|
||||||
"widget_name": "曝光时间",
|
|
||||||
"int_input_box_hint": "单位:毫秒"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 9,
|
|
||||||
"widget_type": "switch",
|
|
||||||
"widget_name": "高光谱采集"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 10,
|
|
||||||
"widget_type": "list",
|
"widget_type": "list",
|
||||||
"widget_name": "系统指令",
|
"widget_name": "高级指令",
|
||||||
"list_item": [
|
"list_item": [
|
||||||
{
|
{
|
||||||
"item_name": "其他"
|
"item_name": "其他"
|
||||||
@ -152,7 +42,34 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"widget_index": 11,
|
"widget_index": 5,
|
||||||
|
"widget_type": "switch",
|
||||||
|
"widget_name": "系统启动"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widget_index": 6,
|
||||||
|
"widget_type": "int_input_box",
|
||||||
|
"widget_name": "帧率",
|
||||||
|
"int_input_box_hint": "单位:赫兹"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widget_index": 7,
|
||||||
|
"widget_type": "button",
|
||||||
|
"widget_name": "自动曝光"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widget_index": 8,
|
||||||
|
"widget_type": "int_input_box",
|
||||||
|
"widget_name": "曝光时间",
|
||||||
|
"int_input_box_hint": "单位:微秒"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widget_index": 9,
|
||||||
|
"widget_type": "switch",
|
||||||
|
"widget_name": "高光谱采集"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widget_index": 10,
|
||||||
"widget_type": "list",
|
"widget_type": "list",
|
||||||
"widget_name": "bin",
|
"widget_name": "bin",
|
||||||
"list_item": [
|
"list_item": [
|
||||||
|
@ -8,128 +8,18 @@
|
|||||||
"is_enable": true
|
"is_enable": true
|
||||||
},
|
},
|
||||||
"speaker": {
|
"speaker": {
|
||||||
"is_enable_tts": true,
|
"is_enable_tts": false,
|
||||||
"is_enable_voice": false
|
"is_enable_voice": false
|
||||||
},
|
},
|
||||||
"widget_list": [
|
"widget_list": [
|
||||||
{
|
|
||||||
"widget_index": 0,
|
|
||||||
"widget_type": "button",
|
|
||||||
"widget_name": "Button",
|
|
||||||
"icon_file_set": {
|
|
||||||
"icon_file_name_selected": "icon_button1.png",
|
|
||||||
"icon_file_name_unselected": "icon_button1.png"
|
|
||||||
},
|
|
||||||
"customize_rc_buttons_config": {
|
|
||||||
"is_enable": true,
|
|
||||||
"mapping_config_display_order": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 1,
|
|
||||||
"widget_type": "list",
|
|
||||||
"widget_name": "List",
|
|
||||||
"list_item": [
|
|
||||||
{
|
|
||||||
"item_name": "Item_1",
|
|
||||||
"icon_file_set": {
|
|
||||||
"icon_file_name_selected": "icon_list_item1.png",
|
|
||||||
"icon_file_name_unselected": "icon_list_item1.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"item_name": "Item_2",
|
|
||||||
"icon_file_set": {
|
|
||||||
"icon_file_name_selected": "icon_list_item2.png",
|
|
||||||
"icon_file_name_unselected": "icon_list_item2.png"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"customize_rc_buttons_config": {
|
|
||||||
"is_enable": true,
|
|
||||||
"mapping_config_display_order": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 2,
|
|
||||||
"widget_type": "switch",
|
|
||||||
"widget_name": "Switch",
|
|
||||||
"icon_file_set": {
|
|
||||||
"icon_file_name_selected": "icon_switch_select.png",
|
|
||||||
"icon_file_name_unselected": "icon_switch_unselect.png"
|
|
||||||
},
|
|
||||||
"customize_rc_buttons_config": {
|
|
||||||
"is_enable": true,
|
|
||||||
"mapping_config_display_order": 2
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 3,
|
|
||||||
"widget_type": "scale",
|
|
||||||
"widget_name": "Scale",
|
|
||||||
"icon_file_set": {
|
|
||||||
"icon_file_name_selected": "icon_scale.png",
|
|
||||||
"icon_file_name_unselected": "icon_scale.png"
|
|
||||||
},
|
|
||||||
"customize_rc_buttons_config": {
|
|
||||||
"is_enable": true,
|
|
||||||
"mapping_config_display_order": 3,
|
|
||||||
"button_value_step_length": 5
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 4,
|
|
||||||
"widget_type": "button",
|
|
||||||
"widget_name": "Button",
|
|
||||||
"icon_file_set": {
|
|
||||||
"icon_file_name_selected": "icon_button1.png",
|
|
||||||
"icon_file_name_unselected": "icon_button1.png"
|
|
||||||
},
|
|
||||||
"customize_rc_buttons_config": {
|
|
||||||
"is_enable": true,
|
|
||||||
"mapping_config_display_order": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"config_interface": {
|
"config_interface": {
|
||||||
"text_input_box": {
|
|
||||||
"widget_name": "TextInputBox",
|
|
||||||
"placeholder_text": "Please input message",
|
|
||||||
"is_enable": true
|
|
||||||
},
|
|
||||||
"widget_list": [
|
"widget_list": [
|
||||||
{
|
{
|
||||||
"widget_index": 5,
|
"widget_index": 4,
|
||||||
"widget_type": "switch",
|
|
||||||
"widget_name": "系统启动"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 6,
|
|
||||||
"widget_type": "int_input_box",
|
|
||||||
"widget_name": "帧率",
|
|
||||||
"int_input_box_hint": "单位:hz"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 7,
|
|
||||||
"widget_type": "button",
|
|
||||||
"widget_name": "自动曝光"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 8,
|
|
||||||
"widget_type": "int_input_box",
|
|
||||||
"widget_name": "曝光时间",
|
|
||||||
"int_input_box_hint": "单位:毫秒"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 9,
|
|
||||||
"widget_type": "switch",
|
|
||||||
"widget_name": "高光谱采集"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"widget_index": 10,
|
|
||||||
"widget_type": "list",
|
"widget_type": "list",
|
||||||
"widget_name": "系统指令",
|
"widget_name": "高级指令",
|
||||||
"list_item": [
|
"list_item": [
|
||||||
{
|
{
|
||||||
"item_name": "其他"
|
"item_name": "其他"
|
||||||
@ -152,7 +42,34 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"widget_index": 11,
|
"widget_index": 5,
|
||||||
|
"widget_type": "switch",
|
||||||
|
"widget_name": "系统启动"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widget_index": 6,
|
||||||
|
"widget_type": "int_input_box",
|
||||||
|
"widget_name": "帧率",
|
||||||
|
"int_input_box_hint": "单位:赫兹"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widget_index": 7,
|
||||||
|
"widget_type": "button",
|
||||||
|
"widget_name": "自动曝光"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widget_index": 8,
|
||||||
|
"widget_type": "int_input_box",
|
||||||
|
"widget_name": "曝光时间",
|
||||||
|
"int_input_box_hint": "单位:微秒"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widget_index": 9,
|
||||||
|
"widget_type": "switch",
|
||||||
|
"widget_name": "高光谱采集"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widget_index": 10,
|
||||||
"widget_type": "list",
|
"widget_type": "list",
|
||||||
"widget_name": "bin",
|
"widget_name": "bin",
|
||||||
"list_item": [
|
"list_item": [
|
||||||
|
@ -85,7 +85,7 @@ T_DjiReturnCode DjiTest_XPortStartService(void)
|
|||||||
return djiStat;
|
return djiStat;
|
||||||
}
|
}
|
||||||
|
|
||||||
//通过注册回调函数获取X-Port 的姿态信息.注册后,回调函数将会被自动调用,调用频率为
|
//通过注册回调函数获取X-Port 的姿态信息.注册后,回调函数将会被自动调用,调用频率为10hz
|
||||||
djiStat = DjiXPort_RegReceiveAttitudeInformationCallback(ReceiveXPortAttitudeInformation);
|
djiStat = DjiXPort_RegReceiveAttitudeInformationCallback(ReceiveXPortAttitudeInformation);
|
||||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("register receive XPort attitude information callback function error: 0x%08llX.",
|
USER_LOG_ERROR("register receive XPort attitude information callback function error: 0x%08llX.",
|
||||||
|
@ -95,6 +95,9 @@ target_link_libraries(${PROJECT_NAME}
|
|||||||
z
|
z
|
||||||
m
|
m
|
||||||
pthread
|
pthread
|
||||||
|
rt
|
||||||
|
crypt
|
||||||
|
wiringPi
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(TARGET ${PROJECT_NAME}
|
add_custom_command(TARGET ${PROJECT_NAME}
|
||||||
|
@ -137,7 +137,7 @@ int main(int argc, char **argv)
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
returnCode = DjiCore_SetAlias("300TC_3.32.37.21");
|
returnCode = DjiCore_SetAlias("300TC_3.33.39.21");
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("set alias error");
|
USER_LOG_ERROR("set alias error");
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
@ -721,12 +721,32 @@ delay:
|
|||||||
|
|
||||||
static T_DjiReturnCode DjiTest_HighPowerApplyPinInit()
|
static T_DjiReturnCode DjiTest_HighPowerApplyPinInit()
|
||||||
{
|
{
|
||||||
|
wiringPiSetup(); // 初始化WiringPi库
|
||||||
|
|
||||||
|
pinMode(HIGH_POWER_APPLY_PIN, OUTPUT); // 配置引脚为输出模式
|
||||||
|
pullUpDnControl(HIGH_POWER_APPLY_PIN, PUD_DOWN); // 启用下拉电阻,使引脚默认为低电平
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static T_DjiReturnCode DjiTest_WriteHighPowerApplyPin(E_DjiPowerManagementPinState pinState)
|
static T_DjiReturnCode DjiTest_WriteHighPowerApplyPin(E_DjiPowerManagementPinState pinState)
|
||||||
{
|
{
|
||||||
//attention: please pull up the HWPR pin state by hardware.
|
//attention: please pull up the HWPR pin state by hardware.
|
||||||
|
|
||||||
|
int wiringPiState;
|
||||||
|
|
||||||
|
switch (pinState) {
|
||||||
|
case DJI_POWER_MANAGEMENT_PIN_STATE_RESET:
|
||||||
|
wiringPiState = LOW; // WiringPi库中,LOW表示低电平
|
||||||
|
break;
|
||||||
|
case DJI_POWER_MANAGEMENT_PIN_STATE_SET:
|
||||||
|
wiringPiState = HIGH; // WiringPi库中,HIGH表示高电平
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
USER_LOG_ERROR("pin state unknown: %d.", pinState);
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
digitalWrite(HIGH_POWER_APPLY_PIN, wiringPiState); // 使用WiringPi库设置引脚状态
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user