fix(extras): allow SET_ZERO_REFERENCE_POSITION to be called without having a beacon#125
Conversation
…aving a beacon - Fixes Rat-OS#124 - Moved the implementation from a beacon-specific module to the general-purpose [ratos] module
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
configuration/klippy/ratos.py (1)
422-422: Optional lint cleanup for long inline error message.At Line 422, consider moving the long error string to a class-level constant for cleaner exception sites and consistency with TRY003-style lint expectations.
♻️ Optional cleanup
+ ERR_BED_MESH_NOT_CONFIGURED = ( + "The bed_mesh module is not configured. This command requires a [bed_mesh] " + "section in the printer configuration." + ) + def cmd_SET_ZERO_REFERENCE_POSITION(self, gcmd): if not self.bed_mesh: - raise gcmd.error("The bed_mesh module is not configured. This command requires a [bed_mesh] section in the printer configuration.") + raise gcmd.error(self.ERR_BED_MESH_NOT_CONFIGURED)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@configuration/klippy/ratos.py` at line 422, Extract the long inline error message used in the gcmd.error raise (the "The bed_mesh module is not configured..." string) into a class-level constant (e.g., BED_MESH_NOT_CONFIGURED) near the top of the class or module, then replace the inline literal in the raise site with that constant; update any nearby/related error-raise sites to reuse the constant for consistency and lint compliance (refer to the raise invoking gcmd.error and the "bed_mesh" module check to locate the change).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@configuration/klippy/ratos.py`:
- Line 422: Extract the long inline error message used in the gcmd.error raise
(the "The bed_mesh module is not configured..." string) into a class-level
constant (e.g., BED_MESH_NOT_CONFIGURED) near the top of the class or module,
then replace the inline literal in the raise site with that constant; update any
nearby/related error-raise sites to reuse the constant for consistency and lint
compliance (refer to the raise invoking gcmd.error and the "bed_mesh" module
check to locate the change).
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
configuration/klippy/beacon_mesh.pyconfiguration/klippy/ratos.py
💤 Files with no reviewable changes (1)
- configuration/klippy/beacon_mesh.py
SET_ZERO_REFERENCE_POSITIONcall fails without beacon #124