🔧 MAX_SAVED_MESHES (Set to 0 for no EEPROM mesh) - #28436
Open
thinkyhead wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new MAX_SAVED_MESHES configuration option that limits (or disables, when set to 0) saving bed-leveling meshes to EEPROM, addressing #27436 where large meshes overflow small EEPROMs and break M500/M501. A new internal flag HAS_MESH_STORAGE (defined when MAX_SAVED_MESHES > 0 && EEPROM_ENABLED && HAS_MESH) gates all mesh storage code paths: the storage slot field, UBL load/save commands, settings struct fields, UI menu items (Marlin UI, ProUI, JyersUI), and the UBL debug helpers.
Changes:
- Introduce
MAX_SAVED_MESHES(Configuration.h) and deriveHAS_MESH_STORAGEin Conditionals-4-adv.h; capcalc_num_meshes()byMAX_SAVED_MESHES. - Compile out
storage_slot, mesh load/save logic, related EEPROM struct members, andg29_eeprom_dump/g29_compare_current_mesh_to_stored_meshwhen storage is disabled. - Gate Marlin/ProUI/JyersUI menu items and
M420 L/G29 L|Spaths onHAS_MESH_STORAGE, returning a clear error when storage isn't available.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Marlin/Configuration.h | Adds the user-facing MAX_SAVED_MESHES option. |
| Marlin/src/inc/Conditionals-4-adv.h | Defines HAS_MESH_STORAGE and undefs related flags when storage is disabled. |
| Marlin/src/module/settings.cpp | Conditionally compiles bilinear/UBL EEPROM struct members, read/write blocks, mesh slot reporting; caps calc_num_meshes. |
| Marlin/src/feature/bedlevel/ubl/ubl.h | Gates storage_slot and debug helpers on HAS_MESH_STORAGE. |
| Marlin/src/feature/bedlevel/ubl/ubl.cpp | Adjusts reset(), sanity_check(), wizard S handling, and dump/compare helpers. |
| Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | G29 L / G29 S report unavailability when storage disabled; restructures branches. |
| Marlin/src/gcode/bedlevel/M420.cpp | Splits M420 L from V map display; returns error when storage unavailable. |
| Marlin/src/lcd/menu/menu_ubl.cpp | Compiles out UBL slot variable and storage submenu when disabled. |
| Marlin/src/lcd/dwin/proui/dwin.{h,cpp} | Gates ProUI UBL slot/save/load menu and helpers. |
| Marlin/src/lcd/dwin/jyersui/dwin.{h,cpp} | Gates JyersUI MeshSlot popup, slot edit, and SaveLevel branch. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
thinkyhead
force-pushed
the
bf2_max_saved_meshes_PR
branch
6 times, most recently
from
May 18, 2026 07:12
1a78fb7 to
377ff8d
Compare
thinkyhead
force-pushed
the
bf2_max_saved_meshes_PR
branch
from
May 18, 2026 18:15
377ff8d to
0f936fe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As requested by @KillerBug in #27436 …
Add an option to limit the number of meshes that can be saved to EEPROM.
If
MAX_SAVED_MESHESis set to 0 then no meshes will be saved to EEPROM, reducing firmware size a little.No doubt incomplete. Will add CI testing and get this out the door … eventually!