mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-11-01 22:32:13 +01:00
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>
16 lines
641 B
C++
16 lines
641 B
C++
#ifndef ROLLING_CODE_H
|
|
#define ROLLING_CODE_H
|
|
#include <stdint.h>
|
|
|
|
// Working out a remote's next rolling code (src/Somfy.cpp). Kept free of NVS
|
|
// so it can be unit tested on the PC (pio test -e native).
|
|
|
|
// The code the next frame uses. It is only read here and consumed once the
|
|
// frame using it has been queued. synced says last matches what is stored for
|
|
// this address, so the store is only read through loadStored until a code has
|
|
// been written.
|
|
template<typename LoadStored>
|
|
inline uint16_t nextRollingCode(bool synced, uint16_t last, LoadStored loadStored) {
|
|
return (uint16_t)((synced ? last : loadStored()) + 1);
|
|
}
|
|
#endif
|