Skip to content

Commit a81552c

Browse files
committed
fw/apps/prf/runin: add temperature range to pass criteria
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
1 parent 8c06df1 commit a81552c

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/fw/apps/prf_apps/mfg_runin_app.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,21 @@ static const char* status_text[] = {
4747
#ifdef PLATFORM_TINTIN
4848
static const int SLOW_THRESHOLD_PERCENTAGE = 42; // ~3850mv
4949
static 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)
5154
static const int SLOW_THRESHOLD_PERCENTAGE = 0;
5255
static 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
5460
static const int SLOW_THRESHOLD_PERCENTAGE = 0; // Always go "slow" on snowy
5561
static 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

5867
typedef 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

Comments
 (0)