Skip to content

🔧 MAX_SAVED_MESHES (Set to 0 for no EEPROM mesh) - #28436

Open
thinkyhead wants to merge 1 commit into
MarlinFirmware:bugfix-2.1.xfrom
thinkyhead:bf2_max_saved_meshes_PR
Open

🔧 MAX_SAVED_MESHES (Set to 0 for no EEPROM mesh)#28436
thinkyhead wants to merge 1 commit into
MarlinFirmware:bugfix-2.1.xfrom
thinkyhead:bf2_max_saved_meshes_PR

Conversation

@thinkyhead

Copy link
Copy Markdown
Member

As requested by @KillerBug in #27436

Add an option to limit the number of meshes that can be saved to EEPROM.
If MAX_SAVED_MESHES is 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!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 derive HAS_MESH_STORAGE in Conditionals-4-adv.h; cap calc_num_meshes() by MAX_SAVED_MESHES.
  • Compile out storage_slot, mesh load/save logic, related EEPROM struct members, and g29_eeprom_dump / g29_compare_current_mesh_to_stored_mesh when storage is disabled.
  • Gate Marlin/ProUI/JyersUI menu items and M420 L / G29 L|S paths on HAS_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.

Comment thread Marlin/src/module/settings.cpp Outdated
Comment thread Marlin/src/inc/Conditionals-4-adv.h Outdated
@thinkyhead
thinkyhead force-pushed the bf2_max_saved_meshes_PR branch 6 times, most recently from 1a78fb7 to 377ff8d Compare May 18, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants