GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bugfix: split fan/speed slider callbacks to fix gcode dispatch collision by gmmcosta15 · Pull Request #212 · BlocksTechnology/BlocksScreen

Conversation

@gmmcosta15

@gmmcosta15 gmmcosta15 commented Apr 13, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator
  • Feature
  • Bug fix
  • Code refactor
  • Documentation

Description

  • controlTab.on_slider_change / tunePage.on_slider_change: now dispatch the correct gcode per fan object type -> M106 S{0–255} for [fan], SET_FAN_SPEED FAN={name} SPEED={0.0–1.0} for [fan_generic]
  • tunePage: add _on_speed_slider_change for print speed (M220); speed slider routed there, fan slider to on_slider_change
  • Fixed M106 S-value calculation: round(percent * 255 / 100) avoids float imprecision at 50% duty cycle
  • Extracted shared fan gcode logic to lib/utils/gcode.py::fan_speed_gcode() — removes duplication between controlTab and tunePage
  • Removed unused from helper_methods import normalize from both files
  • Fixed RUF012: mutable class-level dict defaults moved to init in ControlTab and TuneWidget
  • Fixed SIM910, RUF046, E501 violations in controlTab.py
  • Added contextlib.suppress disconnect guards for slider and numpad signals

Motivation

When a fan_generic was named "speed", both controlTab and tunePage would dispatch conflicting gcodes (SET_FAN_SPEED and M220) on the same slider event. Additionally, [fan] objects require M106 not SET_FAN_SPEED, and the previous code used M220 (feedrate override) on the fan path entirely. Splitting the callbacks and centralising gcode generation eliminates the collision and ensures the correct command is always sent regardless of fan type or name

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gmmcosta15
gmmcosta15 requested a review from HugoCLSC April 13, 2026 17:11
@gmmcosta15 gmmcosta15 self-assigned this Apr 13, 2026
@gmmcosta15 gmmcosta15 mentioned this pull request Apr 13, 2026
bugfix: resolve 40+ crashes, threading races, and Klipper protocol issues #200
Closed
1 of 4 tasks
HugoCLSC
HugoCLSC previously requested changes Apr 28, 2026
View reviewed changes

@HugoCLSC HugoCLSC left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs more work.

There is no reason whatsoever where the slider should only emit a gcode for fan speed changes on objects that are [fan_generic]. Normal fans [fan] should have their speed changed using the slider as well.
So the slider needs to emit the appropriate gcode according to the fan object declaration.

Second thing, the gcode command M220 has nothing to do with fan speeds, that command sets the feedrate percentage . The appropriate command that i believe you were looking for is M106 SX, where X is an integer between [0-255].

Additionally, what happened with the ControlTab.py file, because the entire file is diff. I suggest just having just the actual changes.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gmmcosta15 added 2 commits May 25, 2026 15:45
@gmmcosta15
bugfix: split fan/speed slider callbacks to fix gcode dispatch collision
e75e03c
@gmmcosta15
fix(fan-slider): emit M106 for [fan] and SET_FAN_SPEED for [fan_gener…
d02349c
…ic]; drop normalize dependency and ruff fixes
@gmmcosta15
gmmcosta15 force-pushed the bugfix/slider-split branch from 7a84b3a to d02349c Compare May 25, 2026 15:25
gmmcosta15 added 2 commits May 25, 2026 16:31
@gmmcosta15
fix(fan-slider): fix M106 rounding at 50% and RUF012 in tunePage
c98a263
@gmmcosta15
refactor(fan-slider): extract fan_speed_gcode utility, fix float() re…
c9b4595
…dundancy
@gmmcosta15
gmmcosta15 requested a review from HugoCLSC May 28, 2026 13:52
@gmmcosta15
gmmcosta15 dismissed HugoCLSC’s stale review May 28, 2026 13:52

solved

@HugoCLSC
Merge branch 'dev' into bugfix/slider-split
b0e1cf8
HugoCLSC
HugoCLSC approved these changes Jun 1, 2026
View reviewed changes
@HugoCLSC
HugoCLSC merged commit 25f2f80 into dev Jun 1, 2026
8 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@HugoCLSC
HugoCLSC deleted the bugfix/slider-split branch June 1, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@HugoCLSC HugoCLSC HugoCLSC approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@gmmcosta15 gmmcosta15

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@gmmcosta15 @HugoCLSC
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.