1.修改mcu升级问题

This commit is contained in:
payton 2024-01-08 17:30:03 +08:00
parent 9f64fc75d1
commit b1a479f8e1
2 changed files with 30 additions and 8 deletions

View File

@ -1640,9 +1640,21 @@ void* sf_app_mcu_updata_thread(void *arg)
MLOGI("MCU_UPGRADE\n");
UINT32 McuFsize = 0;
SINT8 ret = 0;
int sdflag = 0;
int emmcflag = 0;
char file_path[64] = {0};
if((access("/mnt/sd/Mupgrade.bin", F_OK) == 0))
{
sdflag = 1;
snprintf(file_path, sizeof(file_path), "/mnt/sd/Mupgrade.bin");
char *file_path = sf_root_path_strcat(UPGRADE_FIRMWARE_NANE);
if(file_path == NULL)
}
if((access("/mnt/sd2/Mupgrade.bin", F_OK) == 0))
{
emmcflag = 1;
snprintf(file_path, sizeof(file_path), "/mnt/sd2/Mupgrade.bin");
}
if(emmcflag == 0 && sdflag == 0)
{
MLOGI(" sf_power_off_msg_to_cardv\n");
MLOGE("MCU_UPGRADE no file\n");
@ -1651,8 +1663,7 @@ void* sf_app_mcu_updata_thread(void *arg)
return NULL;
}
ret = Fw_GetFirmwareSize(file_path, &McuFsize);
if((sf_in_card_exist() == SF_TRUE) && (access(file_path, F_OK) == 0)
&& (ret == 0) && (McuFsize > 1024) && (sf_is_enough_power_to_update() == SF_TRUE))
if((ret == 0) && (McuFsize > 1024) && (sf_is_enough_power_to_update() == SF_TRUE))
{
sf_set_mcu_update_flag(SF_TRUE);
Fw_UpgradeThreadStart();

View File

@ -28,6 +28,7 @@
#include <sys/stat.h>
#include "sf_common.h"
#include "sf_log.h"
#include "sf_mcu_upgrade.h"
#include "sf_param_common.h"
#include "sf_ledmng.h"
@ -340,11 +341,21 @@ static void * FwUpgradeTask(void * argv)
SINT8 param[1] = {0};
param[0] = 0;
char *file_path = sf_root_path_strcat(UPGRADE_FIRMWARE_NANE);
if(file_path == NULL)
//char *file_path = sf_root_path_strcat(UPGRADE_FIRMWARE_NANE);
char file_path[64] = {0};
memset(file_path, '\0', sizeof(file_path));
if((access("/mnt/sd/Mupgrade.bin", F_OK) == 0))
{
snprintf(file_path, sizeof(file_path), "/mnt/sd/Mupgrade.bin");
}
if((access("/mnt/sd2/Mupgrade.bin", F_OK) == 0))
{
snprintf(file_path, sizeof(file_path), "/mnt/sd2/Mupgrade.bin");
}
if(file_path[0] == '\0')
{
free(file_path);
return;
MLOGE("no update file\n");
return NULL;
}
while(FwUpgradeExit == 0)