IsOff functon, 10ms timer
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = esp32doit-devkit-v1
|
board = esp32doit-devkit-v1
|
||||||
framework = arduino
|
framework = arduino
|
||||||
monitor_port = COM[136789]
|
monitor_port = COM[456789]
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
lib_deps =
|
lib_deps =
|
||||||
knolleary/PubSubClient@^2.8
|
knolleary/PubSubClient@^2.8
|
||||||
|
|||||||
@@ -251,6 +251,11 @@ void Scroller::PrintSerialLines()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Scroller::IsOff()
|
||||||
|
{
|
||||||
|
return _off;
|
||||||
|
}
|
||||||
|
|
||||||
bool Scroller::TurnOn()
|
bool Scroller::TurnOn()
|
||||||
{
|
{
|
||||||
Serial.println("Turn on Scroller");
|
Serial.println("Turn on Scroller");
|
||||||
@@ -266,6 +271,7 @@ bool Scroller::TurnOn()
|
|||||||
|
|
||||||
void Scroller::TurnOff()
|
void Scroller::TurnOff()
|
||||||
{
|
{
|
||||||
|
DeleteLines();
|
||||||
Serial.println("TURN OFF");
|
Serial.println("TURN OFF");
|
||||||
_matrix->fillScreen(0);
|
_matrix->fillScreen(0);
|
||||||
_matrix->print("");
|
_matrix->print("");
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include "ESP32TimerInterrupt.h"
|
#include "ESP32TimerInterrupt.h"
|
||||||
|
|
||||||
|
|
||||||
#define SCROLLER_TICK_TIME 50 //ms
|
#define SCROLLER_TICK_TIME 10 //ms
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char const *code;
|
char const *code;
|
||||||
@@ -71,6 +71,7 @@ public:
|
|||||||
int Scroll();
|
int Scroll();
|
||||||
int TimesScrolled();
|
int TimesScrolled();
|
||||||
void PrintSerialLines();
|
void PrintSerialLines();
|
||||||
|
bool IsOff();
|
||||||
void TurnOff();
|
void TurnOff();
|
||||||
void loop(ulong tick);
|
void loop(ulong tick);
|
||||||
void Show(int _x,int _y, String line);
|
void Show(int _x,int _y, String line);
|
||||||
|
|||||||
@@ -250,11 +250,8 @@ void callback(char* topic, byte* payload, unsigned int length) {
|
|||||||
strncpy(msg,(char *)payload,length>255 ? 255 : length);
|
strncpy(msg,(char *)payload,length>255 ? 255 : length);
|
||||||
msg[length>255 ? 255 : length] = '\0';
|
msg[length>255 ? 255 : length] = '\0';
|
||||||
|
|
||||||
// Switch on the LED if an 1 was received as first character
|
if (scroller.IsOff()) showTextMqtt = true;
|
||||||
//scroller.TurnOff();
|
|
||||||
//scroller.DeleteLines();
|
|
||||||
scroller.AddLine(msg);
|
scroller.AddLine(msg);
|
||||||
showTextMqtt = true;
|
|
||||||
} else if (String("get/home/sensor/decka/bme280") == String(topic)) {
|
} 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/temperature",(String("N:") + String(bme.readTemperature())).c_str());
|
||||||
client.publish("home/sensor/decka/bme280/humidity",(String("N:") + String(bme.readHumidity())).c_str());
|
client.publish("home/sensor/decka/bme280/humidity",(String("N:") + String(bme.readHumidity())).c_str());
|
||||||
|
|||||||
Reference in New Issue
Block a user