diff --git a/rtos/code/driver/na51089/source/mcu/sf_battery.c b/rtos/code/driver/na51089/source/mcu/sf_battery.c index 5aee5cb0f..5308ba129 100755 --- a/rtos/code/driver/na51089/source/mcu/sf_battery.c +++ b/rtos/code/driver/na51089/source/mcu/sf_battery.c @@ -931,30 +931,35 @@ THREAD_RETTYPE sf_battery_check_thread(void *arg) { THREAD_ENTRY(); printf("[%s:%d] s\n", __FUNCTION__, __LINE__); - - if(sf_is_battery_low(1, 0) == TRUE) - { - printf("[%s:%d]power off because low battery\n", __FUNCTION__, __LINE__); - //Ux_PostEvent(NVTEVT_SYSTEM_SHUTDOWN, 1, APP_POWER_OFF_BATT_EMPTY); //shutdown start - #if (SF_IQ_TEST != ENABLE) && (SF_BATTERY_TEST != ENABLE) - sf_set_power_off_flag(APP_POWER_OFF_BATT_EMPTY); - flow_preview_set_stop_flag(TRUE); - #endif - while(1) - { - vos_util_delay_ms(1000); - printf("[%s:%d] cnt power off because low battery\n", __FUNCTION__, __LINE__); - } + if(sf_is_usb_flag()){ + printf("[%s:%d]usb power\n", __FUNCTION__, __LINE__); + THREAD_RETURN(0); } else { - - while(sf_while_flag()) + if(sf_is_battery_low(1, 0) == TRUE) { - sf_battery_level_polling(); + printf("[%s:%d]power off because low battery\n", __FUNCTION__, __LINE__); + //Ux_PostEvent(NVTEVT_SYSTEM_SHUTDOWN, 1, APP_POWER_OFF_BATT_EMPTY); //shutdown start + #if (SF_IQ_TEST != ENABLE) && (SF_BATTERY_TEST != ENABLE) + sf_set_power_off_flag(APP_POWER_OFF_BATT_EMPTY); + flow_preview_set_stop_flag(TRUE); + #endif + while(1) + { + vos_util_delay_ms(1000); + printf("[%s:%d] cnt power off because low battery\n", __FUNCTION__, __LINE__); + } } + else { + + while(sf_while_flag()) + { + sf_battery_level_polling(); + } + } + printf("[%s:%d] e \n", __FUNCTION__, __LINE__); + THREAD_RETURN(0); } - printf("[%s:%d] e \n", __FUNCTION__, __LINE__); - THREAD_RETURN(0); } @@ -971,7 +976,7 @@ void sf_battery_thread_init(void) vos_flag_create(&FLG_ID_SF_BSTTERY, NULL, "FLG_ID_SF_BSTTERY"); /*thread creat*/ - s_handle_batt = vos_task_create(sf_battery_check_thread, NULL, "sf_battery_check_thread", 18, 2048); + s_handle_batt = vos_task_create(sf_battery_check_thread, NULL, "sf_battery_check_thread", 18, 4096); vos_task_resume(s_handle_batt); printf("[%s:%d] e\n", __FUNCTION__, __LINE__); }