1.增加cardv关机超时错误时sfapp关机

This commit is contained in:
payton 2023-12-15 15:47:44 +08:00
parent 80a26e8088
commit 13f633bf6c

View File

@ -141,7 +141,11 @@ SF_THREAD_S McuUpDataTskCfg =
.IsRun = 0,
.TskId = -1,
};
SF_THREAD_S PowerOffTskCfg =
{
.IsRun = 0,
.TskId = -1,
};
SINT8 debugFlag = 0;
UINT8 McuInitFlag = 0;
@ -1499,7 +1503,36 @@ SINT32 sf_app_mcu_para_stop(void)
}
return SF_SUCCESS;
}
void* sf_app_power_off_thread(void *arg)
{
SLOGI("thread run\n");
PowerOffTskCfg.IsRun = 1;
sleep(5);
SLOGE("cdv power off err\n");
app_system_poweroff(0);
PowerOffTskCfg.IsRun = 0;
SLOGI("thread end\n");
return NULL;
}
SINT32 sf_app_power_off_start(void)
{
SINT32 ret = SF_FAILURE;
if(PowerOffTskCfg.IsRun)
{
SLOGE("thread has already run !!!\n");
return SF_FAILURE;
}
ret = pthread_create(&PowerOffTskCfg.TskId, NULL, sf_app_power_off_thread, NULL);
if(ret != SF_SUCCESS)
{
MLOGD("thread creat fail!\n");
return ret;
}
return SF_SUCCESS;
}
/*************************************************
Function: sf_power_off_msg_to_cardv
Description: power off
@ -1516,6 +1549,7 @@ void sf_power_off_msg_to_cardv(void)
stMessageBuf.arg1 = SF_EVENT_KEY_SHORT_CLICK;
stMessageBuf.arg2 = SF_KEY_PIN_AOTU_MODE_POWOFF;//auto mode powoff
sf_com_message_send_to_cardv(&stMessageBuf);
sf_app_power_off_start();
}
UINT8 sf_app_get_mcu_init_flag(void)