diff --git a/code/application/source/sf_app/code/source/battery/sf_battery.c b/code/application/source/sf_app/code/source/battery/sf_battery.c index 0a4acdc2f..8c34a5930 100755 --- a/code/application/source/sf_app/code/source/battery/sf_battery.c +++ b/code/application/source/sf_app/code/source/battery/sf_battery.c @@ -1508,11 +1508,15 @@ BOOL sf_is_battery_low(UINT8 refresh, UINT8 nightMode) { UINT8 batteryVal = 0; UINT8 batteryLevel = 0; + int cnt = 100; UINT8 PowerOnMode = sf_poweron_type_get(); if((refresh) && (PowerOnMode != PWR_ON_SETUP)) { - - sf_battery_value_fast_get(); + sf_battery_value_fast_get(); + while((sf_battery_level_get() == SF_BATT_LEVEL_TOTAL) && (cnt--)) + { + vos_util_delay_ms(10); + } //printf("DC=%d Custom=%d bat=%d\n", dcValue, CustomValue, batli8v); } @@ -1593,8 +1597,13 @@ void sf_set_need_check_first(void) *************************************************/ BOOL sf_is_enough_power_to_update(void) { + int cnt = 100; //sf_set_need_check_first(); sf_battery_value_fast_get(); + while((sf_battery_level_get() == SF_BATT_LEVEL_TOTAL) && (cnt--)) + { + vos_util_delay_ms(10); + } printf("update DC=%d Li=%d Bat=%d\n", DcVoltageVal, LiPolymerVoltageVal, BatVoltageVal); if(sf_battery_value_get(0) < 40)