mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
fix: don't hold position updates back while the radio is full
processQueue stopped draining web commands whenever the radio queue was near full, including set_positions, which never transmits. Look at the command at the head and only hold it back if it needs the radio, keeping the commands in order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ab0eba2035
commit
a49fa5d953
1 changed files with 7 additions and 2 deletions
|
|
@ -134,14 +134,19 @@ bool Web::queueCommand(const web_command_t &cmd) {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
// Only setting positions never goes on air.
|
||||
static bool usesRadio(web_cmd_t type) { return type != web_cmd_t::set_positions; }
|
||||
void Web::processQueue() {
|
||||
if(!webCmdQueue) return;
|
||||
web_command_t cmd;
|
||||
// The client was already told the command was accepted so leave it queued
|
||||
// until the radio has room rather than have the radio drop it. While TX is
|
||||
// suspended nothing gets through anyway so don't hold anything back then.
|
||||
while((somfy.transceiver.txSuspended() || somfy.transceiver.txHasRoom()) &&
|
||||
xQueueReceive(webCmdQueue, &cmd, 0) == pdTRUE) {
|
||||
// Commands run in order, so only the one at the head can be held back.
|
||||
while(xQueuePeek(webCmdQueue, &cmd, 0) == pdTRUE) {
|
||||
if(usesRadio(cmd.type) && !somfy.transceiver.txSuspended() && !somfy.transceiver.txHasRoom()) break;
|
||||
// loop() is the only consumer so this is the command we peeked.
|
||||
xQueueReceive(webCmdQueue, &cmd, 0);
|
||||
bool sent = true;
|
||||
switch(cmd.type) {
|
||||
case web_cmd_t::shade_command: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue