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