1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-08 11:31:44 +00:00

hekate: reinstate charger enable

Add back charger enable on boot, inside low battery check.

It will be kept as is since there's the following case that addresses:
OTG mode and shut off will not restore charger mode.
This commit is contained in:
CTCaer 2024-07-02 18:32:16 +03:00
parent 0aea402632
commit 6c601ccaa5

View file

@ -138,8 +138,7 @@ bool is_ipl_updated(void *buf, char *path, bool force)
{ {
FIL fp; FIL fp;
reloc_meta_t *reloc = (reloc_meta_t *)(IPL_LOAD_ADDR + RELOC_META_OFF); reloc_meta_t *reloc = (reloc_meta_t *)(IPL_LOAD_ADDR + RELOC_META_OFF);
boot_cfg_t *tmp_cfg = malloc(sizeof(boot_cfg_t)); boot_cfg_t *tmp_cfg = zalloc(sizeof(boot_cfg_t));
memset(tmp_cfg, 0, sizeof(boot_cfg_t));
f_open(&fp, path, FA_WRITE | FA_CREATE_ALWAYS); f_open(&fp, path, FA_WRITE | FA_CREATE_ALWAYS);
f_write(&fp, (u8 *)reloc->start, reloc->end - reloc->start, NULL); f_write(&fp, (u8 *)reloc->start, reloc->end - reloc->start, NULL);
@ -1139,7 +1138,7 @@ static void _show_errors()
if (h_cfg.errors & ERR_L4T_KERNEL) if (h_cfg.errors & ERR_L4T_KERNEL)
{ {
WPRINTF("Kernel panic occurred!\n"); WPRINTF("L4T Kernel panic occurred!\n");
if (!(h_cfg.errors & ERR_SD_BOOT_EN)) if (!(h_cfg.errors & ERR_SD_BOOT_EN))
{ {
if (!sd_save_to_file((void *)PSTORE_ADDR, PSTORE_SZ, "L4T_panic.bin")) if (!sd_save_to_file((void *)PSTORE_ADDR, PSTORE_SZ, "L4T_panic.bin"))
@ -1186,6 +1185,9 @@ static void _check_low_battery()
int batt_volt = 0; int batt_volt = 0;
int charge_status = 0; int charge_status = 0;
// Enable charger in case it's disabled.
bq24193_enable_charger();
bq24193_get_property(BQ24193_ChargeStatus, &charge_status); bq24193_get_property(BQ24193_ChargeStatus, &charge_status);
max17050_get_property(MAX17050_AvgVCELL, &batt_volt); max17050_get_property(MAX17050_AvgVCELL, &batt_volt);