mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 22:02:17 +01:00
fix: deletes send their removal after the reply; test_reboot waits for the restart
- shadeRemoved, groupRemoved and roomRemoved went out from the deletes, before the edit's reply. They now come from editChanges and go out with the edit's other events, after it (test_adding_and_deleting_a_room). - test_reboot reconnected in the moment between the sockets closing and the restart, and waited for a hello that never came. It now waits, retries a connect without hello, and checks the uptime went back. e2e on the device (esp32s3dbg): 72 passed, 3 skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
17bb571635
commit
2c815d30f1
7 changed files with 53 additions and 20 deletions
|
|
@ -31,10 +31,9 @@ edit_changes_t editChanges(model_edit_type_t type, const edit_result_t &result)
|
|||
case model_edit_type_t::unlink_repeater:
|
||||
c.repeaters = true;
|
||||
break;
|
||||
case model_edit_type_t::delete_room:
|
||||
case model_edit_type_t::delete_shade:
|
||||
case model_edit_type_t::delete_group:
|
||||
break;
|
||||
case model_edit_type_t::delete_room: c.removedRoomId = result.id; break;
|
||||
case model_edit_type_t::delete_shade: c.removedShadeId = result.id; break;
|
||||
case model_edit_type_t::delete_group: c.removedGroupId = result.id; break;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,10 @@ struct edit_changes_t {
|
|||
uint8_t roomId = 0;
|
||||
sort_list_t order = sort_list_t::none;
|
||||
bool repeaters = false;
|
||||
// A delete: the id of what was removed.
|
||||
uint8_t removedShadeId = 0;
|
||||
uint8_t removedGroupId = 0;
|
||||
uint8_t removedRoomId = 0;
|
||||
};
|
||||
edit_changes_t editChanges(model_edit_type_t type, const edit_result_t &result);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#include "ConfigFile.h"
|
||||
#include "ModelEditor.h"
|
||||
#include "ShadeChanges.h"
|
||||
#include "outputs/ProtoSocket.h"
|
||||
|
||||
static const char *TAG = "Somfy";
|
||||
|
||||
|
|
@ -291,7 +290,6 @@ bool SomfyShadeController::deleteShade(uint8_t shadeId) {
|
|||
for(uint8_t i = 0; i < SOMFY_MAX_SHADES; i++) {
|
||||
if(this->shades[i].getShadeId() == shadeId) {
|
||||
shades[i].emitState("shadeRemoved");
|
||||
protoSocket.shadeRemoved(shadeId);
|
||||
shades[i].unpublish();
|
||||
this->shades[i].clear();
|
||||
}
|
||||
|
|
@ -322,7 +320,6 @@ bool SomfyShadeController::deleteRoom(uint8_t roomId) {
|
|||
}
|
||||
}
|
||||
rooms[i].emitState("roomRemoved");
|
||||
protoSocket.roomRemoved(roomId);
|
||||
this->rooms[i].clear();
|
||||
}
|
||||
}
|
||||
|
|
@ -338,7 +335,6 @@ bool SomfyShadeController::deleteGroup(uint8_t groupId) {
|
|||
if(shade) shade->configChanged();
|
||||
}
|
||||
groups[i].emitState("groupRemoved");
|
||||
protoSocket.groupRemoved(groupId);
|
||||
groups[i].unpublish();
|
||||
this->groups[i].clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -262,6 +262,9 @@ static void markEdited(const model_edit_t &edit, const edit_result_t &result) {
|
|||
if(room) protoSocket.room(*room);
|
||||
if(c.order != sort_list_t::none) protoSocket.order(c.order);
|
||||
if(c.repeaters) protoSocket.repeaters();
|
||||
if(c.removedShadeId) protoSocket.shadeRemoved(c.removedShadeId);
|
||||
if(c.removedGroupId) protoSocket.groupRemoved(c.removedGroupId);
|
||||
if(c.removedRoomId) protoSocket.roomRemoved(c.removedRoomId);
|
||||
}
|
||||
void runModelEdit(model_edit_t *edit) {
|
||||
const edit_result_t result = applyModelEdit(*edit);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue