Add non-linear position estimation for RTS roller shades

Motor speed varies with drum radius as shade material winds/unwinds,
causing linear time-interpolation to misestimate position. Adds two
optional calibration fields (upMidTime, downMidTime) that let users
provide the elapsed time at 50% travel. A logarithmic model (alpha
ratio solved via Newton's method) then replaces the linear formula.
Falls back to existing linear behaviour when mid-time fields are zero.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Frédéric Metrich 2026-07-02 21:51:34 +02:00
parent eb75868adb
commit 769b2ddd7d
4 changed files with 4319 additions and 2879 deletions

13
.gitignore vendored
View file

@ -8,3 +8,16 @@ SomfyController.ino.XIAO_ESP32S3.bin
SomfyController.ino.esp32c3.bin SomfyController.ino.esp32c3.bin
SomfyController.ino.esp32s2.bin SomfyController.ino.esp32s2.bin
.vscode/settings.json .vscode/settings.json
.pio/
.generated_files/
build/
dist/
nbproject/
Makefile*
Package-*
private/
_build/
!cmake/**/user.cmake
cmake/**/.generated/*
cmake/**/CMake*
out/

3635
Somfy.cpp

File diff suppressed because it is too large Load diff

View file

@ -314,6 +314,11 @@ class SomfyShade : public SomfyRemote {
uint32_t upTime = 10000; uint32_t upTime = 10000;
uint32_t downTime = 10000; uint32_t downTime = 10000;
uint32_t tiltTime = 7000; 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
void computeAlphas();
uint16_t stepSize = 100; uint16_t stepSize = 100;
bool save(); bool save();
bool isIdle(); bool isIdle();

File diff suppressed because it is too large Load diff