Repository navigation
add(rules): marlin-bed-leveling for 3D printer firmware #391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||||||||||||||||||
| --- | ||||||||||||||||||||
| description: "Marlin 2.x 3D printer firmware bed leveling (ABL/UBL) calibration, mesh diagnosis, and G-code auditing." | ||||||||||||||||||||
| globs: **/*.gcode, **/*.gco, **/*.ini, **/marlin*.*, **/Configuration*.h | ||||||||||||||||||||
| alwaysApply: false | ||||||||||||||||||||
| --- | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Marlin Bed Leveling Rules | ||||||||||||||||||||
|
|
||||||||||||||||||||
| You are an Autonomous Additive Manufacturing & Motion Control Specialist. When calibrating 3D printer bed leveling, strictly enforce these rules: | ||||||||||||||||||||
|
|
||||||||||||||||||||
| ## 1. Start G-code Sequence Safety | ||||||||||||||||||||
| - **Mandatory Order:** G28 (Auto Home) MUST execute BEFORE any leveling compensation. | ||||||||||||||||||||
| - **Mesh Restore:** If using Bilinear ABL or saved UBL mesh, M420 S1 MUST follow G28, because G28 disables bed leveling by default in Marlin. | ||||||||||||||||||||
| - **Unified Bed Leveling (UBL):** Call G29 L0 to load slot 0 followed by G29 A to activate compensation. | ||||||||||||||||||||
|
|
||||||||||||||||||||
| ## 2. Mesh Topography Diagnosis | ||||||||||||||||||||
| - **Planar Tilt:** If diagonal corners show symmetric opposite error, adjust bed thumbscrews before re-probing. | ||||||||||||||||||||
| - **Bowl / Taco Warp:** Center differs significantly from all 4 edges (> 0.2mm); use glass or PEI spring steel with thermal soaking. | ||||||||||||||||||||
| - **Mechanical Binding:** Sudden localized step changes indicate Z-axis lead screw binding or loose eccentric nuts. | ||||||||||||||||||||
|
|
||||||||||||||||||||
| ## 3. Z-Probe Calibration Math | ||||||||||||||||||||
| - When babystepping during first-layer test, calculate new offset: {new} = Z_{current} + \Delta_{babystep}$. | ||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Fix the unmatched math delimiter. The expression starts with 🤖 Prompt for AI Agents |
||||||||||||||||||||
| - Persist new offset with M851 Z{new_offset} followed by M500 EEPROM save. | ||||||||||||||||||||
|
Comment on lines
+22
to
+23
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: sed -n '18,25p' rules/marlin-bed-leveling-cursorrules-prompt-file.mdc
rg -n 'BABYSTEP_ZPROBE_OFFSET|M290|M851|babystep' rules README.mdRepository: PatrickJS/awesome-cursorrules Length of output: 929 🌐 Web query:
💡 Result: <source_evidence> Citations:
🌐 Web query:
💡 Result: <source_evidence> Citations:
Prevent double application of the babystep adjustment. When When the feature is disabled, use Suggested fix- When babystepping during first-layer test, calculate new offset: {new} = Z_{current} + \Delta_{babystep}$.
- Persist new offset with M851 Z{new_offset} followed by M500 EEPROM save.
+ When BABYSTEP_ZPROBE_OFFSET is enabled, apply the first-layer correction with M290 Z{Δ_babystep}, then persist it with M500.
+ When BABYSTEP_ZPROBE_OFFSET is disabled, apply the correction with M290 Z{Δ_babystep}, then set M851 Z{new_offset}, where {new_offset} = Z_{current} + Δ_{babystep}, and persist it with M500.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: sed -n '1,25p' rules/marlin-bed-leveling-cursorrules-prompt-file.mdcRepository: PatrickJS/awesome-cursorrules Length of output: 1540 🌐 Web query:
💡 Result: <source_evidence> Citations:
🌐 Web query:
💡 Result: <source_evidence> Citations:
State the firmware prerequisites for This rule matches every Suggested fix- Persist new offset with M851 Z{new_offset} followed by M500 EEPROM save.
+ If HAS_BED_PROBE is enabled, set the probe offset with M851 Z{new_offset}.
+ If EEPROM_SETTINGS is enabled, follow with M500 to persist the setting.
+ For manual probing, use the configured manual-leveling procedure instead of M851.
+ Without EEPROM_SETTINGS, treat the adjustment as session-only or add it to the firmware configuration.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
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.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: PatrickJS/awesome-cursorrules
Length of output: 3040
🌐 Web query:
Marlin 2.x G29 UBL L index load mesh slot documentation💡 Result:
<source_evidence>
Citations:
Use the intended UBL mesh slot.
G29 L0explicitly loads slot 0. Slot 0 is not a required default for every printer. Load the configured slot that contains the intended complete mesh, then activate UBL.Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents