Non-linear position estimation for roller shades/shutters - #671
Open
FredM67 wants to merge 8 commits into
Open
Conversation
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>
Replaced fixed max-width:127px on Up/Down Time and 50% mid-time fields with calc(50% - 10px) / 50% so each pair fills the container width. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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>
moveToTarget() silently dropped commands when pos == currentPos, which prevented position recalibration via slider, MQTT, or Home Assistant when the shade was already at 0% or 100%. Physical end-stops are ground truth — always send the command so the motor can jog to the hard stop and self-correct any position drift. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The four non-linear calibration fields were persisted to NVS and returned via the JSON API but were missing from the binary config file (ShadeConfigFile). Bump SHADE_HDR_VER to 25 and SHADE_REC_SIZE to 320, add read/write for the four fields. Old backups (version ≤ 24) load cleanly with defaults of 0 (linear behaviour). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Documents the drum-radius problem, the four calibration fields (upMidTime, downMidTime, descendTime, upSlatTime), the two-phase shutter model, and the special 1% blade-expanded boundary. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
|
@rstrouse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SHADE_HDR_VER24 → 25,SHADE_REC_SIZE276 → 320); old backups load cleanly with all new fields defaulting to 0 (linear behaviour)Test plan
Closes #644
🤖 Generated with Claude Code