Skip to content

Commit 2a9c3fa

Browse files
committed
First aid menu: Add menu entry to ignore thermistor cutoff
Useful when the thermistor readout gives bogus values / cable broken. Only available when SUPPORT_THERMISTOR_CUTOFF and SUPPORT_THERMISTOR is enabled.
1 parent a2ca344 commit 2a9c3fa

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

Arduino_Pedelec_Controller/Arduino_Pedelec_Controller.ino

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ boolean first_aid_ignore_pas = false;
318318
boolean first_aid_ignore_speed = false;
319319
boolean first_aid_ignore_poti = false;
320320
boolean first_aid_ignore_throttle = false;
321+
boolean first_aid_ignore_temp_sensor = false;
321322

322323
// Forward declarations for compatibility with new gcc versions
323324
void pas_change();
@@ -870,8 +871,11 @@ if (loadcell.is_ready()) //new conversion result from load cell available
870871

871872
//Temperature cutoff
872873
#if defined(SUPPORT_THERMISTOR) && defined(SUPPORT_THERMISTOR_CUTOFF)
873-
float factor_temperature=constrain(1-(temperature_thermistor-temperature_cutoff_start)/(temperature_cutoff_stop-temperature_cutoff_start),0,1); //linear decrease of maximum power for temperatures higher than temperature_cutoff_start
874-
factor_volt=factor_volt*factor_temperature;
874+
if (!first_aid_ignore_temp_sensor)
875+
{
876+
float factor_temperature=constrain(1-(temperature_thermistor-temperature_cutoff_start)/(temperature_cutoff_stop-temperature_cutoff_start),0,1); //linear decrease of maximum power for temperatures higher than temperature_cutoff_start
877+
factor_volt=factor_volt*factor_temperature;
878+
}
875879
#endif
876880

877881
//Throttle output-------------------------------------------------------------------------------------------------------
@@ -1608,4 +1612,4 @@ int analogRead_noISR(uint8_t pin) //this function makes sure that analogRead is
16081612
analogRead_in_use = false;
16091613
#endif
16101614
return temp;
1611-
}
1615+
}

Arduino_Pedelec_Controller/globals.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ extern boolean first_aid_ignore_pas;
6969
extern boolean first_aid_ignore_speed;
7070
extern boolean first_aid_ignore_poti;
7171
extern boolean first_aid_ignore_throttle;
72+
extern boolean first_aid_ignore_temp_sensor;
7273

7374
extern void save_eeprom();
7475
extern void save_shutdown();
@@ -99,4 +100,4 @@ extern DallasTemperature sensors;
99100
#define FET_OFF LOW
100101
#endif
101102

102-
#endif
103+
#endif

Arduino_Pedelec_Controller/menu.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,15 @@ boolean menu_changed=false;
4848
│ │ ├── Ign. Treten
4949
│ │ ├── Ign. Tacho
5050
│ │ ├── Ign. Gasgr.
51+
│ │ ├── Ign. Temps. (only with SUPPORT_THERMISTOR_CUTOFF and SUPPORT_THERMISTOR)
5152
│ │ ├── Ign. Poti (only with SUPPORT_POTI)
5253
│ │ ├── Poti +
5354
│ │ ├── Poti -
5455
│ │ └── Zurück
5556
│ └── Zurück
5657
└── Zurück
5758
*/
59+
// note: Nokia Display is just 14 chars wide minus "> " for the selector
5860
MenuSystem menu_system;
5961

6062
static const char desc_main[] PROGMEM = "";
@@ -113,6 +115,11 @@ static MenuItem m_first_aid_ignore_speed(desc_first_aid_ignore_speed);
113115
static const char desc_first_aid_ignore_throttle[] PROGMEM = "Ign. Gasgr.";
114116
static MenuItem m_first_aid_ignore_throttle(desc_first_aid_ignore_throttle);
115117

118+
#if defined(SUPPORT_THERMISTOR) && defined(SUPPORT_THERMISTOR_CUTOFF)
119+
static const char desc_first_aid_ignore_temp_sensor[] PROGMEM = "Ign. Tempse.";
120+
static MenuItem m_first_aid_ignore_temp_sensor(desc_first_aid_ignore_temp_sensor);
121+
#endif
122+
116123
static const char desc_first_aid_ignore_poti[] PROGMEM = "Ignore Poti";
117124
static MenuItem m_first_aid_ignore_poti(desc_first_aid_ignore_poti);
118125

@@ -260,6 +267,14 @@ static void handle_ignore_throttle(MenuItem* p_menu_item)
260267
show_new_state(first_aid_ignore_throttle);
261268
}
262269

270+
#if defined(SUPPORT_THERMISTOR) && defined(SUPPORT_THERMISTOR_CUTOFF)
271+
static void handle_ignore_temp_sensor(MenuItem* p_menu_item)
272+
{
273+
first_aid_ignore_temp_sensor = !first_aid_ignore_temp_sensor;
274+
show_new_state(first_aid_ignore_temp_sensor);
275+
}
276+
#endif
277+
263278
static void handle_ignore_poti(MenuItem* p_menu_item)
264279
{
265280
first_aid_ignore_poti = !first_aid_ignore_poti;
@@ -305,7 +320,9 @@ static void add_first_aid_menu()
305320
#ifdef SUPPORT_THROTTLE
306321
menu_first_aid.add_item(&m_first_aid_ignore_throttle, &handle_ignore_throttle);
307322
#endif
308-
323+
#if defined(SUPPORT_THERMISTOR) && defined(SUPPORT_THERMISTOR_CUTOFF)
324+
menu_first_aid.add_item(&m_first_aid_ignore_temp_sensor, &handle_ignore_temp_sensor);
325+
#endif
309326
#ifdef SUPPORT_POTI
310327
menu_first_aid.add_item(&m_first_aid_ignore_poti, &handle_ignore_poti);
311328
#endif

0 commit comments

Comments
 (0)