working remoteControl via espNow

This commit is contained in:
2023-04-11 12:47:32 +02:00
parent e3c452436d
commit 3fab7c7f83
8 changed files with 125 additions and 78 deletions
+12 -7
View File
@@ -18,14 +18,19 @@ LcdWrapper::LcdWrapper(LiquidCrystal_I2C* lcd) {
}
void LcdWrapper::loop() {
if (this->changed) {
this->lcd->clear();
for (uint8_t i = 0; i < DISPLAY_WRAPPER_LINES; i++) {
this->lcd->setCursor(0, i);
this->lcd->print(this->data[i]);
}
this->changed = false;
if (!this->changed)
return;
this->lcd->clear();
for (uint8_t i = 0; i < DISPLAY_WRAPPER_LINES; i++) {
this->lcd->setCursor(0, i);
this->lcd->print(this->data[i]);
}
if (this->callback)
this->callback(this->data, DISPLAY_WRAPPER_LINES, DISPLAY_WRAPPER_ROWS);
this->changed = false;
}
void LcdWrapper::clear() {
+4
View File
@@ -19,6 +19,8 @@
#define DISPLAY_WRAPPER_ROWS 16
#define DISPLAY_WRAPPER_LINES 2
typedef void (*LcdWrapperCallback) (const char data[][DISPLAY_WRAPPER_ROWS], uint8_t lines, uint8_t rows);
/**
* @brief A class for the Menu class to print information
*
@@ -54,6 +56,7 @@ class LcdWrapper : public DisplayWrapper {
* @param line
*/
void setCursor(uint8_t row, uint8_t line) override;
void setCallback(LcdWrapperCallback callback) { this->callback = callback; }
/**
* @brief Save the data to be printed
@@ -65,6 +68,7 @@ class LcdWrapper : public DisplayWrapper {
private:
LiquidCrystal_I2C* lcd;
LcdWrapperCallback callback = nullptr;
char data[DISPLAY_WRAPPER_LINES][DISPLAY_WRAPPER_ROWS];
uint8_t cursorRow = 0;