remote var toggle
This commit is contained in:
parent
3467c90e52
commit
a2e1da279c
|
@ -13,13 +13,16 @@
|
||||||
#define DISPLAY_ENABLE
|
#define DISPLAY_ENABLE
|
||||||
#define WEB_SERVER_ENABLE
|
#define WEB_SERVER_ENABLE
|
||||||
#define LCD_OTA_ENABLE
|
#define LCD_OTA_ENABLE
|
||||||
|
#define REMOTE_VARIABLE_ENABLE
|
||||||
|
|
||||||
// Demo PLC firmware using the ESPMegaPRO OOP library
|
// Demo PLC firmware using the ESPMegaPRO OOP library
|
||||||
|
|
||||||
ESPMegaPRO espmega = ESPMegaPRO();
|
ESPMegaPRO espmega = ESPMegaPRO();
|
||||||
|
|
||||||
// Remote Variable
|
// Remote Variable
|
||||||
|
#ifdef REMOTE_VARIABLE_ENABLE
|
||||||
RemoteVariable testVar = RemoteVariable();
|
RemoteVariable testVar = RemoteVariable();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef LCD_OTA_ENABLE
|
#ifdef LCD_OTA_ENABLE
|
||||||
ESPMegaDisplayOTA internalDisplayOTA = ESPMegaDisplayOTA();
|
ESPMegaDisplayOTA internalDisplayOTA = ESPMegaDisplayOTA();
|
||||||
|
@ -195,9 +198,12 @@ void setup()
|
||||||
#ifdef LCD_OTA_ENABLE
|
#ifdef LCD_OTA_ENABLE
|
||||||
internalDisplayOTA.begin("/display", espmega.display, espmega.webServer);
|
internalDisplayOTA.begin("/display", espmega.display, espmega.webServer);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef REMOTE_VARIABLE_ENABLE
|
||||||
ESP_LOGI("Initializer", "Initializing testvar");
|
ESP_LOGI("Initializer", "Initializing testvar");
|
||||||
testVar.begin(32, "/testvar", espmega.iot, true,"/testvar/request");
|
testVar.begin(32, "/testvar", espmega.iot, true,"/testvar/request");
|
||||||
testVar.enableSetValue("/testvar/set");
|
testVar.enableSetValue("/testvar/set");
|
||||||
|
#endif
|
||||||
|
ESP_LOGI("Initializer", "Setup complete");
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
|
@ -232,6 +238,7 @@ void loop()
|
||||||
Serial.println(espmega.iot->mqttConnected() ? "Connected" : "Disconnected");
|
Serial.println(espmega.iot->mqttConnected() ? "Connected" : "Disconnected");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef REMOTE_VARIABLE_ENABLE
|
||||||
// Print out testvar value every 5 seconds
|
// Print out testvar value every 5 seconds
|
||||||
static uint32_t last_testvar_print = 0;
|
static uint32_t last_testvar_print = 0;
|
||||||
if (millis() - last_testvar_print >= 5000)
|
if (millis() - last_testvar_print >= 5000)
|
||||||
|
@ -241,4 +248,5 @@ void loop()
|
||||||
ESP_LOGI("TestVar", "Value: %s", testVar.getValue());
|
ESP_LOGI("TestVar", "Value: %s", testVar.getValue());
|
||||||
testVar.setValue("Hello World");
|
testVar.setValue("Hello World");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
Loading…
Reference in New Issue