Skip to content

Commit

Permalink
fixing small bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
bgaultier committed Sep 10, 2014
1 parent 52b8fcb commit 3112d3d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion laboite.ino
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
// uncomment if you want to enable TinkerKit! sensors
//#define TINKERKIT
// uncomment if you want to enable classic sensors
#define SENSORS
//#define SENSORS

#include <SPI.h>
#include <Ethernet.h>
Expand Down Expand Up @@ -82,8 +82,12 @@ char coffees[3];
byte todayIcon;
byte tomorrowIcon;
byte color;
#ifdef SENSOR
#ifdef TINKERKIT
char indoorTemperatureString[3];
byte indoorTemperature;
#endif
#endif
char temperature[3];
char low[3];
char high[3];
Expand Down
18 changes: 15 additions & 3 deletions laboiteLib.ino
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,9 @@ void printTemperature(int x, char firstDigit, char secondDigit, byte color)
secondDigit = firstDigit;
firstDigit = ' ';
}
dotmatrix.putchar(x, 9, firstDigit, color);
dotmatrix.putchar(x+5, 9, secondDigit, color);
dotmatrix.putchar(x+10, 9, '*', color);
dotmatrix.putchar(x, 10, firstDigit, color);
dotmatrix.putchar(x+5, 10, secondDigit, color);
dotmatrix.putchar(x+10, 10, '*', color);
}

void scrollFirstPanel(int x) {
Expand All @@ -519,9 +519,14 @@ void scrollFirstPanel(int x) {
}

if(x == 0) {
#ifdef SENSOR
#ifdef TINKERKIT
waitAWhile();
printTemperature(x+17, indoorTemperatureString[0], indoorTemperatureString[1], ORANGE);
dotmatrix.sendframe();
#endif
#endif
dotmatrix.sendframe();
waitAWhile();
}
}
Expand All @@ -539,7 +544,12 @@ void scrollSecondPanel(int x) {
}

if(x >= -32 && x < 0) {
#ifdef SENSOR
printTemperature(x+17, indoorTemperatureString[0], indoorTemperatureString[1], ORANGE);
#else
printTemperature(x+17, temperature[0], temperature[1], RED);
#endif

printTemperature(x+49, low[0], low[1], RED);
dotmatrix.sendframe();
}
Expand Down Expand Up @@ -638,6 +648,7 @@ void drawChart(byte x, byte height) {
}
#endif

#ifdef SENSOR
int getTemperature() {
// smallest footprint for temperature reading http://playground.arduino.cc/ComponentLib/Thermistor3
return ((analogRead(thermistorPin) - 250) * (441 - 14) / (700 - 250) + 250)/10;
Expand All @@ -649,3 +660,4 @@ int getTemperature() {
return temperatureC - 273;*/
}
#endif

0 comments on commit 3112d3d

Please sign in to comment.