fix: step a remote's step by the frame's own step size

The step rule read lastFrame.stepSize, which copy() never updates, so a
remote's step moved by whatever step size this shade last sent. It now
reads the frame's step size, 1 when the frame has none. Reconcile Q19 in
SHADE_BEHAVIOUR_PLAN.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cjkas 2026-10-16 22:39:58 +02:00
parent 9e519d4d5f
commit 2cf3c4b542
3 changed files with 22 additions and 13 deletions

View file

@ -661,8 +661,8 @@ void ShadeBehaviour::onFrame(somfy_frame_t &frame, bool internal, uint32_t now)
this->lastFrame.processed = true;
if(this->settings.shadeType == shade_types::drycontact || this->settings.shadeType == shade_types::drycontact2) return;
dir = 0;
if(this->lastFrame.stepSize == 0) this->lastFrame.stepSize = 1;
if(!this->applyStep(-1, this->lastFrame.stepSize)) return;
// The number of steps the frame asks for.
if(!this->applyStep(-1, frame.stepSize == 0 ? 1 : frame.stepSize)) return;
this->emitCommand(cmd, internal ? "internal" : "remote", frame.remoteAddress);
break;
case somfy_commands::StepDown:
@ -670,8 +670,8 @@ void ShadeBehaviour::onFrame(somfy_frame_t &frame, bool internal, uint32_t now)
this->lastFrame.processed = true;
if(this->settings.shadeType == shade_types::drycontact || this->settings.shadeType == shade_types::drycontact2) return;
dir = 1;
if(this->lastFrame.stepSize == 0) this->lastFrame.stepSize = 1;
if(!this->applyStep(1, this->lastFrame.stepSize)) return;
// The number of steps the frame asks for.
if(!this->applyStep(1, frame.stepSize == 0 ? 1 : frame.stepSize)) return;
this->emitCommand(cmd, internal ? "internal" : "remote", frame.remoteAddress);
break;
case somfy_commands::Toggle: