mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-05 21:24:27 -04:00
use full_reset_and_init return value in init and reset_learned (#2393)
* use full_reset_and_init return value in init and reset_learned * do not uncomment status clear --------- Co-authored-by: gullradriel <gullradriel@no-mail.com>
This commit is contained in:
parent
d36ae88284
commit
3dcfa4f8c1
1 changed files with 6 additions and 13 deletions
|
@ -202,16 +202,14 @@ bool I2cDev_MAX17055::init(uint8_t addr_) {
|
||||||
model = I2CDEVMDL_MAX17055;
|
model = I2CDEVMDL_MAX17055;
|
||||||
query_interval = BATTERY_WIDGET_REFRESH_INTERVAL;
|
query_interval = BATTERY_WIDGET_REFRESH_INTERVAL;
|
||||||
if (detect()) {
|
if (detect()) {
|
||||||
|
bool return_status = true;
|
||||||
if (needsInitialization()) {
|
if (needsInitialization()) {
|
||||||
// First-time or POR initialization
|
// First-time or POR initialization
|
||||||
full_reset_and_init();
|
return_status = full_reset_and_init();
|
||||||
} else {
|
|
||||||
// Subsequent boot
|
|
||||||
partialInit();
|
|
||||||
}
|
}
|
||||||
partialInit();
|
partialInit(); // If you always want hibernation disabled
|
||||||
// statusClear(); I am not sure if this should be here or not
|
// statusClear(); // I am not sure if this should be here or not (Clear all bits in the Status register (0x00))
|
||||||
return true;
|
return return_status;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -220,19 +218,15 @@ bool I2cDev_MAX17055::full_reset_and_init() {
|
||||||
if (!soft_reset()) {
|
if (!soft_reset()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!initialize_custom_parameters()) {
|
if (!initialize_custom_parameters()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!load_custom_parameters()) {
|
if (!load_custom_parameters()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!clear_por()) {
|
if (!clear_por()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,8 +292,7 @@ void I2cDev_MAX17055::partialInit() {
|
||||||
bool I2cDev_MAX17055::reset_learned() {
|
bool I2cDev_MAX17055::reset_learned() {
|
||||||
// this if for reset all the learned parameters by ic
|
// this if for reset all the learned parameters by ic
|
||||||
// the full inis should do this
|
// the full inis should do this
|
||||||
full_reset_and_init();
|
return full_reset_and_init();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool I2cDev_MAX17055::detect() {
|
bool I2cDev_MAX17055::detect() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue