mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
refactor: move the shade's behaviour into ShadeBehaviour
PR B of SHADE_BEHAVIOUR_PLAN.md. What a shade does with frames, commands, group commands and radio events moves unchanged from SomfyShade into ShadeBehaviour, which builds natively and is pinned by test_shadebehaviour. ShadeBehaviour reads ShadeSettings and RemoteSettings, gets the time on every input, and holds the motion state that other files now read through state(). It sends through MotorLink and reports through ShadeEvents (changes, commands, save wanted, sensor flags) as things happen. SomfyShade wraps it: its MotorLink is SomfyRemote::sendCommandAfter, which now leaves the sender out of the echo and radio hold because the module hears its own frame. lastFrame stays shared with the send path. ConfigFile writes through restore() and clearTilt(), SomfyShadeOps through setPosition(). The pinning tests label where the copies of a rule disagree "today:", for the reconcile phase. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fa7aaf0d49
commit
4f8eac03ac
18 changed files with 2182 additions and 1343 deletions
|
|
@ -12,9 +12,9 @@ bool SomfyShadeOps::findShade(uint8_t shadeId, shade_info_t &info) {
|
|||
info.tiltType = shade->tiltType;
|
||||
info.repeats = shade->repeats;
|
||||
info.bitLength = shade->bitLength;
|
||||
info.currentPos = shade->currentPos;
|
||||
info.myPos = shade->myPos;
|
||||
info.myTiltPos = shade->myTiltPos;
|
||||
info.currentPos = shade->state().currentPos;
|
||||
info.myPos = shade->state().myPos;
|
||||
info.myTiltPos = shade->state().myTiltPos;
|
||||
return true;
|
||||
}
|
||||
bool SomfyShadeOps::findGroup(uint8_t groupId, uint8_t &repeats) {
|
||||
|
|
@ -40,15 +40,7 @@ bool SomfyShadeOps::sendSensorCommand(uint8_t shadeId, int8_t windy, int8_t sunn
|
|||
bool SomfyShadeOps::setMyPosition(uint8_t shadeId, int8_t pos, int8_t tilt) { return somfy.getShadeById(shadeId)->setMyPosition(pos, tilt); }
|
||||
void SomfyShadeOps::setPositions(uint8_t shadeId, float pos, float tilt) {
|
||||
SomfyShade *shade = somfy.getShadeById(shadeId);
|
||||
// Through the setters, so MQTT hears about it too.
|
||||
if(pos >= 0.0f) {
|
||||
shade->p_target(pos);
|
||||
shade->p_currentPos(pos);
|
||||
}
|
||||
if(tilt >= 0.0f) {
|
||||
shade->p_tiltTarget(tilt);
|
||||
shade->p_currentTiltPos(tilt);
|
||||
}
|
||||
shade->setPosition(pos, tilt);
|
||||
shade->emitState();
|
||||
}
|
||||
void SomfyShadeOps::setUnpaired(uint8_t shadeId) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue