1.优化cardv和sf app获取mcu信息
This commit is contained in:
parent
24e2391975
commit
42693f9133
|
@ -64,6 +64,7 @@ SINT32 sf_app_mcu_para_start(void);
|
|||
SINT32 app_auto_poweroff_start(void);
|
||||
UINT8 sf_check_power_on_mode(void);
|
||||
void sf_power_off_msg_to_cardv(void);
|
||||
SINT32 sf_app_mcu_para_power_no_start(void);
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
|
|
@ -769,31 +769,11 @@ static SINT32 sf_app_proccess_cmd_poweroff(SF_MESSAGE_BUF_S *pMessageBuf)
|
|||
static SINT32 sf_app_proccess_cmd_mcu(SF_MESSAGE_BUF_S *pMessageBuf)
|
||||
{
|
||||
MLOGD("ID = %#x\n",pMessageBuf->arg1);
|
||||
SF_MESSAGE_BUF_S stMessageBuf = {0};
|
||||
SINT16 startup = 0;
|
||||
|
||||
switch(pMessageBuf->arg1)
|
||||
{
|
||||
case SF_MCU_CMD_POWERON:
|
||||
startup = sf_poweron_type_get();
|
||||
if(SF_MCU_STARTUP_NORMAL != startup){
|
||||
sf_get_power_on_mode();
|
||||
stMessageBuf.arg3 = (SINT32)sf_get_light_value();
|
||||
}
|
||||
|
||||
stMessageBuf.arg1 = SF_MCU_CMD_POWERON;
|
||||
stMessageBuf.arg2 = (SINT32)sf_poweron_type_get();
|
||||
stMessageBuf.cmdId = CMD_MCU;
|
||||
sf_com_message_send_to_cardv(&stMessageBuf);
|
||||
|
||||
stMessageBuf.arg1 = SF_MCU_CMD_MCU_VER;
|
||||
stMessageBuf.arg2 = (SINT32)sf_get_mcu_sub_ver();
|
||||
stMessageBuf.arg3 = (SINT32)sf_get_mcu_ver();
|
||||
stMessageBuf.cmdId = CMD_MCU;
|
||||
sf_com_message_send_to_cardv(&stMessageBuf);
|
||||
// if(SF_MCU_STARTUP_ONKEY == startup){
|
||||
// sf_blue_app_start();
|
||||
// }
|
||||
sf_app_mcu_para_power_no_start();
|
||||
break;
|
||||
case SF_MCU_CMD_MODULE_SLEEP:
|
||||
sf_set_module_sleep_flag(0);
|
||||
|
|
|
@ -128,8 +128,17 @@ SF_THREAD_S WaiParaTskCfg =
|
|||
.IsRun = 0,
|
||||
.TskId = -1,
|
||||
};
|
||||
|
||||
SF_THREAD_S McuPowerOnTskCfg =
|
||||
{
|
||||
.IsRun = 0,
|
||||
.TskId = -1,
|
||||
};
|
||||
|
||||
SINT8 debugFlag = 0;
|
||||
|
||||
UINT8 McuInitFlag = 0;
|
||||
|
||||
void app_poweroff_time_clear(void)
|
||||
{
|
||||
AutoPowerOffTime = 0;
|
||||
|
@ -1434,7 +1443,7 @@ void* sf_app_mcu_para_thread(void *arg)
|
|||
sf_get_power_on_mode();
|
||||
sf_mcu_wdg_set(5);
|
||||
}
|
||||
|
||||
McuInitFlag = 1;
|
||||
McuParaTskCfg.IsRun = 0;
|
||||
SLOGI("thread end\n");
|
||||
|
||||
|
@ -1492,4 +1501,66 @@ 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);
|
||||
}
|
||||
|
||||
UINT8 sf_app_get_mcu_init_flag(void)
|
||||
{
|
||||
return McuInitFlag;
|
||||
}
|
||||
void* sf_app_power_no_thread(void *arg)
|
||||
{
|
||||
SF_MESSAGE_BUF_S stMessageBuf = {0};
|
||||
SINT16 startup = 0;
|
||||
SLOGI("thread run\n");
|
||||
McuPowerOnTskCfg.IsRun = 1;
|
||||
startup = sf_poweron_type_get();
|
||||
if(SF_MCU_STARTUP_NORMAL != startup){
|
||||
for (UINT8 i = 0; i < 40; i++) {
|
||||
if (1 == sf_app_get_mcu_init_flag())
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
sf_sleep_ms(100);
|
||||
}
|
||||
}
|
||||
sf_get_power_on_mode();
|
||||
stMessageBuf.arg3 = (SINT32)sf_get_light_value();
|
||||
}
|
||||
|
||||
stMessageBuf.arg1 = SF_MCU_CMD_POWERON;
|
||||
stMessageBuf.arg2 = (SINT32)sf_poweron_type_get();
|
||||
stMessageBuf.cmdId = CMD_MCU;
|
||||
sf_com_message_send_to_cardv(&stMessageBuf);
|
||||
|
||||
stMessageBuf.arg1 = SF_MCU_CMD_MCU_VER;
|
||||
stMessageBuf.arg2 = (SINT32)sf_get_mcu_sub_ver();
|
||||
stMessageBuf.arg3 = (SINT32)sf_get_mcu_ver();
|
||||
stMessageBuf.cmdId = CMD_MCU;
|
||||
sf_com_message_send_to_cardv(&stMessageBuf);
|
||||
// if(SF_MCU_STARTUP_ONKEY == startup){
|
||||
// sf_blue_app_start();
|
||||
// }
|
||||
McuPowerOnTskCfg.IsRun = 0;
|
||||
SLOGI("thread end\n");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
SINT32 sf_app_mcu_para_power_no_start(void)
|
||||
{
|
||||
SINT32 ret = SF_FAILURE;
|
||||
if(McuPowerOnTskCfg.IsRun)
|
||||
{
|
||||
SLOGE("thread has already run !!!\n");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
ret = pthread_create(&McuPowerOnTskCfg.TskId, NULL, sf_app_power_no_thread, NULL);
|
||||
if(ret != SF_SUCCESS)
|
||||
{
|
||||
MLOGD("thread creat fail!\n");
|
||||
return ret;
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
|
||||
}
|
|
@ -136,7 +136,12 @@ static ID sf_mcu_flag_id = 0;
|
|||
|
||||
void sf_mcu_flag_init(void)
|
||||
{
|
||||
vos_flag_create(&sf_mcu_flag_id, NULL, "sf_mcu_flag_id");
|
||||
ER ret = E_OK;
|
||||
T_CFLG cflg;
|
||||
if ((ret |= vos_flag_create(&sf_mcu_flag_id, &cflg, "sf_mcu_flag_id")) != E_OK)
|
||||
{
|
||||
SYS_SLOGE("sf_mcu_flag_id fail\r\n");
|
||||
}
|
||||
vos_flag_clr(sf_mcu_flag_id, (FLGPTN)-1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user