@@ -34,18 +34,21 @@ static const char* status_text[] = {
3434#ifdef PLATFORM_TINTIN
3535static const int SLOW_THRESHOLD_PERCENTAGE = 42 ; // ~3850mv
3636static const int PASS_BATTERY_PERCENTAGE = 84 ; // ~4050mv
37+ static const int MAX_START_BATTERY_PERCENTAGE = 75 ; // Fail if starting >75%
3738
3839static const int TEMP_MIN_MC = 0 ;
3940static const int TEMP_MAX_MC = 0 ;
4041#elif defined(PLATFORM_ASTERIX ) || defined(PLATFORM_OBELIX ) || defined(PLATFORM_GETAFIX )
4142static const int SLOW_THRESHOLD_PERCENTAGE = 0 ;
4243static const int PASS_BATTERY_PERCENTAGE = 70 ;
44+ static const int MAX_START_BATTERY_PERCENTAGE = 75 ; // Fail if starting >75%
4345
4446static const int TEMP_MIN_MC = 15000 ; // 15.0C
4547static const int TEMP_MAX_MC = 35000 ; // 35.0C
4648#else
4749static const int SLOW_THRESHOLD_PERCENTAGE = 0 ; // Always go "slow" on snowy
4850static const int PASS_BATTERY_PERCENTAGE = 60 ; // ~4190mv
51+ static const int MAX_START_BATTERY_PERCENTAGE = 75 ; // Fail if starting >75%
4952
5053static const int TEMP_MIN_MC = 0 ;
5154static const int TEMP_MAX_MC = 0 ;
@@ -81,6 +84,12 @@ static void prv_handle_second_tick(struct tm *tick_time, TimeUnits units_changed
8184
8285 switch (data -> test_state ) {
8386 case ChargeStateStart :
87+ if (charge_state .charge_percent > MAX_START_BATTERY_PERCENTAGE ) {
88+ next_state = ChargeStateFail ;
89+ data -> countdown_running = false;
90+ battery_set_charge_enable (false);
91+ break ;
92+ }
8493 if (charge_state .is_plugged && charge_state .is_charging ) {
8594 next_state = ChargeStateRunning ;
8695 } else {
0 commit comments