Skip to content

v2.8.0 — manual homing, StallGuard opt-in, friendly Motion Tuning - #36

Merged
daniel-frenkel merged 2 commits into
mainfrom
feat/stallguard-optional
Jul 22, 2026
Merged

daniel-frenkel merged 2 commits into
mainfrom
feat/stallguard-optional

Conversation

@daniel-frenkel

Copy link
Copy Markdown
Member

Summary

Makes the Ropener usable without StallGuard tuning and hides the hard parts behind an advanced group. Supersedes #35 (includes its Tier1 TCOOLTHRS-from-Speed commit).

Homing (safety-critical)

  • Default homing is manual via the existing Start-Stop button: drives closed at Speed 3000 (home_start); a second press at the closed end sets home (home_finish). No chip stall required.
  • 60 s abort timeout (home_timeout → home_abort) guards against an accidental press — stops and holds at the current position without setting a new zero.
  • Button-1 ×7 gesture rerouted to home_start.

StallGuard demoted to opt-in

  • New StallGuard Enabled switch, default OFF. on_stall is gated on it, so a shipped unit never reacts to a chip stall unless a power user opts in.
  • Indicator reports "Disabled" when off.

UI reorg

  • Motion Tuning moved directly under Setup (new group_tuning, weight 22).
  • Friendly Motor Current (mA) drives IRUN via the driver's own conversion; raw IRUN → advanced.
  • Speed preset select (Slow/Medium/Fast = 1500/5000/9000); raw Speed slider → advanced.
  • StallGuard group (raw registers, SG_RESULT, TSTEP) moved to the bottom as "StallGuard (experimental)".

Verification

  • esphome config valid; entity + behavioral regression gates clean.
  • Flashed to bench curtain unit; layout confirmed on hardware.
  • ⏳ Homing on real hardware to be confirmed before tagging/marking latest.

🤖 Generated with Claude Code

daniel-frenkel and others added 2 commits July 21, 2026 15:11
…rming

StallGuard only reports while TSTEP <= TCOOLTHRS, and TSTEP is inversely
proportional to velocity. Measured on VAL3000 hardware (microsteps=8), within
1% from Speed 3000 to 9000 under real curtain load:

    TSTEP ~= 374000 / Speed

So the shipped default TCOOLTHRS=100 arms only above Speed ~3740. Below that
StallGuard is switched off entirely -- no error, no log line, nothing in the UI
-- and sensorless homing simply never completes. A customer reaches that state
just by dragging the Speed slider down for a quieter curtain. It is also what
made a bench unit at Speed 1500 look broken while the same firmware worked at
9000.

Two changes:

* recompute_tcoolthrs derives TCOOLTHRS = 748000 / Speed, on boot and whenever
  Speed changes. 2x cruise TSTEP arms from half of cruise speed upward at any
  Speed, preserving the deliberate low-velocity cutoff (SG_RESULT is unreliable
  when slow -- that is what TCOOLTHRS is for) while guaranteeing it engages at
  all. Hooked via !extend on num_speed, which APPENDS, so core still stores
  global_speed and pushes the speed to the driver first; verified against the
  resolved config.

* A "StallGuard" diagnostic text_sensor reporting Armed / Below threshold /
  Ready (stopped) / "Never arms at this Speed". The last is diagnosed from the
  configured Speed rather than live TSTEP, so a misconfiguration is visible
  while the curtain is standing still instead of being discovered when homing
  silently fails. "Below threshold" during acceleration is normal and expected.

Verified on the installed curtain unit over OTA: at Speed 9000 TCOOLTHRS
auto-derives to 83 (was a hand-set 100); setting Speed 1500 moves it to 498,
which is the configuration that was previously dead.

Gates: 1 entity added (StallGuard, diagnostic), 0 removed. Behaviour diff shows
only on_boot 400, num_speed set_action (appended, core actions intact), and the
two new bodies. Compiles clean.

Does not change SGTHRS, which depends on installed load and remains manual --
that is the calibration wizard, still to come.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…otion Tuning

Make the Ropener usable without StallGuard tuning, and hide the hard parts.

Homing (safety-critical):
- Default homing is now manual via the existing Start-Stop button. It drives
  closed at Speed 3000 (home_start), and a second press at the closed end sets
  home (home_finish). No chip stall is required.
- 60 s abort timeout (home_timeout -> home_abort) protects against an accidental
  press: it stops and holds at the current position WITHOUT setting a new zero.
- Button-1 x7 gesture rerouted to home_start.

StallGuard demoted to opt-in:
- New "StallGuard Enabled" switch, default OFF. on_stall is gated on it, so a
  shipped unit never reacts to a chip stall unless a power user turns it on.
- StallGuard indicator reports "Disabled" when the switch is off.

UI reorg for the average user:
- Motion Tuning moved directly under Setup (new group_tuning at weight 22).
- Friendly "Motor Current" (mA) in Motion Tuning drives IRUN via the driver's
  own mA<->register conversion; raw IRUN register moved to advanced.
- Speed preset select (Slow/Medium/Fast = 1500/5000/9000) in Motion Tuning;
  raw Speed slider moved to advanced.
- StallGuard group (raw SGTHRS/TCOOLTHRS/IRUN/Speed, SG_RESULT, TSTEP) moved to
  the very bottom as "StallGuard (experimental)".

Builds on the Tier1 TCOOLTHRS-from-Speed derivation. Supersedes PR #35.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@daniel-frenkel
daniel-frenkel merged commit 8b4b9e7 into main Jul 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant