refactor display value logic
This commit is contained in:
parent
176984dfa5
commit
3df68fbc8b
@ -1,3 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <Adafruit_LEDBackpack.h> // Support for the Backpack FeatherWing
|
||||
#include <Adafruit_GFX.h> // Adafruit's graphics library
|
||||
#include <Adafruit_I2CDevice.h>
|
||||
@ -10,6 +12,9 @@
|
||||
|
||||
namespace Display {
|
||||
|
||||
void displayColon();
|
||||
Task tDisplay(500, TASK_FOREVER, Display::displayColon, &ts, true);
|
||||
|
||||
uint8_t brightness = BRIGHTNESS;
|
||||
int currentHour = -1;
|
||||
int currentMin = -1;
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#if IR
|
||||
|
||||
#include <queue>
|
||||
#include <AsyncMqttClient.h>
|
||||
#include <IRremoteESP8266.h>
|
||||
#include <IRrecv.h>
|
||||
#include "display.h"
|
||||
|
||||
#define IR_INPUT_PIN D6
|
||||
|
||||
@ -36,8 +36,7 @@ namespace Ir {
|
||||
|
||||
void displayValue() {
|
||||
Display::displayValue(lastCommand);
|
||||
tBlinkColon.set(500, TASK_FOREVER, Display::displayColon);
|
||||
tBlinkColon.enableDelayed();
|
||||
Display::tDisplay.setCallback(Display::displayColon);
|
||||
Display::adjustTime();
|
||||
}
|
||||
|
||||
@ -47,8 +46,8 @@ namespace Ir {
|
||||
|
||||
void loop() {
|
||||
if (readCommand()) {
|
||||
tBlinkColon.set(1000, TASK_ONCE, displayValue);
|
||||
tBlinkColon.forceNextIteration();
|
||||
Display::tDisplay.setCallback(displayValue);
|
||||
Display::tDisplay.forceNextIteration();
|
||||
switch (lastCommand)
|
||||
{
|
||||
case 0x9F:
|
||||
|
||||
@ -21,14 +21,10 @@ lib_deps =
|
||||
ottowinter/AsyncMqttClient-esphome@^0.8.5
|
||||
crankyoldgit/IRremoteESP8266@^2.7.18
|
||||
arkhipenko/TaskScheduler@^3.4.0
|
||||
|
||||
[env:dev_mode]
|
||||
build_flags = -D IR=1
|
||||
|
||||
[env:laptop_home]
|
||||
build_flags = -D IR=1
|
||||
|
||||
[env:ota_home]
|
||||
build_flags = -D IR=1
|
||||
upload_port = 192.168.5.191
|
||||
upload_protocol = espota
|
||||
|
||||
@ -7,12 +7,11 @@ StatusRequest hourChanged;
|
||||
StatusRequest dayChanged;
|
||||
StatusRequest wifiConnected;
|
||||
|
||||
#include "display.h"
|
||||
#include "wifi.h"
|
||||
#include "ntp_time.h"
|
||||
#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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user