mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-16 04:12:13 +01:00
Follow-on logic fixes due to switch from "My" to "Stop"
This commit is contained in:
parent
f3e7dd5a9e
commit
b91763ca5c
1 changed files with 23 additions and 6 deletions
21
Somfy.cpp
21
Somfy.cpp
|
|
@ -2540,8 +2540,10 @@ void SomfyShade::processFrame(somfy_frame_t &frame, bool internal) {
|
||||||
case somfy_commands::Stop:
|
case somfy_commands::Stop:
|
||||||
if(this->lastFrame.processed) return;
|
if(this->lastFrame.processed) return;
|
||||||
this->lastFrame.processed = true;
|
this->lastFrame.processed = true;
|
||||||
|
if(!internal) {
|
||||||
this->p_target(this->currentPos);
|
this->p_target(this->currentPos);
|
||||||
this->p_tiltTarget(this->currentTiltPos);
|
this->p_tiltTarget(this->currentTiltPos);
|
||||||
|
}
|
||||||
this->emitCommand(cmd, internal ? "internal" : "remote", frame.remoteAddress);
|
this->emitCommand(cmd, internal ? "internal" : "remote", frame.remoteAddress);
|
||||||
break;
|
break;
|
||||||
case somfy_commands::Favorite:
|
case somfy_commands::Favorite:
|
||||||
|
|
@ -2630,6 +2632,13 @@ void SomfyShade::processInternalCommand(somfy_commands cmd, uint8_t repeat) {
|
||||||
this->p_tiltTarget(this->currentTiltPos);
|
this->p_tiltTarget(this->currentTiltPos);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case somfy_commands::Stop:
|
||||||
|
if(this->tiltType == tilt_types::tiltonly) {
|
||||||
|
this->p_target(100.0f);
|
||||||
|
}
|
||||||
|
else this->p_target(this->currentPos);
|
||||||
|
this->p_tiltTarget(this->currentTiltPos);
|
||||||
|
break;
|
||||||
case somfy_commands::StepUp:
|
case somfy_commands::StepUp:
|
||||||
// With the step commands and integrated shades
|
// With the step commands and integrated shades
|
||||||
// the motor must tilt in the direction first then move
|
// the motor must tilt in the direction first then move
|
||||||
|
|
@ -2944,8 +2953,16 @@ void SomfyShade::sendCommand(somfy_commands cmd, uint8_t repeat, uint8_t stepSiz
|
||||||
if(this->tiltType != tilt_types::tiltonly) this->p_target(this->currentPos);
|
if(this->tiltType != tilt_types::tiltonly) this->p_target(this->currentPos);
|
||||||
this->p_tiltTarget(this->currentTiltPos);
|
this->p_tiltTarget(this->currentTiltPos);
|
||||||
}
|
}
|
||||||
|
} else if(cmd == somfy_commands::Stop) {
|
||||||
|
if(this->isToggle() || this->shadeType == shade_types::drycontact)
|
||||||
|
SomfyRemote::sendCommand(cmd, repeat);
|
||||||
|
else if(this->shadeType == shade_types::drycontact2) return;
|
||||||
|
else {
|
||||||
|
SomfyRemote::sendCommand(cmd, repeat);
|
||||||
|
if(this->tiltType != tilt_types::tiltonly) this->p_target(this->currentPos);
|
||||||
|
this->p_tiltTarget(this->currentTiltPos);
|
||||||
}
|
}
|
||||||
else if(cmd == somfy_commands::Toggle) {
|
} else if(cmd == somfy_commands::Toggle) {
|
||||||
if(this->bitLength != 80) SomfyRemote::sendCommand(somfy_commands::My, repeat, stepSize);
|
if(this->bitLength != 80) SomfyRemote::sendCommand(somfy_commands::My, repeat, stepSize);
|
||||||
else SomfyRemote::sendCommand(somfy_commands::Toggle, repeat);
|
else SomfyRemote::sendCommand(somfy_commands::Toggle, repeat);
|
||||||
}
|
}
|
||||||
|
|
@ -2999,7 +3016,7 @@ void SomfyShade::sendTiltCommand(somfy_commands cmd) {
|
||||||
SomfyRemote::sendCommand(cmd, this->tiltType == tilt_types::tiltmotor ? TILT_REPEATS : this->repeats);
|
SomfyRemote::sendCommand(cmd, this->tiltType == tilt_types::tiltmotor ? TILT_REPEATS : this->repeats);
|
||||||
this->p_tiltTarget(100.0f);
|
this->p_tiltTarget(100.0f);
|
||||||
}
|
}
|
||||||
else if(cmd == somfy_commands::My) {
|
else if(cmd == somfy_commands::My || cmd == somfy_commands::Stop) {
|
||||||
SomfyRemote::sendCommand(cmd, this->tiltType == tilt_types::tiltmotor ? TILT_REPEATS : this->repeats);
|
SomfyRemote::sendCommand(cmd, this->tiltType == tilt_types::tiltmotor ? TILT_REPEATS : this->repeats);
|
||||||
this->p_tiltTarget(this->currentTiltPos);
|
this->p_tiltTarget(this->currentTiltPos);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue