mirror of
https://github.com/CTCaer/hekate.git
synced 2024-11-10 20:36:40 +00:00
info: Allow dumping of battery characterization table
This commit is contained in:
parent
6a52d44da6
commit
bc7a7bcfa0
1 changed files with 11 additions and 0 deletions
|
@ -88,6 +88,12 @@ static lv_res_t _battery_dump_window_action(lv_obj_t * btn)
|
||||||
char path[64];
|
char path[64];
|
||||||
u8 *buf = (u8 *)malloc(0x100 * 2);
|
u8 *buf = (u8 *)malloc(0x100 * 2);
|
||||||
|
|
||||||
|
// Unlock model table.
|
||||||
|
u16 unlock = 0x59;
|
||||||
|
i2c_send_buf_small(I2C_1, MAXIM17050_I2C_ADDR, MAX17050_MODELEnable1, (u8 *)&unlock, 2);
|
||||||
|
unlock = 0xC4;
|
||||||
|
i2c_send_buf_small(I2C_1, MAXIM17050_I2C_ADDR, MAX17050_MODELEnable2, (u8 *)&unlock, 2);
|
||||||
|
|
||||||
// Dump all battery fuel gauge registers.
|
// Dump all battery fuel gauge registers.
|
||||||
for (int i = 0; i < 0x200; i += 2)
|
for (int i = 0; i < 0x200; i += 2)
|
||||||
{
|
{
|
||||||
|
@ -95,6 +101,11 @@ static lv_res_t _battery_dump_window_action(lv_obj_t * btn)
|
||||||
msleep(1);
|
msleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lock model table.
|
||||||
|
unlock = 0;
|
||||||
|
i2c_send_buf_small(I2C_1, MAXIM17050_I2C_ADDR, MAX17050_MODELEnable1, (u8 *)&unlock, 2);
|
||||||
|
i2c_send_buf_small(I2C_1, MAXIM17050_I2C_ADDR, MAX17050_MODELEnable2, (u8 *)&unlock, 2);
|
||||||
|
|
||||||
emmcsn_path_impl(path, "/dumps", "fuel_gauge.bin", NULL);
|
emmcsn_path_impl(path, "/dumps", "fuel_gauge.bin", NULL);
|
||||||
error = sd_save_to_file((u8 *)buf, 0x200, path);
|
error = sd_save_to_file((u8 *)buf, 0x200, path);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue