Skip to content

feat(Preheat): add chamber temperature (M141) support to preheat gcode#2382

Merged
meteyou merged 1 commit intomainsail-crew:developfrom
meteyou:feat/add-chamber-preheat
Jan 7, 2026
Merged

feat(Preheat): add chamber temperature (M141) support to preheat gcode#2382
meteyou merged 1 commit intomainsail-crew:developfrom
meteyou:feat/add-chamber-preheat

Conversation

@meteyou
Copy link
Member

@meteyou meteyou commented Jan 6, 2026

Description

This PR adds chamber temperature support to the preheat gcode button. When a G-code file contains chamber_temp metadata (from slicers like PrusaSlicer), the preheat button will now also send M141 S<temp> to set the chamber temperature.

Key implementation detail: The M141 command is only added if Klipper reports M141 as an available G-code command. This ensures backward compatibility with printers that don't have a chamber heater macro configured. Example for a M141 macro:

[gcode_macro M141]
gcode:
    SET_HEATER_TEMPERATURE HEATER=chamber TARGET={params.S|default(0)|float}

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings

n/a

…e button

Signed-off-by: Stefan Dej <meteyou@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds chamber temperature support to the preheat gcode functionality by enabling the M141 command to be included in preheat gcode when the file metadata contains chamber_temp and the printer supports the M141 command.

Key changes:

  • Added M141 (chamber temperature) to the list of supported preheat commands
  • Implemented dynamic filtering to only include preheat commands that are available in Klipper's gcode.commands
  • Moved the preheat_gcode_objects definition outside the file iteration loop for better performance

@meteyou meteyou merged commit 3ab9909 into mainsail-crew:develop Jan 7, 2026
12 checks passed
@meteyou meteyou deleted the feat/add-chamber-preheat branch January 7, 2026 09:56
@meteyou meteyou added this to the v2.17.0 milestone Jan 7, 2026
@escodacarles
Copy link

It's amazing! thank you!

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.

Activate and enter the Active/Passive temperature control of the Chamber using the Mainsail PREHEAT button. (M141 and M149).

4 participants