Add two-phase position estimation for roller shutters with blade tilt

Introduces descendTime and upSlatTime to model the two motion phases:
- Descent (slats unrolling) followed by blade tilt to fully close
- Blade opening followed by ascent when raising

Both fields are user-measured timestamps from the movement start,
making them easy to determine with a stopwatch. alphaDown and alphaUp
are now computed against the pure descent/ascent duration only,
excluding the linear blade-tilt phase at each end.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Frédéric Metrich 2026-07-04 15:20:27 +02:00
parent 46cc4531c5
commit a5f7404b95
3 changed files with 126 additions and 30 deletions

10
Somfy.h
View file

@ -314,10 +314,12 @@ class SomfyShade : public SomfyRemote {
uint32_t upTime = 10000;
uint32_t downTime = 10000;
uint32_t tiltTime = 7000;
uint32_t upMidTime = 0; // Time (ms) from 100% to 50% when opening; 0 = linear
uint32_t downMidTime = 0; // Time (ms) from 0% to 50% when closing; 0 = linear
float alphaUp = 0.0f; // Derived from upMidTime/upTime; 0 = use linear
float alphaDown = 0.0f; // Derived from downMidTime/downTime; 0 = use linear
uint32_t upMidTime = 0; // Timestamp (ms from fully closed) at 50% when opening; 0 = linear
uint32_t downMidTime = 0; // Timestamp (ms from fully open) at 50% when closing; 0 = linear
uint32_t descendTime = 0; // Timestamp (ms from fully open) when slats touch floor, blades expanded; 0 = disabled
uint32_t upSlatTime = 0; // Timestamp (ms from fully closed) when blades are expanded during opening; 0 = disabled
float alphaUp = 0.0f; // Derived from (upMidTime-upSlatTime)/(upTime-upSlatTime); 0 = use linear
float alphaDown = 0.0f; // Derived from downMidTime/descendTime; 0 = use linear
void computeAlphas();
uint16_t stepSize = 100;
bool save();