@@ -47,12 +47,21 @@ static const char* status_text[] = {
4747#ifdef PLATFORM_TINTIN
4848static const int SLOW_THRESHOLD_PERCENTAGE = 42 ; // ~3850mv
4949static const int PASS_BATTERY_PERCENTAGE = 84 ; // ~4050mv
50+
51+ static const int TEMP_MIN_MC = 0 ;
52+ static const int TEMP_MAX_MC = 0 ;
5053#elif defined(PLATFORM_ASTERIX ) || defined(PLATFORM_OBELIX )
5154static const int SLOW_THRESHOLD_PERCENTAGE = 0 ;
5255static const int PASS_BATTERY_PERCENTAGE = 70 ;
56+
57+ static const int TEMP_MIN_MC = 150000 ; // 15.0C
58+ static const int TEMP_MAX_MC = 350000 ; // 35.0C
5359#else
5460static const int SLOW_THRESHOLD_PERCENTAGE = 0 ; // Always go "slow" on snowy
5561static const int PASS_BATTERY_PERCENTAGE = 60 ; // ~4190mv
62+
63+ static const int TEMP_MIN_MC = 0 ;
64+ static const int TEMP_MAX_MC = 0 ;
5665#endif
5766
5867typedef struct {
@@ -107,7 +116,8 @@ static void prv_handle_second_tick(struct tm *tick_time, TimeUnits units_changed
107116 // go slow for a bit
108117 battery_set_fast_charge (false);
109118 data -> fastcharge_enabled = false;
110- } else if (charge_state .charge_percent > PASS_BATTERY_PERCENTAGE ) {
119+ } else if (charge_state .charge_percent > PASS_BATTERY_PERCENTAGE &&
120+ temp_mc >= TEMP_MIN_MC && temp_mc <= TEMP_MAX_MC ) {
111121 // The reading can be a bit shaky in the short term (i.e. a flaky USB connection), or we
112122 // just started charging. Make sure we have settled before transitioning into the
113123 // RuninStatePass state
0 commit comments