Repository navigation
fix: hall filament width sensor toggle - #1982
pedrolamas merged 1 commit into
Conversation
SET_FILAMENT_SENSOR only toggles runout detection, so also send ENABLE/DISABLE_FILAMENT_WIDTH_SENSOR to start and stop the sensor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Bundle size report (gzip)
119 chunks compared, 21 changed. Sizes are gzip, matching what nginx serves. |
There was a problem hiding this comment.
🟢 Approval recommended
The change is small, scoped to the hall width sensor, consistent with the getRunoutSensors naming and the existing multi-line sendGcode pattern, with no identified defects.
0 open findings
What changed in this PR
This PR is a follow-up to #1981 and fixes the enable/disable switch for [hall_filament_width_sensor] in the Runout Sensors card. Previously the switch only sent SET_FILAMENT_SENSOR, which toggles runout detection but never activates the width sensor itself (Klipper defaults the width sensor to enable: False), so the sensor measured nothing. The fix additionally sends ENABLE_FILAMENT_WIDTH_SENSOR / DISABLE_FILAMENT_WIDTH_SENSOR only for the hall width sensor, keeping runout and width-sensor state in step even on older Klipper versions that don't sync them automatically. Other runout sensors keep their existing behavior.
Changes:
- Refactor
changeSensorto build a list of G-code commands and send them as one\n-joined script. - For
hall_filament_width_sensor, prependENABLE_FILAMENT_WIDTH_SENSOR/DISABLE_FILAMENT_WIDTH_SENSORbeforeSET_FILAMENT_SENSOR.
| File | Description |
|---|---|
| src/components/widgets/runout-sensors/RunoutSensorsCard.vue | Sends the width-sensor enable/disable command alongside SET_FILAMENT_SENSOR for the hall width sensor so the sensor actually starts measuring. |
Notes on correctness (no changes required):
- The literal
'hall_filament_width_sensor'matchesitem.name:getRunoutSensorsderivesnamefrom the last whitespace token of the printer key, and the hall sensor key has no space, sonameis the full'hall_filament_width_sensor'— consistent with the same literal used in the getter's filter (src/store/printer/getters.ts:522). - Multi-line scripts joined by
\nare an established pattern:sendGcodeforwards the raw string toSocketActions.printerGcodeScript, mirroringsendMoveGcode/sendExtrudeGcode(src/mixins/state.ts). - The unchanged first line (
SET_FILAMENT_SENSOR …) comes from #1981 and is out of scope here. - No unit tests exist for components or printer getters in this repo, so this follows the existing (untested) convention.
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Follow-up to #1981.
The switch for
hall_filament_width_sensorin the Runout Sensors card only sentSET_FILAMENT_SENSOR, which toggles runout detection but never starts the width sensor itself. With Klipper's defaultenable: Falsethe sensor stayed inactive, so nothing was measured.The switch now sends
ENABLE_FILAMENT_WIDTH_SENSOR/DISABLE_FILAMENT_WIDTH_SENSORfollowed bySET_FILAMENT_SENSOR, in a single script. Klipper only started syncing the runout state with the width sensor state in April 2026, so sending both keeps them in step on older versions too. Other runout sensors are unchanged.Lint and type-check pass. Not tested against a printer with this sensor.
Resolves #1781
Signed-off-by: Pedro Lamas pedrolamas@gmail.com
🤖 Generated with Claude Code