Skip to content

Commit a5b8674

Browse files
committed
Include the fixed scroll code; change text a bit.
1 parent 34393bb commit a5b8674

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

thermo14/LEDDisplayDriver.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,14 @@ void LEDDisplayDriver::showText(const char *msg, byte first, byte count) {
428428

429429
#ifdef _INCLUDE_SCROLLING_TEXT_
430430
void LEDDisplayDriver::showTextScroll(const char *msg, byte first, byte count) {
431-
for (byte i = 0; i <= strlen(msg) - count; i++) {
431+
byte end;
432+
if (count >= strlen(msg)) {
433+
end = 0;
434+
} else {
435+
end = strlen(msg) - count;
436+
}
437+
438+
for (byte i = 0; i <= end; i++) {
432439
showText(msg + i, first, count);
433440
if (!autoUpdate) update();
434441
delay(scrollDelay);

thermo14/thermo14.ino

+7-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#define numberOfDigits 16
1212
const byte dataPin = A4;
1313
const byte clockPin = A5;
14-
const byte loadPin = A2;
1514

1615
LEDDisplayDriver display(dataPin, clockPin, true, numberOfDigits);
1716
DISPLAY_INTR(display)
@@ -92,16 +91,17 @@ void loop() {
9291
delay(2000);
9392
return;
9493
}
95-
display.showTextScroll("Temperature in fahrenheit:");
94+
display.showTextScroll("Temperature (Fahrenheit)");
9695
delay(2000);
9796
Serial.println(c);
9897
double f = (c * 9.0 / 5.0) + 32.0;
9998
Serial.println(f);
10099
display.clear();
101100
display.showNum2Left(f);
101+
display.showText("degrees F", 3, 16);
102102

103103
delay(5000);
104-
display.showText("RH is:");
104+
display.showTextScroll("Relative humidity");
105105
delay(2000);
106106
double rh = DHT.humidity;
107107
Serial.println(rh);
@@ -116,17 +116,19 @@ void loop() {
116116

117117
void getDateTimeString(const RtcDateTime& dt) {
118118
int hour = dt.Hour();
119+
boolean pm = hour >= 12;
119120
if (hour > 12) {
120121
hour -= 12;
121122
}
122123
snprintf_P(dateTimeString,
123124
countof(dateTimeString),
124125
// PSTR("%02u/%02u/%04u %02u:%02u:%02u"),
125-
PSTR("%02u:%02u:%02u"),
126+
PSTR("%02u:%02u:%02u %s"),
126127
//dt.Month(),
127128
//dt.Day(),
128129
//dt.Year(),
129130
hour,
130131
dt.Minute(),
131-
dt.Second() );
132+
dt.Second(),
133+
pm ? "PM" : "AM");
132134
}

0 commit comments

Comments
 (0)