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:
cjkas 2026-10-13 21:14:20 +02:00
parent 8276c1c3cd
commit 5f26340d06
5 changed files with 83 additions and 37 deletions

View file

@ -1,6 +1,7 @@
#ifndef SHADE_SENSORS_H
#define SHADE_SENSORS_H
#include <stdint.h>
#include "ShadeTypes.h"
// Sun and wind automation for a shade with a sun sensor. Kept free of the
// shade, radio and network so it can be unit tested on the PC
@ -49,4 +50,14 @@ struct ShadeSensors {
// Whether a remote Down is ignored because the sensor reported wind lately.
bool windBlocksDown(uint32_t now) const;
};
// The targets a sensor move sets. A tilt-only shade only moves its tilt and
// every other shade only its lift, as Up and Down do.
struct SensorTargets {
bool setLift = false;
float lift = 0.0f;
bool setTilt = false;
float tilt = 0.0f;
};
// myPos and myTiltPos are the favorite, -1 when there is none.
SensorTargets sensorTargets(SensorMove move, tilt_types tilt, float myPos, float myTiltPos);
#endif