Skip to content

feat(macros): new commands to make temporary on-the-fly changes to heatsoak configuration easier#126

Merged
tg73 merged 2 commits intoRat-OS:v2.1.x-developmentfrom
tg73:topic/heatsoaking-sugar-2
Mar 3, 2026
Merged

feat(macros): new commands to make temporary on-the-fly changes to heatsoak configuration easier#126
tg73 merged 2 commits intoRat-OS:v2.1.x-developmentfrom
tg73:topic/heatsoaking-sugar-2

Conversation

@tg73
Copy link
Collaborator

@tg73 tg73 commented Mar 3, 2026

  • New Features
    • New commands to make temporary on-the-fly changes to heatsoak configuration easier
    • Utility commands for managing macro variables and displaying configuration values

… variables easier

- adds _SHOW_GCODE_VARIABLES and _RESET_GCODE_VARIABLES
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f1ea261 and edd43cf.

📒 Files selected for processing (1)
  • configuration/macros/heatsoaking.cfg

📝 Walkthrough

Walkthrough

Adds a new heatsoaking macro file providing adaptive (beacon-aware) and fixed heat soak modes with validation and runtime controls, plus two utility macros to reset and display gcode macro variables.

Changes

Cohort / File(s) Summary
Heat Soaking Configuration
configuration/macros/heatsoaking.cfg
New file adding RatOS gcode_macro with public variables variable_bed_heat_soak_time and variable_hotend_heat_soak_time; macros: RESET_HEATSOAK_SETTINGS, USE_ADAPTIVE_HEATSOAK, USE_FIXED_HEATSOAK, USE_NO_HEATSOAK, and HEATSOAK_SETTINGS. Implements adaptive (beacon-aware) and fixed modes, input validation, startup-default handling, selective parameter updates, and user-facing messages.
Utility Macros
configuration/macros/util.cfg
Adds _RESET_GCODE_VARIABLES (resets specified gcode_macro variables to configured defaults; supports skipping undefined variables and quiet mode) and _SHOW_GCODE_VARIABLES (prints current values with optional padding). Minor trailing-newline adjustment to _STOP_AND_RAISE_ERROR (non-functional).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 I nudge the bed, I hum the heat,
Beacon-guided, steady beat.
Macros reset and settings bloom,
Fixed or adaptive—find the room.
Hop, click, print: warmth finds its home.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(macros): new commands to make temporary on-the-fly changes to heatsoak configuration easier' directly and specifically describes the main changes - adding new macro commands for managing heatsoak configuration dynamically.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tg73 tg73 changed the title Topic/heatsoaking sugar 2 @coderabbitai Mar 3, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
configuration/macros/util.cfg (1)

507-507: Trim each variable name after splitting VARIABLES.

On Line 507 and Line 556, split(",") keeps whitespace. Inputs like VARIABLES=a, b make b become " b" and fail lookup.

Proposed fix
-	{% set vars = params.VARIABLES.split(",") %}
+	{% set vars = params.VARIABLES.split(",")|map("trim")|list %}
...
-	{% set vars = params.VARIABLES.split(",") %}
+	{% set vars = params.VARIABLES.split(",")|map("trim")|list %}

Also applies to: 556-556

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@configuration/macros/util.cfg` at line 507, When splitting params.VARIABLES
into vars (the expression {% set vars = params.VARIABLES.split(",") %}), each
item may retain surrounding whitespace (e.g., " b") and fail lookups; change the
logic to trim whitespace from each element after split (map/strip each item) so
vars contains cleaned names, and apply the same change to the other occurrence
where params.VARIABLES.split(",") is used.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@configuration/macros/heatsoaking.cfg`:
- Around line 67-69: The validation message for duration_mins incorrectly says
"must be a positive number" while DURATION=0 is allowed (used by
USE_NO_HEATSOAK); update the error text in the duration_mins check (the block
that calls action_raise_error when duration_mins < 0) to say "must be a
non-negative number specifying the heatsoak duration in minutes" so it matches
accepted value 0 and references DURATION/USE_NO_HEATSOAK semantics.
- Around line 42-43: The Jinja2 filter order is wrong: change occurrences where
settings.variable_beacon_adaptive_heat_soak_layer_quality (and the similar
setting on the other occurrence) are currently using |int|default(...) to
instead apply |default(...) before |int (e.g.
settings.variable_beacon_adaptive_heat_soak_layer_quality|default(3)|int) so
undefined or non-convertible values get a safe default before integer
conversion; update both places mentioned (the second occurrence at the other
adaptive heat soak setting) accordingly.

---

Nitpick comments:
In `@configuration/macros/util.cfg`:
- Line 507: When splitting params.VARIABLES into vars (the expression {% set
vars = params.VARIABLES.split(",") %}), each item may retain surrounding
whitespace (e.g., " b") and fail lookups; change the logic to trim whitespace
from each element after split (map/strip each item) so vars contains cleaned
names, and apply the same change to the other occurrence where
params.VARIABLES.split(",") is used.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 55dafdc and f1ea261.

📒 Files selected for processing (2)
  • configuration/macros/heatsoaking.cfg
  • configuration/macros/util.cfg

@tg73 tg73 changed the title @coderabbitai feat(macros): new commands to make temporary on-the-fly changes to heatsoak configuration easier Mar 3, 2026
- provides default RatOS macro variables for bed_heat_soak_time and hotend_heat_soak_time. These deafults (0) were previously implied at each point of use. However, actual variables are required to allow the values to be dynamically changed at runtime via SET_GCODE_VARIABLE.
- add helper macros HEATSOAK_SETTINGS, RESET_HEATSOAK_SETTINGS, USE_ADPATIVE_HEATSOAK, USE_FIXED_HEATSOAK and USE_NO_HEATSOAK that make it easier to apply temporary override of bed heatsoak settings.
@tg73 tg73 force-pushed the topic/heatsoaking-sugar-2 branch from f1ea261 to edd43cf Compare March 3, 2026 13:29
@tg73 tg73 merged commit a48eb86 into Rat-OS:v2.1.x-development Mar 3, 2026
3 checks passed
@tg73 tg73 deleted the topic/heatsoaking-sugar-2 branch March 3, 2026 13:36
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