mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
fix: move only the tilt of a tilt-only shade for sun and wind
The three places that act on the sun and wind each set different targets for a tilt-only shade: the sun timer moved its lift, the no-sun and wind timers moved tilt and lift, a group's sun flag moved its lift and only a remote's sun flag moved its tilt. They now share sensorTargets(): a tilt-only shade moves its tilt to the favorite tilt (or fully) and back to 0, and every other shade its lift, as Up and Down already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8276c1c3cd
commit
5f26340d06
5 changed files with 83 additions and 37 deletions
|
|
@ -72,6 +72,20 @@ SensorMove ShadeSensors::onSunFlag(bool sunny, bool windy) const {
|
|||
if(!sunny && this->noSunDone) return SensorMove::retract;
|
||||
return SensorMove::none;
|
||||
}
|
||||
SensorTargets sensorTargets(SensorMove move, tilt_types tilt, float myPos, float myTiltPos) {
|
||||
SensorTargets t;
|
||||
if(move == SensorMove::none) return t;
|
||||
const bool extend = move == SensorMove::extend;
|
||||
if(tilt == tilt_types::tiltonly) {
|
||||
t.setTilt = true;
|
||||
t.tilt = extend ? (myTiltPos >= 0 ? myTiltPos : 100.0f) : 0.0f;
|
||||
}
|
||||
else {
|
||||
t.setLift = true;
|
||||
t.lift = extend ? (myPos >= 0 ? myPos : 100.0f) : 0.0f;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
bool ShadeSensors::windBlocksDown(uint32_t now) const {
|
||||
return this->windLast != 0 && now - this->windLast < SOMFY_NO_WIND_REMOTE_TIMEOUT;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue