1.rtos下电量信息传递优化

This commit is contained in:
payton 2024-02-01 13:43:43 +08:00
parent db2e10dfb8
commit e145177625
3 changed files with 29 additions and 2 deletions

View File

@ -855,7 +855,7 @@ static int make_bootargs(LINUXTMP_PARTITION *p_linuxtmp, unsigned int bootts_beg
// } // }
// } // }
snprintf(PowerOnModeStr, sizeof(PowerOnModeStr), "Mode=%d UpFw=%d mcu=%d sf=%d",sf_get_power_on_mode(), sf_in_update() , sf_in_mcu_update(), sf_battery_level_get()); snprintf(PowerOnModeStr, sizeof(PowerOnModeStr), "Mode=%d UpFw=%d mcu=%d sf=%d",sf_get_power_on_mode(), sf_in_update() , sf_in_mcu_update(), sf_get_battery_level());
linuxboot_set_extra_bootarg(PowerOnModeStr); linuxboot_set_extra_bootarg(PowerOnModeStr);
#endif #endif
p_linuxtmp->bootargs_addr = p_linuxtmp->tmp_curr; p_linuxtmp->bootargs_addr = p_linuxtmp->tmp_curr;

View File

@ -28,7 +28,7 @@ UINT32 sf_battery_level_get(void);
void sf_view_osd_battery_draw(UINT8 bShow); void sf_view_osd_battery_draw(UINT8 bShow);
UINT8 sf_battery_value_get(UINT8 nightMode); UINT8 sf_battery_value_get(UINT8 nightMode);
UINT8 sf_battery_type_get(void); UINT8 sf_battery_type_get(void);
UINT32 sf_get_battery_level(void);
BOOL sf_battery_check_init(void); BOOL sf_battery_check_init(void);
void sf_set_need_check_first(void); void sf_set_need_check_first(void);
BOOL sf_is_enough_power_to_update(void); BOOL sf_is_enough_power_to_update(void);

View File

@ -977,6 +977,33 @@ void sf_set_night_led_flag(UINT8 flag)
IsNightLedOn = flag; IsNightLedOn = flag;
} }
/*************************************************
Function: sf_battery_type_get
Description: Get battery type.
Input: N/A
Output: N/A
Return: value: battery type, 0:normal 1:LiPolymer
Others: N/A
*************************************************/
UINT16 sf_battery_val_get(void)
{
if(IsPowerDcIn)
return (UINT16)DcVoltageVal;
else if(LiPolymerVoltageVal)
return (UINT16)LiPolymerVoltageVal;
else if(BatVoltageVal)
return (UINT16)BatVoltageVal;
else
return 0;
}
UINT32 sf_get_battery_level(void)
{
UINT32 tmp = ((UINT32) (sf_battery_value_get(sf_get_night_led_flag()) << 18) | (((sf_battery_type_get()) << 16) | (sf_battery_val_get())));
// printf("[%s:%d] tmp:%ld\n", __FUNCTION__, __LINE__, tmp);
return tmp;
}
/************************************************* /*************************************************
Function: sf_battery_level_get Function: sf_battery_level_get
Description: get battery level Description: get battery level