Skip to content

Commit 40a669e

Browse files
committed
feat: esp8266 memory warnnig added.
1 parent 0c1c2da commit 40a669e

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

examples/OTAUpdate/OTAUpdate.ino

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020

2121
// Sketch -> Export Compiled Binary to export
2222

23+
// WARNNING: The ESP8266 chip has limited memory.
24+
// While basic sketches can usually perform OTA updates successfully,
25+
// more complex use cases may cause the update to fail due to memory constraints.
26+
2327
#ifdef ENABLE_DEBUG
2428
#define DEBUG_ESP_PORT Serial
2529
#define NODEBUG_WEBSOCKETS
@@ -116,9 +120,15 @@ void setupWiFi() {
116120
SINRICPRO_PRINTF("connected!\r\n[WiFi]: IP-Address is %s\r\n", WiFi.localIP().toString().c_str());
117121
}
118122

123+
bool onPowerState(const String &deviceId, bool &state) {
124+
SINRICPRO_PRINTF("Device %s turned %s (via SinricPro) \r\n", deviceId.c_str(), state?"on":"off");
125+
return true; // request handled properly
126+
}
127+
119128
// setup function for SinricPro
120129
void setupSinricPro() {
121-
SinricProSwitch& mySwitch = SinricPro[SWITCH_ID];
130+
SinricProSwitch& mySwitch = SinricPro[SWITCH_ID];
131+
mySwitch.onPowerState(onPowerState);
122132

123133
// setup SinricPro
124134
SinricPro.onConnected([]() {

0 commit comments

Comments
 (0)