mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 22:02:17 +01:00
refactor: pin which radio job holds a shade's simulated movement
Review flagged the outer My/Favorite losing to the nested Up/Down it queues. Every such nested send is from a simMy shade, where the Up/Down is what starts the motor, so the behaviour stays. The hold moves into TxHold in ShadeMotion with a comment explaining the order and unit tests pinning it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a212d562cb
commit
0ba5260d1d
5 changed files with 118 additions and 18 deletions
|
|
@ -29,3 +29,13 @@ int8_t displayPosition(float pos, bool flip) {
|
|||
if(pos < 0) return -1;
|
||||
return static_cast<int8_t>(flip && pos >= 0.00f ? floor(100.0f - pos) : floor(pos));
|
||||
}
|
||||
void TxHold::mark(uint32_t jobSeq, bool moving, uint32_t now) {
|
||||
if(jobSeq == 0 || this->seq != 0 || moving) return;
|
||||
this->seq = jobSeq;
|
||||
this->since = now;
|
||||
}
|
||||
bool TxHold::release(uint32_t jobSeq) {
|
||||
if(jobSeq == 0 || jobSeq != this->seq) return false;
|
||||
this->seq = 0;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue