mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 22:02:17 +01:00
fix: default a set-favorite request's tilt to the favorite tilt
/setMyPosition filled in a missing tilt with the lift favorite, so a request without a tilt set the favorite tilt to the lift's. It also took the stored position as a display one, which flipped it twice on a shade with flipPosition. requestedFavoriteTilt() now gives the favorite tilt as displayed. Home Assistant never calls /setMyPosition and the web UI always sends a tilt, so only other API callers see the change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
377a1217a6
commit
1128431e8c
5 changed files with 34 additions and 17 deletions
|
|
@ -29,6 +29,11 @@ int8_t displayPosition(float pos, bool flip) {
|
|||
if(pos < 0) return -1;
|
||||
return static_cast<int8_t>(flip && pos >= 0.00f ? floor(100.0f - pos) : floor(pos));
|
||||
}
|
||||
int8_t requestedFavoriteTilt(int8_t requestTilt, tilt_types tilt, float myTiltPos, bool flip) {
|
||||
if(tilt == tilt_types::none) return -1;
|
||||
if(requestTilt >= 0) return requestTilt;
|
||||
return displayPosition(myTiltPos, flip);
|
||||
}
|
||||
float limitTarget(int8_t dir) { return dir > 0 ? 100.0f : 0.0f; }
|
||||
bool stepPosition(float pos, int8_t dir, uint32_t travelMs, uint16_t stepSize, uint8_t frameStepSize, float &out) {
|
||||
if(travelMs == 0 || stepSize == 0) return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue