fix colon display

This commit is contained in:
Nicu Hodos 2020-09-06 14:03:30 +02:00
parent b1952bebe4
commit e65a2846c7

View File

@ -11,9 +11,6 @@
#include <Adafruit_LEDBackpack.h> // Support for the Backpack FeatherWing #include <Adafruit_LEDBackpack.h> // Support for the Backpack FeatherWing
#include <Adafruit_GFX.h> // Adafruit's graphics library #include <Adafruit_GFX.h> // Adafruit's graphics library
#define STASSID "Miracle"
#define STAPSK "***REMOVED***"
#define TIME_24_HOUR #define TIME_24_HOUR
#define DISPLAY_ADDRESS 0x70 #define DISPLAY_ADDRESS 0x70
#define BRIGHTNESS 1 #define BRIGHTNESS 1
@ -36,7 +33,6 @@ byte displayHours[24] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1
byte displayHours[24] = {12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; byte displayHours[24] = {12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
#endif #endif
bool blinkColon = false; // Track colon status to blink once/sec
int status = WL_IDLE_STATUS; int status = WL_IDLE_STATUS;
bool shouldUpdate = true; bool shouldUpdate = true;
String currentSSID; String currentSSID;
@ -83,7 +79,10 @@ void loop() {
incrementTime(); incrementTime();
} }
displayTime(); displayTime();
delay(1000); displayColon(true);
delay(500);
displayColon(false);
delay(500);
} }
void incrementTime() { void incrementTime() {
@ -128,14 +127,12 @@ void displayTime() {
clockDisplay.writeDigitNum(3, 0); clockDisplay.writeDigitNum(3, 0);
} }
} }
}
// Blink the colon by flipping its value every loop iteration void displayColon(bool on) {
// (which happens every second). clockDisplay.drawColon(on);
blinkColon = !blinkColon;
clockDisplay.drawColon(blinkColon);
// Now push out to the display the new values that were set above. clockDisplay.writeDisplay();
clockDisplay.writeDisplay();
} }
void setupOTA() { void setupOTA() {