diff --git a/ConfigFile.cpp b/ConfigFile.cpp index 4277658..6d6eb8e 100644 --- a/ConfigFile.cpp +++ b/ConfigFile.cpp @@ -7,10 +7,10 @@ extern Preferences pref; -#define SHADE_HDR_VER 17 +#define SHADE_HDR_VER 18 #define SHADE_HDR_SIZE 56 #define SHADE_REC_SIZE 272 -#define GROUP_REC_SIZE 184 +#define GROUP_REC_SIZE 190 #define TRANS_REC_SIZE 74 extern ConfigSettings settings; @@ -597,6 +597,7 @@ bool ShadeConfigFile::readGroupRecord(SomfyGroup *group) { if(group->getGroupId() == 255) group->clear(); else group->compressLinkedShadeIds(); + if(this->header.version >= 18) group->flipCommands = this->readBool(false); pref.end(); if(this->file.position() != startPos + this->header.groupRecordSize) { Serial.println("Reading to end of group record"); @@ -738,7 +739,8 @@ bool ShadeConfigFile::writeGroupRecord(SomfyGroup *group) { this->writeUInt8(group->linkedShades[j]); } this->writeUInt8(group->repeats); - this->writeUInt8(group->sortOrder, CFG_REC_END); + this->writeUInt8(group->sortOrder); + this->writeBool(group->flipCommands, CFG_REC_END); return true; } bool ShadeConfigFile::writeShadeRecord(SomfyShade *shade) { diff --git a/ConfigSettings.h b/ConfigSettings.h index 4a60a9d..12fcb83 100644 --- a/ConfigSettings.h +++ b/ConfigSettings.h @@ -3,7 +3,7 @@ #ifndef configsettings_h #define configsettings_h -#define FW_VERSION "v2.3.0" +#define FW_VERSION "v2.3.1" enum DeviceStatus { DS_OK = 0, DS_ERROR = 1, diff --git a/GitOTA.cpp b/GitOTA.cpp index 38ff1f9..1bb4f7c 100644 --- a/GitOTA.cpp +++ b/GitOTA.cpp @@ -375,6 +375,7 @@ bool GitUpdater::beginUpdate(const char *version) { this->error = this->downloadFile(); if(this->error == 0) { settings.fwVersion.parse(version); + delay(100); Serial.println("Committing Configuration..."); somfy.commit(); rebootDelay.reboot = true; @@ -415,6 +416,7 @@ int8_t GitUpdater::downloadFile() { uint8_t *buff = (uint8_t *)malloc(MAX_BUFF_SIZE); if(buff) { this->emitDownloadProgress(len, total); + int timeouts = 0; while(https.connected() && (len > 0 || len == -1) && total < len) { size_t size = stream->available(); if(size) { @@ -453,6 +455,19 @@ int8_t GitUpdater::downloadFile() { https.end(); } } + else { + timeouts++; + if(timeouts >= 300) { + Update.abort(); + https.end(); + free(buff); + Serial.println("Stream timeout!!!"); + return -43; + } + sockEmit.loop(); + webServer.loop(); + delay(100); + } } free(buff); if(len > total) { diff --git a/Somfy.cpp b/Somfy.cpp index b2b814f..470b831 100644 --- a/Somfy.cpp +++ b/Somfy.cpp @@ -1469,6 +1469,7 @@ void SomfyGroup::publishState() { if(mqtt.connected()) { this->publish("direction", this->direction, true); this->publish("lastRollingCode", this->lastRollingCode, true); + this->publish("flipCommands", this->flipCommands, true); const uint8_t sunFlag = !!(this->flags & static_cast(somfy_flags_t::SunFlag)); const uint8_t isSunny = !!(this->flags & static_cast(somfy_flags_t::Sunny)); const uint8_t isWindy = !!(this->flags & static_cast(somfy_flags_t::Windy)); @@ -1524,6 +1525,7 @@ void SomfyGroup::unpublish(uint8_t id) { SomfyGroup::unpublish(id, "lastRollingCode"); SomfyGroup::unpublish(id, "flags"); SomfyGroup::unpublish(id, "SunSensor"); + SomfyGroup::unpublish(id, "flipCommands"); } } void SomfyGroup::unpublish(uint8_t id, const char *topic) { @@ -3002,6 +3004,8 @@ bool SomfyGroup::fromJSON(JsonObject &obj) { if(obj.containsKey("remoteAddress")) this->setRemoteAddress(obj["remoteAddress"]); if(obj.containsKey("bitLength")) this->bitLength = obj["bitLength"]; if(obj.containsKey("proto")) this->proto = static_cast(obj["proto"].as()); + if(obj.containsKey("flipCommands")) this->flipCommands = obj["flipCommands"].as(); + //if(obj.containsKey("sunSensor")) this->hasSunSensor() = obj["sunSensor"]; This is calculated if(obj.containsKey("repeats")) this->repeats = obj["repeats"]; if(obj.containsKey("linkedShades")) { @@ -3024,6 +3028,7 @@ bool SomfyGroup::toJSON(JsonObject &obj) { obj["bitLength"] = this->bitLength; obj["proto"] = static_cast(this->proto); obj["sunSensor"] = this->hasSunSensor(); + obj["flipCommands"] = this->flipCommands; obj["flags"] = this->flags; obj["repeats"] = this->repeats; obj["sortOrder"] = this->sortOrder; diff --git a/SomfyController.ino.esp32.bin b/SomfyController.ino.esp32.bin index c04dd1e..87ab44d 100644 Binary files a/SomfyController.ino.esp32.bin and b/SomfyController.ino.esp32.bin differ diff --git a/SomfyController.ino.esp32s3.bin b/SomfyController.ino.esp32s3.bin index 03e282c..d87a790 100644 Binary files a/SomfyController.ino.esp32s3.bin and b/SomfyController.ino.esp32s3.bin differ diff --git a/data/appversion b/data/appversion index cc6612c..a625450 100644 --- a/data/appversion +++ b/data/appversion @@ -1 +1 @@ -2.3.0 \ No newline at end of file +2.3.1 \ No newline at end of file diff --git a/data/index.html b/data/index.html index c5b1c38..6a10fbf 100644 --- a/data/index.html +++ b/data/index.html @@ -3,11 +3,11 @@ - - - + + + - +
@@ -554,6 +554,13 @@
+
+
+ + +
+
+