|
|
@@ -235,6 +235,7 @@ static int _can_powerdown(void){
|
|
|
|
|
|
|
|
|
void check_voltage_state(void) {
|
|
|
+ static int no_pd_count = 0;
|
|
|
if (bms_state_get()->charging){ //check sigle cell's voltage for charger
|
|
|
_health.discharger_shutpower_voltage = 0;
|
|
|
_health.sigle_cell_lower_voltage = 0;
|
|
|
@@ -303,6 +304,7 @@ void check_voltage_state(void) {
|
|
|
|
|
|
/* check for power down */
|
|
|
if (_can_powerdown()){
|
|
|
+ no_pd_count = 0;
|
|
|
if (judge_debounce(!_health.powerdown_lower_voltage, &_power_down_voltage)) {
|
|
|
/*
|
|
|
* no need to clear powerdown(bms is shutdown), when charger insert,
|
|
|
@@ -310,6 +312,10 @@ void check_voltage_state(void) {
|
|
|
*/
|
|
|
_health.powerdown_lower_voltage = 1;
|
|
|
}
|
|
|
+ }else {
|
|
|
+ if (no_pd_count ++ == 2) {
|
|
|
+ shark_rtc_set_pd_magic(0);
|
|
|
+ }
|
|
|
}
|
|
|
debug_health();
|
|
|
}
|