display command
This commit is contained in:
parent
4f9d75034a
commit
6b3df25fd5
@ -17,7 +17,7 @@ namespace Display {
|
||||
// Create display object
|
||||
Adafruit_7segment clockDisplay = Adafruit_7segment();
|
||||
|
||||
void displayTime() {
|
||||
void adjustTime() {
|
||||
int displayHour = hour();
|
||||
int displayMinute = minute();
|
||||
int displayValue = displayHour * 100 + displayMinute;
|
||||
@ -62,7 +62,7 @@ namespace Display {
|
||||
}
|
||||
if (currentMin != minute()) {
|
||||
currentMin = minute();
|
||||
displayTime();
|
||||
adjustTime();
|
||||
}
|
||||
}
|
||||
clockDisplay.drawColon(colonOn);
|
||||
@ -79,7 +79,7 @@ namespace Display {
|
||||
void setup() {
|
||||
clockDisplay.begin(DISPLAY_ADDRESS);
|
||||
clockDisplay.setBrightness(brightness);
|
||||
displayTime();
|
||||
adjustTime();
|
||||
displayColon();
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,12 +34,21 @@ namespace Ir {
|
||||
return newCommand;
|
||||
}
|
||||
|
||||
void displayValue() {
|
||||
Display::displayValue(lastCommand);
|
||||
tBlinkColon.set(500, TASK_FOREVER, Display::displayColon);
|
||||
tBlinkColon.enableDelayed();
|
||||
Display::adjustTime();
|
||||
}
|
||||
|
||||
void setup() {
|
||||
irrecv.enableIRIn(); // Start the receiver
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if (readCommand()) {
|
||||
tBlinkColon.set(1000, TASK_ONCE, displayValue);
|
||||
tBlinkColon.forceNextIteration();
|
||||
switch (lastCommand)
|
||||
{
|
||||
case 0x9F:
|
||||
|
||||
@ -12,6 +12,7 @@ StatusRequest wifiConnected;
|
||||
#include "mqtt.h"
|
||||
#include "ota.h"
|
||||
#include "display.h"
|
||||
Task tBlinkColon(500, TASK_FOREVER, Display::displayColon, &ts, true);
|
||||
#include "ir.h"
|
||||
|
||||
#define STAY_CONNECTED_AFTER_BOOT 5*60
|
||||
@ -19,7 +20,6 @@ StatusRequest wifiConnected;
|
||||
void wifiConnectedCallback();
|
||||
void otaCallback();
|
||||
|
||||
Task tBlinkColon(500, TASK_FOREVER, Display::displayColon, &ts, true);
|
||||
Task tOta(TASK_IMMEDIATE, TASK_FOREVER, otaCallback, &ts);
|
||||
Task tWifiReconnect(Wifi::reconnect, &ts);
|
||||
Task tWifiConnected(wifiConnectedCallback, &ts);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user