Battery "desync" fix is now applied on boot

This commit is contained in:
ctcaer@gmail.com 2019-04-16 19:58:12 +03:00
parent 07fe94b6d4
commit a2ba2ecf26
4 changed files with 4 additions and 14 deletions

View file

@ -52,8 +52,8 @@ static int _dump_emmc_verify(sdmmc_storage_t *storage, u32 lba_curr, char *outFi
u8 sparseShouldVerify = 4; u8 sparseShouldVerify = 4;
u32 btn = 0; u32 btn = 0;
u32 prevPct = 200; u32 prevPct = 200;
int res = 0;
u32 sdFileSector = 0; u32 sdFileSector = 0;
int res = 0;
u8 hashEm[0x20]; u8 hashEm[0x20];
u8 hashSd[0x20]; u8 hashSd[0x20];

View file

@ -458,18 +458,6 @@ void _fix_sd_attr(u32 type)
void fix_sd_all_attr() { _fix_sd_attr(0); } void fix_sd_all_attr() { _fix_sd_attr(0); }
void fix_sd_nin_attr() { _fix_sd_attr(1); } void fix_sd_nin_attr() { _fix_sd_attr(1); }
void fix_battery_desync()
{
gfx_clear_partial_grey(0x1B, 0, 1256);
gfx_con_setpos(0, 0);
max77620_low_battery_monitor_config();
gfx_puts("\nDone!\n");
btn_wait();
}
/* void fix_fuel_gauge_configuration() /* void fix_fuel_gauge_configuration()
{ {
gfx_clear_partial_grey(0x1B, 0, 1256); gfx_clear_partial_grey(0x1B, 0, 1256);

View file

@ -1081,7 +1081,6 @@ ment_t ment_tools[] = {
MDEF_CHGLINE(), MDEF_CHGLINE(),
MDEF_CAPTION("-------- Misc --------", 0xFF0AB9E6), MDEF_CAPTION("-------- Misc --------", 0xFF0AB9E6),
MDEF_HANDLER("Dump package1/2", dump_packages12), MDEF_HANDLER("Dump package1/2", dump_packages12),
MDEF_HANDLER("Fix battery de-sync", fix_battery_desync),
MDEF_HANDLER("Fix archive bit (except Nintendo)", fix_sd_all_attr), MDEF_HANDLER("Fix archive bit (except Nintendo)", fix_sd_all_attr),
MDEF_HANDLER("Fix archive bit (Nintendo only)", fix_sd_nin_attr), MDEF_HANDLER("Fix archive bit (Nintendo only)", fix_sd_nin_attr),
//MDEF_HANDLER("Fix fuel gauge configuration", fix_fuel_gauge_configuration), //MDEF_HANDLER("Fix fuel gauge configuration", fix_fuel_gauge_configuration),

View file

@ -239,6 +239,9 @@ void config_hw()
i2c_send_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_GPIO5, 2); i2c_send_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_GPIO5, 2);
i2c_send_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_GPIO6, 2); i2c_send_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_GPIO6, 2);
// Disable low battery shutdown monitor.
max77620_low_battery_monitor_config();
_config_pmc_scratch(); // Missing from 4.x+ _config_pmc_scratch(); // Missing from 4.x+
CLOCK(CLK_RST_CONTROLLER_SCLK_BURST_POLICY) = (CLOCK(CLK_RST_CONTROLLER_SCLK_BURST_POLICY) & 0xFFFF8888) | 0x3333; CLOCK(CLK_RST_CONTROLLER_SCLK_BURST_POLICY) = (CLOCK(CLK_RST_CONTROLLER_SCLK_BURST_POLICY) & 0xFFFF8888) | 0x3333;