diff --git a/Network.cpp b/Network.cpp index 56e5547..0eeee2d 100644 --- a/Network.cpp +++ b/Network.cpp @@ -216,9 +216,10 @@ bool Network::connectWired() { if(!this->ethStarted) { this->ethStarted = true; WiFi.mode(WIFI_OFF); - if(!settings.IP.dhcp) + if(!settings.IP.dhcp) { if(!ETH.config(settings.IP.ip, settings.IP.gateway, settings.IP.subnet, settings.IP.dns1, settings.IP.dns2)) ETH.config(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE); + } else ETH.config(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE); WiFi.onEvent(this->networkEvent); @@ -271,9 +272,10 @@ bool Network::connectWiFi() { this->connectStart = millis(); Serial.print("Set hostname to:"); Serial.println(WiFi.getHostname()); - if(!settings.IP.dhcp) + if(!settings.IP.dhcp) { if(!WiFi.config(settings.IP.ip, settings.IP.gateway, settings.IP.subnet, settings.IP.dns1, settings.IP.dns2)) WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE); + } else WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE); WiFi.setSleep(false); diff --git a/Somfy.cpp b/Somfy.cpp index b601119..5aab300 100644 --- a/Somfy.cpp +++ b/Somfy.cpp @@ -1466,11 +1466,19 @@ void SomfyShade::processFrame(somfy_frame_t &frame, bool internal) { this->emitState(); } break; - + case somfy_commands::Prog: + case somfy_commands::MyUp: + case somfy_commands::MyDown: + case somfy_commands::MyUpDown: + case somfy_commands::UpDown: + this->emitCommand(cmd, internal ? "internal" : "remote", frame.remoteAddress); + break; + case somfy_commands::Flag: this->flags &= ~(static_cast(somfy_flags_t::SunFlag)); somfy.isDirty = true; this->emitState(); + this->emitCommand(cmd, internal ? "internal" : "remote", frame.remoteAddress); break; case somfy_commands::SunFlag: { @@ -1486,6 +1494,7 @@ void SomfyShade::processFrame(somfy_frame_t &frame, bool internal) { } somfy.isDirty = true; this->emitState(); + this->emitCommand(cmd, internal ? "internal" : "remote", frame.remoteAddress); } break; case somfy_commands::Up: diff --git a/SomfyController.ino b/SomfyController.ino index baac1c8..f4e4db6 100644 --- a/SomfyController.ino +++ b/SomfyController.ino @@ -36,7 +36,12 @@ void setup() { void loop() { // put your main code here, to run repeatedly: - if(rebootDelay.reboot && millis() > rebootDelay.rebootTime) ESP.restart(); + if(rebootDelay.reboot && millis() > rebootDelay.rebootTime) { + Serial.print("Rebooting after "); + Serial.print(rebootDelay.rebootTime); + Serial.println("ms"); + ESP.restart(); + } net.loop(); somfy.loop(); if(net.connected()) { diff --git a/SomfyController.ino.esp32.bin b/SomfyController.ino.esp32.bin index f58c463..1f2fe1b 100644 Binary files a/SomfyController.ino.esp32.bin and b/SomfyController.ino.esp32.bin differ diff --git a/Web.cpp b/Web.cpp index d3f5928..fe1dd7a 100644 --- a/Web.cpp +++ b/Web.cpp @@ -1684,6 +1684,7 @@ void Web::begin() { }); server.on("/updateFirmware", HTTP_POST, []() { webServer.sendCORSHeaders(); + somfy.transceiver.end(); // Shut down the radio so we do not get any interrupts during this process. if(server.method() == HTTP_OPTIONS) { server.send(200, "OK"); return; } if (Update.hasError()) server.send(500, _encoding_json, "{\"status\":\"ERROR\",\"desc\":\"Error updating firmware: \"}"); @@ -1740,6 +1741,7 @@ void Web::begin() { }); server.on("/updateApplication", HTTP_POST, []() { webServer.sendCORSHeaders(); + somfy.transceiver.end(); // Shut down the radio so we do not get any interrupts during this process. if(server.method() == HTTP_OPTIONS) { server.send(200, "OK"); return; } server.sendHeader("Connection", "close"); server.send(200, _encoding_json, "{\"status\":\"ERROR\",\"desc\":\"Updating Application: \"}");