mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-11-21 00:02:12 +01:00
feat: command ops for socket protocol 2
shadeCommand, groupCommand, tiltCommand, repeatCommand, setPositions, setSensor, setMyPosition, unpairShade, setRollingCode (types 16-24) are read on async_tcp by ProtoOps and handed to loop() through the LoopQueue, which replies once the request has run: ok, not found or radio unavailable. A bad payload, a paused radio or a full queue is answered straight away. sendRemoteCommand (25) touches nothing of the shade model, so it goes to the radio from async_tcp like its route. ShadeRequests::run() now says how a request went, not only whether the radio took it. An op reads only the fields that were sent, so setPositions can leave the tilt as it is. The shadeCommand event is renamed shadeCommanded, since the op has the route's name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9fe05105ff
commit
0b54264ee3
18 changed files with 812 additions and 50 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include "SomfySnapshot.h"
|
||||
#include "SomfyEditor.h"
|
||||
#include "Utils.h"
|
||||
#include "outputs/ProtoSocket.h"
|
||||
|
||||
static const char *TAG = "LoopQueue";
|
||||
|
||||
|
|
@ -50,10 +51,13 @@ void LoopQueue::drain() {
|
|||
// loop() is the only consumer so this is the item we peeked.
|
||||
xQueueReceive(q, &item, 0);
|
||||
switch(item.type) {
|
||||
case loop_item_type_t::shade_request:
|
||||
if(!shadeRequests.run(item.request))
|
||||
case loop_item_type_t::shade_request: {
|
||||
const shade_request_result_t result = shadeRequests.run(item.request);
|
||||
if(result == shade_request_result_t::radio_refused)
|
||||
ESP_LOGW(TAG, "Radio didn't take shade request %u", static_cast<uint8_t>(item.request.type));
|
||||
if(item.replyClient) protoSocket.replyRequest(item.replyClient, item.replyId, item.request, result);
|
||||
break;
|
||||
}
|
||||
case loop_item_type_t::restore_shades: {
|
||||
restore_options_t opts = restoreOptions(item.restoreParts);
|
||||
const bool restored = ShadeConfigFile::restore(&somfy, "/shades.tmp", opts);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue