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