From a2e1da279c9a9fc3ebee264a2c2e73eb96b397b6 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Fri, 9 Feb 2024 17:49:54 +0700 Subject: [PATCH] remote var toggle --- ESPMegaPRO-OS-SDK/src/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ESPMegaPRO-OS-SDK/src/main.cpp b/ESPMegaPRO-OS-SDK/src/main.cpp index edd8963..09111cd 100644 --- a/ESPMegaPRO-OS-SDK/src/main.cpp +++ b/ESPMegaPRO-OS-SDK/src/main.cpp @@ -13,13 +13,16 @@ #define DISPLAY_ENABLE #define WEB_SERVER_ENABLE #define LCD_OTA_ENABLE +#define REMOTE_VARIABLE_ENABLE // Demo PLC firmware using the ESPMegaPRO OOP library ESPMegaPRO espmega = ESPMegaPRO(); // Remote Variable +#ifdef REMOTE_VARIABLE_ENABLE RemoteVariable testVar = RemoteVariable(); +#endif #ifdef LCD_OTA_ENABLE ESPMegaDisplayOTA internalDisplayOTA = ESPMegaDisplayOTA(); @@ -195,9 +198,12 @@ void setup() #ifdef LCD_OTA_ENABLE internalDisplayOTA.begin("/display", espmega.display, espmega.webServer); #endif +#ifdef REMOTE_VARIABLE_ENABLE ESP_LOGI("Initializer", "Initializing testvar"); testVar.begin(32, "/testvar", espmega.iot, true,"/testvar/request"); testVar.enableSetValue("/testvar/set"); +#endif + ESP_LOGI("Initializer", "Setup complete"); } void loop() @@ -232,6 +238,7 @@ void loop() Serial.println(espmega.iot->mqttConnected() ? "Connected" : "Disconnected"); } #endif +#ifdef REMOTE_VARIABLE_ENABLE // Print out testvar value every 5 seconds static uint32_t last_testvar_print = 0; if (millis() - last_testvar_print >= 5000) @@ -241,4 +248,5 @@ void loop() ESP_LOGI("TestVar", "Value: %s", testVar.getValue()); testVar.setValue("Hello World"); } +#endif } \ No newline at end of file