mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
test: cover the radio queue rules, shade TX state, rolling codes and web command hold
Move the pieces of the radio TX path that don't need FreeRTOS or NVS out of Somfy.cpp and Web.cpp so they build in the native test env: the TX job and event types and job encoding (TxBuffer), the queue rules (TxQueuePolicy.h), a shade's pending radio jobs (ShadeTxState), the next rolling code (RollingCode.h) and the web command queue types (WebCommand.h). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
6a3769406f
commit
1962778912
15 changed files with 912 additions and 186 deletions
|
|
@ -134,17 +134,12 @@ 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.
|
||||
// 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;
|
||||
if(holdWebCommand(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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue