1 Commits

Author SHA1 Message Date
a3ea1b8b67 添加空间空间bin2修改功能
只支持空间光谱统一bin1和bin2
2024-12-02 11:19:54 +08:00
4 changed files with 76 additions and 11 deletions

View File

@ -54,6 +54,7 @@ static T_DjiReturnCode PsdkTestWidget_SetWidgetValue_StartRecord(E_DjiWidgetType
static void *PsdkTest_IrisRecordSystemChanged(void *arg);
static void extractSpectralBinAndBandnumber(bool isModifyBin);
static void extractSpatialBinAndWidth(bool isModifyBin);
static void closeXimeaRecordSystem();
/* Private values ------------------------------------------------------------*/
@ -88,7 +89,9 @@ char XimeaExposeTime[100]=" ";
int exposeTimeInt = 0;
char XimeaExposeMaxValue[100]=" ";
char s_spectralBin[100]=" ";
char s_spatialBin[100]=" ";
int spectralBinInt = 0;
int spatialBinInt = 0;
static char * s_strSbgSolutionMode=" ";
static char * s_strStateOfXimea=" ";
@ -305,8 +308,8 @@ static void *DjiTest_WidgetTask(void *arg)
}
#ifndef USER_FIRMWARE_MAJOR_VERSION
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);
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时间: %s min 空间: %s G\n光谱bin: %s 空间bin: %s\n",
s_strUIMessage, s_strStateOfXimea, s_strStateOfSbg, s_strSbgSatelliteCounter, s_strSbgSolutionMode, XimeaFramerate, XimeaExposeTime, XimeaExposeMaxValue, s_strPitch, s_strRoll, s_strYaw, s_remainingTime, s_remainingSpace, s_spectralBin, s_spatialBin);
#else
snprintf(message, DJI_WIDGET_FLOATING_WINDOW_MSG_MAX_LEN,
"System time : %u ms\r\nVersion: v%02d.%02d.%02d.%02d\r\nBuild time: %s %s", sysTimeMs,
@ -329,6 +332,9 @@ static void *DjiTest_WidgetTask(void *arg)
strcpy(s_strUIMessage," ");
}
extractSpectralBinAndBandnumber(false);
extractSpatialBinAndWidth(false);
char buffer[128];
FILE *fp;
@ -353,14 +359,18 @@ static void *DjiTest_WidgetTask(void *arg)
if (spectralBinInt!=0 && framerate!=0)
{
double frameSize;
if (spectralBinInt==1)
if (spectralBinInt + spatialBinInt==2)
{
frameSize = 0.783;
}
else
else if(spectralBinInt + spatialBinInt==3)
{
frameSize = 0.783/2;
}
else if(spectralBinInt + spatialBinInt==4)
{
frameSize = 0.783/4;
}
double minTemp = availableMB / (frameSize * framerate * 60);
@ -376,8 +386,6 @@ static void *DjiTest_WidgetTask(void *arg)
// 关闭文件指针
pclose(fp);
extractSpectralBinAndBandnumber(false);
//判断ximeaAirborneSystem系统是否存活
// if(ximeaAirborneSystemSurvivalTime > 10)
@ -941,14 +949,17 @@ static T_DjiReturnCode PsdkTestWidget_SetWidgetValue_StartRecord(E_DjiWidgetType
if (value==1)
{
system("sudo sed -i 's/spectralBin =.*/spectralBin = 1;/g' /media/nvme/300TC/config/ximea.cfg");
system("sudo sed -i 's/spatialBin =.*/spatialBin = 1;/g' /media/nvme/300TC/config/ximea.cfg");
}
else if (value==2)
{
system("sudo sed -i 's/spectralBin =.*/spectralBin = 2;/g' /media/nvme/300TC/config/ximea.cfg");
system("sudo sed -i 's/spatialBin =.*/spatialBin = 2;/g' /media/nvme/300TC/config/ximea.cfg");
}
closeXimeaRecordSystem();
extractSpectralBinAndBandnumber(true);
extractSpatialBinAndWidth(true);
strcpy(s_strUIMessage,"请等待采集系统重启!");
messageTimeCounter = 0;
@ -979,6 +990,7 @@ static void closeXimeaRecordSystem()
sprintf(XimeaExposeTime,"%s"," ");
sprintf(XimeaExposeMaxValue,"%s"," ");
sprintf(s_spectralBin,"%s"," ");
sprintf(s_spatialBin,"%s"," ");
s_remainingTime=" ";
s_widgetValueList[5] = 0;
@ -1043,4 +1055,57 @@ static void extractSpectralBinAndBandnumber(bool isModifyBin)
}
}
static void extractSpatialBinAndWidth(bool isModifyBin)
{
unsigned long long spatialBinBin, width;
char buffer[128];
FILE *fp;
fp = popen("grep \"spatialBin = \" /media/nvme/300TC/config/ximea.cfg | awk '{print $3}' | tr -d ';'", "r");
if (fp == NULL) {
perror("popen");
}
if (fgets(buffer, sizeof(buffer), fp) != NULL)
{
// printf("当前字符串-----: %s \n", buffer);
spatialBinBin = strtoull(buffer, NULL, 10);
}
pclose(fp);
if (spatialBinBin == 1)
{
fp = popen("grep \"width\" /media/nvme/300TC/config/ximea.cfg | head -n 1 | awk '{print $3}' | tr -d ';'", "r");
if (fp == NULL) {
perror("popen");
}
if (fgets(buffer, sizeof(buffer), fp) != NULL)
{
// printf("当前字符串-----: %s \n", buffer);
width = strtoull(buffer, NULL, 10);
}
pclose(fp);
}
else if(spatialBinBin == 2)
{
fp = popen("grep \"width\" /media/nvme/300TC/config/ximea.cfg | head -n 2 | tail -n 1 | awk '{print $3}' | tr -d ';'", "r");
if (fp == NULL) {
perror("popen");
}
if (fgets(buffer, sizeof(buffer), fp) != NULL)
{
// printf("当前字符串-----: %s \n", buffer);
width = strtoull(buffer, NULL, 10);
}
pclose(fp);
}
s_widgetValueList[11] = spatialBinBin;
spatialBinInt = spatialBinBin;
if (!isModifyBin)
{
sprintf(s_spatialBin,"%d_%d", spatialBinBin, width);
}
}
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/

View File

@ -77,10 +77,10 @@
"item_name": "其他"
},
{
"item_name": "光谱1"
"item_name": "1"
},
{
"item_name": "光谱2"
"item_name": "2"
}
]
}

View File

@ -77,10 +77,10 @@
"item_name": "其他"
},
{
"item_name": "光谱1"
"item_name": "1"
},
{
"item_name": "光谱2"
"item_name": "2"
}
]
}

View File

@ -137,7 +137,7 @@ int main(int argc, char **argv)
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
}
returnCode = DjiCore_SetAlias("300TC_3.37.43.21");
returnCode = DjiCore_SetAlias("300TC_3.38.43.21");
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("set alias error");
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;