更新到psdk 3.13.0,适配M400

This commit is contained in:
tangchao0503
2025-09-10 16:03:18 +08:00
517 changed files with 197499 additions and 7197653 deletions

View File

@ -171,6 +171,7 @@ T_DjiReturnCode DjiTest_WidgetStartService(void)
}
//set default ui config path
USER_LOG_INFO("widget file: %s", tempPath);
djiStat = DjiWidget_RegDefaultUiConfigByDirPath(tempPath);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("Add default widget ui config error, stat = 0x%08llX", djiStat);

View File

@ -62,7 +62,7 @@
#define WIDGET_SPEAKER_AUDIO_OPUS_DECODE_BITRATE_8KBPS (8000)
/* The speaker initialization parameters */
#define WIDGET_SPEAKER_DEFAULT_VOLUME (30)
#define WIDGET_SPEAKER_DEFAULT_VOLUME (60)
#define EKHO_INSTALLED (1)
/* Private types -------------------------------------------------------------*/
@ -71,10 +71,13 @@
static T_DjiWidgetSpeakerHandler s_speakerHandler = {0};
static T_DjiMutexHandle s_speakerMutex = {0};
static T_DjiWidgetSpeakerState s_speakerState = {0};
#ifdef SYSTEM_ARCH_LINUX
static T_DjiTaskHandle s_widgetSpeakerTestThread;
static FILE *s_ttsFile = NULL;
#endif
static FILE *s_audioFile = NULL;
static FILE *s_ttsFile = NULL;
static bool s_isDecodeFinished = true;
static uint16_t s_decodeBitrate = 0;
@ -321,8 +324,16 @@ static T_DjiReturnCode DjiTest_PlayTtsData(void)
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
}
if (aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M3E ||
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M3T) {
if (DJI_AIRCRAFT_TYPE_M3E == aircraftInfoBaseInfo.aircraftType || DJI_AIRCRAFT_TYPE_M3T == aircraftInfoBaseInfo.aircraftType
|| DJI_AIRCRAFT_TYPE_M3D == aircraftInfoBaseInfo.aircraftType || DJI_AIRCRAFT_TYPE_M3TD == aircraftInfoBaseInfo.aircraftType
|| DJI_AIRCRAFT_TYPE_M3TA == aircraftInfoBaseInfo.aircraftType
|| DJI_AIRCRAFT_TYPE_M4T == aircraftInfoBaseInfo.aircraftType
|| DJI_AIRCRAFT_TYPE_M4TD == aircraftInfoBaseInfo.aircraftType
|| DJI_AIRCRAFT_TYPE_M4D == aircraftInfoBaseInfo.aircraftType
|| DJI_AIRCRAFT_TYPE_M4E == aircraftInfoBaseInfo.aircraftType
|| DJI_AIRCRAFT_TYPE_M4TD == aircraftInfoBaseInfo.aircraftType
|| DJI_AIRCRAFT_TYPE_M4D == aircraftInfoBaseInfo.aircraftType
) {
return DjiTest_PlayAudioData();
} else {
txtFile = fopen(WIDGET_SPEAKER_TTS_FILE_NAME, "r");
@ -384,6 +395,7 @@ static T_DjiReturnCode DjiTest_CheckFileMd5Sum(const char *path, uint8_t *buf, u
file = fopen(path, "rb");
if (file == NULL) {
USER_LOG_ERROR("Open tts file error.");
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
}
while (1) {
@ -509,7 +521,9 @@ static T_DjiReturnCode SetPlayMode(E_DjiWidgetSpeakerPlayMode playMode)
static T_DjiReturnCode StartPlay(void)
{
#ifdef SYSTEM_ARCH_LINUX
uint32_t pid;
#endif
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
#ifdef SYSTEM_ARCH_LINUX
@ -530,7 +544,9 @@ static T_DjiReturnCode StopPlay(void)
{
T_DjiReturnCode returnCode;
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
#ifdef SYSTEM_ARCH_LINUX
uint32_t pid;
#endif
returnCode = osalHandler->MutexLock(s_speakerMutex);
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
@ -561,9 +577,11 @@ static T_DjiReturnCode SetVolume(uint8_t volume)
{
T_DjiReturnCode returnCode;
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
char cmdStr[128];
int32_t ret = 0;
#ifdef PLATFORM_ARCH_x86_64
float realVolume;
int32_t ret = 0;
char cmdStr[128];
#endif
returnCode = osalHandler->MutexLock(s_speakerMutex);
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
@ -571,7 +589,6 @@ static T_DjiReturnCode SetVolume(uint8_t volume)
return returnCode;
}
realVolume = 1.5f * (float) volume;
s_speakerState.volume = volume;
USER_LOG_INFO("Set widget speaker volume: %d", volume);
@ -581,11 +598,12 @@ static T_DjiReturnCode SetVolume(uint8_t volume)
ret = system(cmdStr);
if (ret == DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
memset(cmdStr, 0, sizeof(cmdStr));
realVolume = 1.5f * (float) volume;
snprintf(cmdStr, sizeof(cmdStr), "pactl set-sink-volume %s %d%%", WIDGET_SPEAKER_USB_AUDIO_DEVICE_NAME,
(int32_t) realVolume);
returnCode = DjiUserUtil_RunSystemCmd(cmdStr);
if (returnCode < 0) {
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("Set widget speaker volume error: %d", ret);
}
} else {
@ -607,8 +625,10 @@ static T_DjiReturnCode SetVolume(uint8_t volume)
static T_DjiReturnCode ReceiveTtsData(E_DjiWidgetTransmitDataEvent event,
uint32_t offset, uint8_t *buf, uint16_t size)
{
#ifdef SYSTEM_ARCH_LINUX
uint16_t writeLen;
T_DjiReturnCode returnCode;
#endif
if (event == DJI_WIDGET_TRANSMIT_DATA_EVENT_START) {
USER_LOG_INFO("Create tts file.");
@ -659,8 +679,11 @@ static T_DjiReturnCode ReceiveTtsData(E_DjiWidgetTransmitDataEvent event,
static T_DjiReturnCode ReceiveAudioData(E_DjiWidgetTransmitDataEvent event,
uint32_t offset, uint8_t *buf, uint16_t size)
{
#ifdef SYSTEM_ARCH_LINUX
uint16_t writeLen;
T_DjiReturnCode returnCode;
#endif
T_DjiWidgetTransDataContent transDataContent = {0};
if (event == DJI_WIDGET_TRANSMIT_DATA_EVENT_START) {

View File

@ -3,6 +3,470 @@
"major": 1,
"minor": 0
},
"ar_config": {
"circleStyleList": [
{
"face": {
"bottom": {
"backColor": -256,
"faceColor": -65536
},
"distAlpha": {
"maxAlpha": 0.4,
"maxDist": 100,
"minAlpha": 0,
"minDist": 50
},
"side": {
"backColor": -256,
"faceColor": -65536
},
"top": {
"backColor": -256,
"faceColor": -65536
}
},
"stroke": {
"bottom": {
"distAlpha": {
"maxAlpha": 0.6,
"maxDist": 100,
"minAlpha": 1,
"minDist": 50
},
"strokeInfo": {
"color": -65536,
"dash": true,
"width": {
"maxStrokeWidth": 20,
"maxWidthDist": 20,
"minStrokeWidth": 2.5,
"minWidthDist": 100
}
}
},
"side": {
"distAlpha": {
"maxAlpha": 0.6,
"maxDist": 100,
"minAlpha": 1,
"minDist": 50
},
"strokeInfo": {
"color": -65536,
"dash": true,
"width": {
"maxStrokeWidth": 20,
"maxWidthDist": 20,
"minStrokeWidth": 2.5,
"minWidthDist": 100
}
}
},
"top": {
"distAlpha": {
"maxAlpha": 0.6,
"maxDist": 100,
"minAlpha": 1,
"minDist": 50
},
"strokeInfo": {
"color": -65536,
"dash": true,
"width": {
"maxStrokeWidth": 20,
"maxWidthDist": 20,
"minStrokeWidth": 2.5,
"minWidthDist": 100
}
}
}
},
"styleId": 10
},
{
"face": {
"bottom": {
"backColor": -256,
"faceColor": -65536
},
"distAlpha": {
"maxAlpha": 0.4,
"maxDist": 100,
"minAlpha": 0,
"minDist": 50
},
"side": {
"backColor": -256,
"faceColor": -65536
},
"top": {
"backColor": -256,
"faceColor": -65536
}
},
"stroke": {
"bottom": {
"distAlpha": {
"maxAlpha": 0.6,
"maxDist": 100,
"minAlpha": 1,
"minDist": 50
},
"strokeInfo": {
"color": -65536,
"dash": true,
"width": {
"maxStrokeWidth": 20,
"maxWidthDist": 20,
"minStrokeWidth": 2.5,
"minWidthDist": 100
}
}
},
"side": {
"distAlpha": {
"maxAlpha": 0.6,
"maxDist": 100,
"minAlpha": 1,
"minDist": 50
},
"strokeInfo": {
"color": -65536,
"dash": true,
"width": {
"maxStrokeWidth": 20,
"maxWidthDist": 20,
"minStrokeWidth": 2.5,
"minWidthDist": 100
}
}
},
"top": {
"distAlpha": {
"maxAlpha": 0.6,
"maxDist": 100,
"minAlpha": 1,
"minDist": 50
},
"strokeInfo": {
"color": -65536,
"dash": true,
"width": {
"maxStrokeWidth": 20,
"maxWidthDist": 20,
"minStrokeWidth": 2.5,
"minWidthDist": 100
}
}
}
},
"styleId": 11
}
],
"commonPointStyleList": [
{
"alwaysInEdge": false,
"arTextAttribute": {
"color": -65536
},
"isIgnoreBorder": true,
"styleId": 10
},
{
"alwaysInEdge": false,
"arTextAttribute": {
"color": -65536
},
"isIgnoreBorder": true,
"styleId": 11
}
],
"lineStyleList": [
{
"color": -256,
"stokeInfo": {
"color": -65536,
"dash": false,
"width": {
"maxStrokeWidth": 2,
"maxWidthDist": 2,
"minStrokeWidth": 2,
"minWidthDist": 2
}
},
"styleId": 10,
"useDepth": false
},
{
"color": -256,
"stokeInfo": {
"color": -65536,
"dash": false,
"width": {
"maxStrokeWidth": 2,
"maxWidthDist": 2,
"minStrokeWidth": 2,
"minWidthDist": 2
}
},
"styleId": 11,
"useDepth": false
}
],
"pointStyleList": [
{
"keyName": 0,
"pointConfig": {
"arrowConfig": {
"customIcon": false,
"defaultDeg": 0,
"img": "",
"imgHeight": 0,
"imgWidth": 0,
"showMode": 0,
"translate": 0,
"type": 0
},
"needFont": true,
"needOrthographic": true,
"needPerspective": false,
"oConfig": {
"displayHeight": 20.0,
"displayWidth": 20.0,
"img": "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" fill=\"none\"\n version=\"1.1\" width=\"8\" height=\"8\" viewBox=\"0 0 8 8\">\n <g>\n <ellipse id=\"point_normal_bg\"\n cx=\"4\" cy=\"4\" rx=\"2\" ry=\"2\"\n fill=\"#FFFFFF\" fill-opacity=\"1\" />\n </g>\n\n</svg>",
"imgHeight": 20.0,
"imgWidth": 20.0
},
"pConfig": {
"maxSVG": "",
"maxSize": 0,
"minSVG": "",
"minSize": 0,
"realSize": 0,
"strokeWidthRadio": 0
},
"textConfig": {
"backgroundColor": 1427379220,
"cornerRadius": 5,
"paddingB": 5,
"paddingL": 10,
"paddingR": 10,
"paddingT": 5,
"shadow": false,
"textGravity": 1,
"textSize": 20
}
}
},
{
"keyName": 1,
"pointConfig": {
"arrowConfig": {
"customIcon": false,
"defaultDeg": 0,
"img": "",
"imgHeight": 0,
"imgWidth": 0,
"showMode": 0,
"translate": 0,
"type": 0
},
"needFont": true,
"needOrthographic": true,
"needPerspective": false,
"oConfig": {
"displayHeight": 20.0,
"displayWidth": 20.0,
"img": "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" fill=\"none\"\n version=\"1.1\" width=\"8\" height=\"8\" viewBox=\"0 0 8 8\">\n <g>\n <ellipse id=\"point_normal_bg\"\n cx=\"4\" cy=\"4\" rx=\"2\" ry=\"2\"\n fill=\"#FFFFFF\" fill-opacity=\"1\" />\n </g>\n\n</svg>",
"imgHeight": 20.0,
"imgWidth": 20.0
},
"pConfig": {
"maxSVG": "",
"maxSize": 0,
"minSVG": "",
"minSize": 0,
"realSize": 0,
"strokeWidthRadio": 0
},
"textConfig": {
"backgroundColor": 1427379220,
"cornerRadius": 5,
"paddingB": 5,
"paddingL": 10,
"paddingR": 10,
"paddingT": 5,
"shadow": false,
"textGravity": 1,
"textSize": 20
}
}
}
],
"polygonStyleList": [
{
"face": {
"bottom": {
"backColor": -256,
"faceColor": -65536
},
"distAlpha": {
"maxAlpha": 0.4,
"maxDist": 100,
"minAlpha": 0,
"minDist": 50
},
"side": {
"backColor": -256,
"faceColor": -65536
},
"top": {
"backColor": -256,
"faceColor": -65536
}
},
"is3DMesh": false,
"stroke": {
"bottom": {
"distAlpha": {
"maxAlpha": 0.6,
"maxDist": 100,
"minAlpha": 1,
"minDist": 50
},
"strokeInfo": {
"color": -65536,
"dash": true,
"width": {
"maxStrokeWidth": 20,
"maxWidthDist": 20,
"minStrokeWidth": 2.5,
"minWidthDist": 100
}
}
},
"side": {
"distAlpha": {
"maxAlpha": 0.6,
"maxDist": 100,
"minAlpha": 1,
"minDist": 50
},
"strokeInfo": {
"color": -65536,
"dash": true,
"width": {
"maxStrokeWidth": 20,
"maxWidthDist": 20,
"minStrokeWidth": 2.5,
"minWidthDist": 100
}
}
},
"top": {
"distAlpha": {
"maxAlpha": 0.6,
"maxDist": 100,
"minAlpha": 1,
"minDist": 50
},
"strokeInfo": {
"color": -65536,
"dash": true,
"width": {
"maxStrokeWidth": 20,
"maxWidthDist": 20,
"minStrokeWidth": 2.5,
"minWidthDist": 100
}
}
}
},
"styleId": 10
},
{
"face": {
"bottom": {
"backColor": -256,
"faceColor": -65536
},
"distAlpha": {
"maxAlpha": 0.4,
"maxDist": 100,
"minAlpha": 0,
"minDist": 50
},
"side": {
"backColor": -256,
"faceColor": -65536
},
"top": {
"backColor": -256,
"faceColor": -65536
}
},
"is3DMesh": false,
"stroke": {
"bottom": {
"distAlpha": {
"maxAlpha": 0.6,
"maxDist": 100,
"minAlpha": 1,
"minDist": 50
},
"strokeInfo": {
"color": -65536,
"dash": true,
"width": {
"maxStrokeWidth": 20,
"maxWidthDist": 20,
"minStrokeWidth": 2.5,
"minWidthDist": 100
}
}
},
"side": {
"distAlpha": {
"maxAlpha": 0.6,
"maxDist": 100,
"minAlpha": 1,
"minDist": 50
},
"strokeInfo": {
"color": -65536,
"dash": true,
"width": {
"maxStrokeWidth": 20,
"maxWidthDist": 20,
"minStrokeWidth": 2.5,
"minWidthDist": 100
}
}
},
"top": {
"distAlpha": {
"maxAlpha": 0.6,
"maxDist": 100,
"minAlpha": 1,
"minDist": 50
},
"strokeInfo": {
"color": -65536,
"dash": true,
"width": {
"maxStrokeWidth": 20,
"maxWidthDist": 20,
"minStrokeWidth": 2.5,
"minWidthDist": 100
}
}
}
},
"styleId": 11
}
]
},
"main_interface": {
"floating_window": {
"is_enable": true