Skip to content

feat(macros): add user hooks to _PURGE_FILAMENT - #148

Merged
tg73 merged 3 commits into
Rat-OS:v2.1.x-developmentfrom
tg73:topic/devpub/add-user-hooks-for-purge
Jul 3, 2026
Merged

feat(macros): add user hooks to _PURGE_FILAMENT#148
tg73 merged 3 commits into
Rat-OS:v2.1.x-developmentfrom
tg73:topic/devpub/add-user-hooks-for-purge

Conversation

@tg73

@tg73 tg73 commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator
  • Added stub _USER_BEFORE_PURGE_FILAMENT TOOLHEAD=0|1 and _USER_AFTER_PURGE_FILAMENT TOOLHEAD=0|1 which are called around the main block in _PURGE_FILAMENT, but only if purging will actually take place.
  • parse the E and R parameters in _PURGE_FILAMENT as floats not ints

Summary by CodeRabbit

  • New Features
    • Added two new customization points around filament purge, allowing advanced users to run their own actions before and after the purge routine.
  • Bug Fixes
    • Improved purge parameter handling so values are read more accurately, including support for decimal inputs.
    • Expanded debug output to show additional purge details for easier troubleshooting.

tg73 added 3 commits July 2, 2026 17:29
- Added empty _USER_BEFORE_PURGE_FILAMENT TOOLHEAD=0|1 and _USER_AFTER_PURGE_FILAMENT TOOLHEAD=0|1
- Called around the main block in _PURGE_FILAMENT, but only if purging will actually take place.
…s not ints

- existing callers often pass floats, and it makes no sense to force these parameters to be integers
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: dab9fea5-0110-4145-9c8d-db7f40173689

📥 Commits

Reviewing files that changed from the base of the PR and between e75bfc2 and 0ca64cc.

📒 Files selected for processing (2)
  • configuration/macros/load_filament.cfg
  • configuration/macros/user-hooks.cfg

📝 Walkthrough

Walkthrough

The _PURGE_FILAMENT macro now parses E and R parameters as floats and logs both values via DEBUG_ECHO. Two new user hook calls, _USER_BEFORE_PURGE_FILAMENT and _USER_AFTER_PURGE_FILAMENT, are invoked during the purge sequence when E > 0, with corresponding empty macro stubs added to user-hooks.cfg.

Changes

Purge Filament Hooks

Layer / File(s) Summary
Purge macro float parsing and hook invocation
configuration/macros/load_filament.cfg
_PURGE_FILAMENT reads E/R as floats, logs both in DEBUG_ECHO, and calls _USER_BEFORE_PURGE_FILAMENT at the start and _USER_AFTER_PURGE_FILAMENT near the end of the purge block, both gated on E > 0.
User hook macro stubs
configuration/macros/user-hooks.cfg
Adds _USER_BEFORE_PURGE_FILAMENT and _USER_AFTER_PURGE_FILAMENT gcode_macro definitions with empty gcode: blocks for user customization.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change by adding user hooks to _PURGE_FILAMENT.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@tg73
tg73 merged commit 1df0f23 into Rat-OS:v2.1.x-development Jul 3, 2026
2 checks passed
@tg73
tg73 deleted the topic/devpub/add-user-hooks-for-purge branch July 3, 2026 14:50
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