更新到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

@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.5)
project(dji_300tc C)
set(CMAKE_C_FLAGS "-pthread -std=gnu99")
set(CMAKE_CXX_FLAGS "-std=c++11 -pthread")
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
set(CMAKE_C_COMPILER "gcc")
set(CMAKE_CXX_COMPILER "g++")
@ -11,10 +12,11 @@ if (NOT USE_SYSTEM_ARCH)
add_definitions(-DSYSTEM_ARCH_LINUX)
endif ()
set(COMMON_CXX_FLAGS "-std=c++11 -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
if (BUILD_TEST_CASES_ON MATCHES TRUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
endif ()
set(PACKAGE_NAME payloadsdk)
@ -39,6 +41,7 @@ file(GLOB_RECURSE MODULE_SAMPLE_SRC ../../../module_sample/*.c)
include_directories(../../../module_sample)
include_directories(../common)
#include_directories(application)#psdk3.13.0新拉去的结果
include_directories(../manifold2/application)
include_directories(/home/300tc/library/ffmpeg_build/include)
@ -98,6 +101,7 @@ target_link_libraries(${PROJECT_NAME}
rt
crypt
wiringPi
dl
)
add_custom_command(TARGET ${PROJECT_NAME}

View File

@ -64,7 +64,7 @@ extern "C" {
#define CONFIG_MODULE_SAMPLE_FC_SUBSCRIPTION_ON
#define CONFIG_MODULE_SAMPLE_HMS_ON
#define CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
/*!< Attention: This function needs to be used together with mobile sdk mop sample.
* */

View File

@ -97,6 +97,7 @@ int main(int argc, char **argv)
T_DjiReturnCode returnCode;
T_DjiUserInfo userInfo;
T_DjiAircraftInfoBaseInfo aircraftInfoBaseInfo;
T_DjiAircraftVersion aircraftInfoVersion;
T_DjiFirmwareVersion firmwareVersion = {
.majorVersion = 1,
.minorVersion = 0,
@ -137,7 +138,18 @@ int main(int argc, char **argv)
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
}
returnCode = DjiCore_SetAlias("300TC_3.38.44.21");
if (aircraftInfoBaseInfo.mountPositionType != DJI_MOUNT_POSITION_TYPE_PAYLOAD_PORT) {
returnCode = DjiAircraftInfo_GetAircraftVersion(&aircraftInfoVersion);
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("get aircraft version info error");
} else {
USER_LOG_INFO("Aircraft version is V%02d.%02d.%02d.%02d", aircraftInfoVersion.majorVersion,
aircraftInfoVersion.minorVersion, aircraftInfoVersion.modifyVersion,
aircraftInfoVersion.debugVersion);
}
}
returnCode = DjiCore_SetAlias("300TC_313.38.44.21");
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("set alias error");
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
@ -193,6 +205,30 @@ int main(int argc, char **argv)
USER_LOG_ERROR("widget speaker test init error");
}
#ifdef CONFIG_MODULE_SAMPLE_UPGRADE_ON
T_DjiTestUpgradePlatformOpt linuxUpgradePlatformOpt = {
.rebootSystem = DjiUpgradePlatformLinux_RebootSystem,
.cleanUpgradeProgramFileStoreArea = DjiUpgradePlatformLinux_CleanUpgradeProgramFileStoreArea,
.createUpgradeProgramFile = DjiUpgradePlatformLinux_CreateUpgradeProgramFile,
.writeUpgradeProgramFile = DjiUpgradePlatformLinux_WriteUpgradeProgramFile,
.readUpgradeProgramFile = DjiUpgradePlatformLinux_ReadUpgradeProgramFile,
.closeUpgradeProgramFile = DjiUpgradePlatformLinux_CloseUpgradeProgramFile,
.replaceOldProgram = DjiUpgradePlatformLinux_ReplaceOldProgram,
.setUpgradeRebootState = DjiUpgradePlatformLinux_SetUpgradeRebootState,
.getUpgradeRebootState = DjiUpgradePlatformLinux_GetUpgradeRebootState,
.cleanUpgradeRebootState = DjiUpgradePlatformLinux_CleanUpgradeRebootState,
};
T_DjiTestUpgradeConfig testUpgradeConfig = {
.firmwareVersion = firmwareVersion,
.transferType = DJI_FIRMWARE_TRANSFER_TYPE_DCFTP,
.needReplaceProgramBeforeReboot = true
};
if (DjiTest_UpgradeStartService(&linuxUpgradePlatformOpt, testUpgradeConfig) !=
DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("psdk upgrade init error");
}
#endif
#ifdef CONFIG_MODULE_SAMPLE_MOP_CHANNEL_ON
returnCode = DjiTest_MopChannelStartService();
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
@ -290,7 +326,7 @@ int main(int argc, char **argv)
.cleanUpgradeRebootState = DjiUpgradePlatformLinux_CleanUpgradeRebootState,
};
T_DjiTestUpgradeConfig testUpgradeConfig = {
.firmwareVersion = {1, 0, 0, 0},
.firmwareVersion = firmwareVersion,
.transferType = DJI_FIRMWARE_TRANSFER_TYPE_DCFTP,
.needReplaceProgramBeforeReboot = true
};
@ -301,8 +337,8 @@ int main(int argc, char **argv)
#endif
}
#ifdef CONFIG_MODULE_SAMPLE_HMS_ON
returnCode = DjiTest_HmsStartService();
#ifdef CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
returnCode = DjiTest_HmsCustomizationStartService();
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("hms test init error");
}
@ -663,6 +699,8 @@ static T_DjiReturnCode DjiUser_LocalWriteFsInit(const char *path)
}
}
sprintf(systemCmd, "ln -sfrv %s " DJI_LOG_FOLDER_NAME "/latest.log", filePath);
system(systemCmd);
return djiReturnCode;
}

View File

@ -88,7 +88,7 @@ T_DjiReturnCode HalUart_Init(E_DjiHalUartNum uartNum, uint32_t baudRate, T_DjiUa
sprintf(systemCmd, "chmod 777 %s", uartName);
fp = popen(systemCmd, "r");
if (fp == NULL) {
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
goto free_uart_handle;
}
#endif