remote variable tested and moved into production

This commit is contained in:
Siwat Sirichai 2024-02-09 17:48:43 +07:00
parent df2543ad58
commit 3467c90e52
6 changed files with 49 additions and 27 deletions

View file

@ -3,6 +3,7 @@
#include <ETH.h>
#include <ClimateCard.hpp>
#include <ESPMegaDisplayOTA.hpp>
#include <RemoteVariable.hpp>
// #define FRAM_DEBUG
// #define MQTT_DEBUG
@ -17,6 +18,9 @@
ESPMegaPRO espmega = ESPMegaPRO();
// Remote Variable
RemoteVariable testVar = RemoteVariable();
#ifdef LCD_OTA_ENABLE
ESPMegaDisplayOTA internalDisplayOTA = ESPMegaDisplayOTA();
#endif
@ -191,6 +195,9 @@ void setup()
#ifdef LCD_OTA_ENABLE
internalDisplayOTA.begin("/display", espmega.display, espmega.webServer);
#endif
ESP_LOGI("Initializer", "Initializing testvar");
testVar.begin(32, "/testvar", espmega.iot, true,"/testvar/request");
testVar.enableSetValue("/testvar/set");
}
void loop()
@ -225,4 +232,13 @@ void loop()
Serial.println(espmega.iot->mqttConnected() ? "Connected" : "Disconnected");
}
#endif
// Print out testvar value every 5 seconds
static uint32_t last_testvar_print = 0;
if (millis() - last_testvar_print >= 5000)
{
last_testvar_print = millis();
if (testVar.getValue() != nullptr)
ESP_LOGI("TestVar", "Value: %s", testVar.getValue());
testVar.setValue("Hello World");
}
}