IsOff functon, 10ms timer

This commit is contained in:
2021-12-14 14:33:15 +01:00
parent 762ed25669
commit 116193b940
4 changed files with 10 additions and 6 deletions

View File

@@ -12,7 +12,7 @@
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
monitor_port = COM[136789]
monitor_port = COM[456789]
monitor_speed = 115200
lib_deps =
knolleary/PubSubClient@^2.8

View File

@@ -251,6 +251,11 @@ void Scroller::PrintSerialLines()
}
}
bool Scroller::IsOff()
{
return _off;
}
bool Scroller::TurnOn()
{
Serial.println("Turn on Scroller");
@@ -266,6 +271,7 @@ bool Scroller::TurnOn()
void Scroller::TurnOff()
{
DeleteLines();
Serial.println("TURN OFF");
_matrix->fillScreen(0);
_matrix->print("");

View File

@@ -7,7 +7,7 @@
#include "ESP32TimerInterrupt.h"
#define SCROLLER_TICK_TIME 50 //ms
#define SCROLLER_TICK_TIME 10 //ms
typedef struct {
char const *code;
@@ -71,6 +71,7 @@ public:
int Scroll();
int TimesScrolled();
void PrintSerialLines();
bool IsOff();
void TurnOff();
void loop(ulong tick);
void Show(int _x,int _y, String line);

View File

@@ -250,11 +250,8 @@ void callback(char* topic, byte* payload, unsigned int length) {
strncpy(msg,(char *)payload,length>255 ? 255 : length);
msg[length>255 ? 255 : length] = '\0';
// Switch on the LED if an 1 was received as first character
//scroller.TurnOff();
//scroller.DeleteLines();
if (scroller.IsOff()) showTextMqtt = true;
scroller.AddLine(msg);
showTextMqtt = true;
} else if (String("get/home/sensor/decka/bme280") == String(topic)) {
client.publish("home/sensor/decka/bme280/temperature",(String("N:") + String(bme.readTemperature())).c_str());
client.publish("home/sensor/decka/bme280/humidity",(String("N:") + String(bme.readHumidity())).c_str());