Skip to content

Commit 25fe400

Browse files
committed
Environment display view: Show thermistor temperature
Show thermistor temperature if SUPPORT_THERMISTOR and DV_ENVIRONMENT is set. Tested on Nokia display, but should work for serial display, too.
1 parent 2a9c3fa commit 25fe400

File tree

4 files changed

+24
-7
lines changed

4 files changed

+24
-7
lines changed

Arduino_Pedelec_Controller/display.cpp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ static void display_16x2_view_environment()
464464
#endif
465465
lcd.setCursor(0,1);
466466

467-
// switch between altitude and slope very five seconds
467+
// switch between altitude and slope every five seconds
468468
byte current_second = (millis() / 1000) % 60UL;
469469
if (current_second % 5 == 0)
470470
show_altitude = !show_altitude;
@@ -491,6 +491,12 @@ static void display_16x2_view_environment()
491491
lcd.print((int)sensors.getTempCByIndex(1),1);
492492
lcd.print(MY_F(" C "));
493493
#endif
494+
#if defined(SUPPORT_THERMISTOR)
495+
lcd.setCursor(0,0);
496+
lcd.print(MY_F("Temp: "));
497+
lcd.print(temperature_thermistor,1);
498+
lcd.print(MY_F(" C "));
499+
#endif
494500
}
495501
#endif
496502

@@ -547,7 +553,7 @@ static void display_16x2_update()
547553
display_16x2_view_battery();
548554
break;
549555
#endif
550-
#if defined(SUPPORT_BMP085) || defined(SUPPORT_DSPC01) || defined(SUPPORT_TEMP_SENSOR)
556+
#if defined(SUPPORT_BMP085) || defined(SUPPORT_DSPC01) || defined(SUPPORT_TEMP_SENSOR) || defined(SUPPORT_THERMISTOR)
551557
#ifdef DV_ENVIRONMENT
552558
case DISPLAY_VIEW_ENVIRONMENT:
553559
display_16x2_view_environment();
@@ -1167,7 +1173,7 @@ static void display_nokia_view_environment()
11671173
lcd.print(MY_F(" C"));
11681174
//#endif
11691175
lcd.setCursor(0,2);
1170-
// switch between altitude and slope very five seconds
1176+
// switch between altitude and slope every five seconds
11711177
lcd.print(MY_F("Start: "));
11721178
lcd.print((int)(altitude_start));
11731179
lcd.print(MY_F("m"));
@@ -1190,6 +1196,12 @@ static void display_nokia_view_environment()
11901196
lcd.print((int)sensors.getTempCByIndex(1),1);
11911197
lcd.print(MY_F(" C "));
11921198
#endif
1199+
#if defined(SUPPORT_THERMISTOR)
1200+
lcd.setCursor(0,0);
1201+
lcd.print(MY_F("Temp: "));
1202+
lcd.print(temperature_thermistor,1);
1203+
lcd.print(MY_F(" C "));
1204+
#endif
11931205
}
11941206
#endif
11951207

@@ -1218,11 +1230,13 @@ static void display_nokia_update()
12181230

12191231
switch (display_view)
12201232
{
1221-
#if (defined(SUPPORT_BMP085) || defined(SUPPORT_DSPC01) || defined(SUPPORT_TEMP_SENSOR)) && defined(DV_ENVIRONMENT)
1233+
#if defined(SUPPORT_BMP085) || defined(SUPPORT_DSPC01) || defined(SUPPORT_TEMP_SENSOR) || defined(SUPPORT_THERMISTOR)
1234+
#ifdef DV_ENVIRONMENT
12221235
case DISPLAY_VIEW_ENVIRONMENT:
12231236
display_nokia_view_environment();
12241237
break;
12251238
#endif
1239+
#endif
12261240
#ifdef DV_GRAPHIC
12271241
case DISPLAY_VIEW_GRAPHIC:
12281242
display_nokia_view_graphic();
@@ -1383,4 +1397,4 @@ void display_debug(HardwareSerial* localSerial)
13831397
#endif
13841398

13851399
#endif
1386-
}
1400+
}

Arduino_Pedelec_Controller/display.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ typedef enum {DISPLAY_VIEW_MAIN=0,
5858
DISPLAY_VIEW_BATTERY,
5959
#endif
6060
#endif
61-
#if (defined(SUPPORT_BMP085) || defined(SUPPORT_DSPC01) || defined(SUPPORT_TEMP_SENSOR))&&defined(DV_ENVIRONMENT)
61+
#if (defined(SUPPORT_BMP085) || defined(SUPPORT_DSPC01) || defined(SUPPORT_TEMP_SENSOR) || defined(SUPPORT_THERMISTOR)) && defined(DV_ENVIRONMENT)
6262
DISPLAY_VIEW_ENVIRONMENT,
6363
#endif
6464
#if defined(DV_HUMAN)

Arduino_Pedelec_Controller/globals.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ void torque_rezero();
8484
#include "DallasTemp.h"
8585
extern DallasTemperature sensors;
8686
#endif
87+
#ifdef SUPPORT_THERMISTOR
88+
extern float temperature_thermistor;
89+
#endif
8790

8891
// Define own version of F() macro since compile will
8992
// fail on newer gcc versions with a "const" warning.

Arduino_Pedelec_Controller/switches.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ void handle_switch(const switch_name sw_name, boolean current_state, const switc
386386
}
387387
}
388388

389-
// Workhose of switch handling: Detect short
389+
// Workhorse of switch handling: Detect short
390390
// or long presses, also debounces the switches.
391391
static enum switch_result _read_switch(switch_state *state, boolean switch_current)
392392
{

0 commit comments

Comments
 (0)