Skip to content

Persist Z home (G92) and Zm across restarts; fix NVS handle leaks; add Z home safety check#937

Draft
Copilot wants to merge 6 commits into
Maslow-Mainfrom
copilot/how-z-home-and-zm-values-are-stored
Draft

Persist Z home (G92) and Zm across restarts; fix NVS handle leaks; add Z home safety check#937
Copilot wants to merge 6 commits into
Maslow-Mainfrom
copilot/how-z-home-and-zm-values-are-stored

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 24, 2026

Copilot AI changed the title [WIP] Show code for storing Z home and Z machine values Persist Z home (G92) and Zm across restarts; fix NVS handle leaks Apr 24, 2026
Copilot AI requested a review from MaslowBot April 24, 2026 20:03
@IDAbbott
Copy link
Copy Markdown

@MaslowBot please build

@github-actions
Copy link
Copy Markdown

🤖 Firmware & Web UI Compilation Complete 🤖

✅ Successfully compiled FluidNC firmware and ESP3D-WEBUI

Firmware Build Details:

  • Commit: a471075b2f43f43b181f5a347aa4322c1e297765
  • Version: v1.20-64-ga471075b-dirty
  • Environment: wifi_s3 (ESP32-S3)
  • Firmware size: 1.89 MB
  • Flash usage: 1.89 MB (64.2%)
  • RAM usage: 136.1 KB (42.5%)

Web UI Build Details:

  • Language: English only
  • WebUI size: 135.66 KB (compressed)
  • Format: index.html.gz

Download:
The firmware package (containing firmware.bin, index.html.gz, and installation instructions) has been uploaded as a build artifact named "firmware-package" and can be downloaded from the Actions tab.

To test this release please:
[] Try running calibration with a fresh maslow.yaml file
[] Test jogging the machine to see that movements are normal
[] Try running a simple gcode file

This comment was automatically generated in response to a build request comment.

@IDAbbott
Copy link
Copy Markdown

IDAbbott commented Apr 25, 2026

@MaslowBot Whenever Z changes save new values for z home and Zm to NVS

@MaslowBot
Copy link
Copy Markdown
Collaborator

@copilot-swe-agent

User @IDAbbott mentioned @MaslowBot with the following request:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

@MaslowBot Whenever Z changes save new values for V home and Vm to NVS

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This comment was automatically relayed by MaslowBot so that @copilot-swe-agent can respond to the request.

@IDAbbott
Copy link
Copy Markdown

@MaslowBot for previous request change V home and Vm to Z home and Zm

@MaslowBot
Copy link
Copy Markdown
Collaborator

@copilot-swe-agent

User @IDAbbott mentioned @MaslowBot with the following request:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

@MaslowBot for previous request change V home and Vm to Z home and Zm

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This comment was automatically relayed by MaslowBot so that @copilot-swe-agent can respond to the request.

Copy link
Copy Markdown
Author

Copilot AI commented Apr 25, 2026

@copilot-swe-agent

User @IDAbbott mentioned @MaslowBot with the following request:...

Done in ab384aa. The save trigger in Maslow_::update() was broadened from (Jog || Cycle) → Idle to any state → Idle. This means Z home ("zG92") and Zm ("zPos") are now written to NVS whenever the machine returns to Idle after any operation — Jog, Cycle, Hold, or Homing. The saveZPos() function already skips the NVS write when the values haven't changed, so flash wear is not increased.

Copy link
Copy Markdown
Author

Copilot AI commented Apr 25, 2026

@copilot-swe-agent

User @IDAbbott mentioned @MaslowBot with the following request:...

The implementation already targets Z home and Zm — the previous commit (ab384aa) saves "zG92" (Z home offset) and "zPos" (machine Z) to NVS on every state→Idle transition. No changes needed.

@IDAbbott
Copy link
Copy Markdown

@MaslowBot please build

@github-actions
Copy link
Copy Markdown

🤖 Firmware & Web UI Compilation Complete 🤖

✅ Successfully compiled FluidNC firmware and ESP3D-WEBUI

Firmware Build Details:

  • Commit: ab384aa967c3fc90c5aa704fe2b57c25ebeea386
  • Version: v1.20-65-gab384aa9-dirty
  • Environment: wifi_s3 (ESP32-S3)
  • Firmware size: 1.89 MB
  • Flash usage: 1.89 MB (64.2%)
  • RAM usage: 136.1 KB (42.5%)

Web UI Build Details:

  • Language: English only
  • WebUI size: 135.66 KB (compressed)
  • Format: index.html.gz

Download:
The firmware package (containing firmware.bin, index.html.gz, and installation instructions) has been uploaded as a build artifact named "firmware-package" and can be downloaded from the Actions tab.

To test this release please:
[] Try running calibration with a fresh maslow.yaml file
[] Test jogging the machine to see that movements are normal
[] Try running a simple gcode file

This comment was automatically generated in response to a build request comment.

@davidelang
Copy link
Copy Markdown

davidelang commented Apr 26, 2026 via email

@MaslowBot
Copy link
Copy Markdown
Collaborator

@copilot-swe-agent

User @davidelang mentioned @MaslowBot with the following request:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

IDAbbott wrote:

@MaslowBot Whenever Z changes save new values for V home and Vm to NVS

NVS has a limited number of writes. This is why we only save values when we go
idle (i.e. not likely to change again soon)

David Lang

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This comment was automatically relayed by MaslowBot so that @copilot-swe-agent can respond to the request.

Copy link
Copy Markdown
Author

Copilot AI commented Apr 26, 2026

@copilot-swe-agent

User @davidelang mentioned @MaslowBot with the following request:...

Agreed — the current implementation already follows the save-on-idle pattern. saveZPos() is only called from two places: (1) in update() on any state→Idle transition (not on every Z movement), and (2) once in setZStop() when the user explicitly sets Z home (a single deliberate user action). A change-detection guard in saveZPos() additionally skips the NVS write entirely when the values haven't changed, so flash wear is minimised.

@IDAbbott
Copy link
Copy Markdown

@MaslowBot please update from maslow-main branch

@MaslowBot
Copy link
Copy Markdown
Collaborator

@copilot-swe-agent

User @IDAbbott mentioned @MaslowBot with the following request:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

@MaslowBot please update from maslow-main branch

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This comment was automatically relayed by MaslowBot so that @copilot-swe-agent can respond to the request.

…home-and-zm-values-are-stored

# Conflicts:
#	ESP3D-WEBUI/www/js/maslow.js

Co-authored-by: MaslowBot <231786780+MaslowBot@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented May 15, 2026

@copilot-swe-agent

User @IDAbbott mentioned @MaslowBot with the following request:...

Done in 14c01b0. Merged origin/Maslow-Main — one conflict in maslow.js resolved by keeping both our zm/zhome fields and the new APPLY_TENSION_WARNING_PREFIX constant from Maslow-Main.

@IDAbbott
Copy link
Copy Markdown

@MaslowBot please build

@github-actions
Copy link
Copy Markdown

🤖 Firmware & Web UI Compilation Complete 🤖

✅ Successfully compiled FluidNC firmware and ESP3D-WEBUI

Firmware Build Details:

  • Commit: 14c01b0187f4234ef546a366639b3a29380293e3
  • Version: v1.21-61-g14c01b01-dirty
  • Environment: wifi_s3 (ESP32-S3)
  • Firmware size: 1.90 MB
  • Flash usage: 1.90 MB (64.6%)
  • RAM usage: 136.1 KB (42.5%)

Web UI Build Details:

  • Language: English only
  • WebUI size: 140.71 KB (compressed)
  • Format: index.html.gz

Download:
The firmware package (containing firmware.bin, index.html.gz, and installation instructions) has been uploaded as a build artifact named "firmware-package" and can be downloaded from the Actions tab.

To test this release please:
[] Try running calibration with a fresh maslow.yaml file
[] Test jogging the machine to see that movements are normal
[] Try running a simple gcode file

This comment was automatically generated in response to a build request comment.

@IDAbbott
Copy link
Copy Markdown

@MaslowBot If Zm + Z home is less than 0 then show confirmation popup Z home outside safe bounds

@MaslowBot
Copy link
Copy Markdown
Collaborator

@copilot-swe-agent

User @IDAbbott mentioned @MaslowBot with the following request:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

@MaslowBot If Zm + Z home is less than 0 then show confirmation popup Z home outside safe bounds

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This comment was automatically relayed by MaslowBot so that @copilot-swe-agent can respond to the request.

Copy link
Copy Markdown
Author

Copilot AI commented May 15, 2026

@copilot-swe-agent

User @IDAbbott mentioned @MaslowBot with the following request:...

Done in 1096ed4. In tabletCalSetZStop, before sending $SETZSTOP, the code now checks whether maslowStatus.zm + maslowStatus.zhome < 0 (both values must be populated from $MINFO — if either is missing the check is skipped and the command proceeds normally). When the condition is true a confirmdlg popup appears with:

  • Title: "Z Home Outside Safe Bounds"
  • Message: "The Z home position is outside the safe operating range. Setting Z home here may cause the Z-axis to move below safe limits. Proceed anyway?"

The $SETZSTOP command is only sent if the user clicks Yes.

Copilot AI changed the title Persist Z home (G92) and Zm across restarts; fix NVS handle leaks Persist Z home (G92) and Zm across restarts; fix NVS handle leaks; add Z home safety check May 15, 2026
@IDAbbott
Copy link
Copy Markdown

@MaslowBot please build

@github-actions
Copy link
Copy Markdown

🤖 Firmware & Web UI Compilation Complete 🤖

✅ Successfully compiled FluidNC firmware and ESP3D-WEBUI

Firmware Build Details:

  • Commit: 1096ed4e8b4e1624bd87b571cab55a3e93324930
  • Version: v1.21-62-g1096ed4e-dirty
  • Environment: wifi_s3 (ESP32-S3)
  • Firmware size: 1.90 MB
  • Flash usage: 1.90 MB (64.6%)
  • RAM usage: 136.1 KB (42.5%)

Web UI Build Details:

  • Language: English only
  • WebUI size: 140.84 KB (compressed)
  • Format: index.html.gz

Download:
The firmware package (containing firmware.bin, index.html.gz, and installation instructions) has been uploaded as a build artifact named "firmware-package" and can be downloaded from the Actions tab.

To test this release please:
[] Try running calibration with a fresh maslow.yaml file
[] Test jogging the machine to see that movements are normal
[] Try running a simple gcode file

This comment was automatically generated in response to a build request comment.

@IDAbbott
Copy link
Copy Markdown

@MaslowBot please update from maslow-main branch

@MaslowBot
Copy link
Copy Markdown
Collaborator

@copilot-swe-agent

User @IDAbbott mentioned @MaslowBot with the following request:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

@MaslowBot please update from maslow-main branch

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This comment was automatically relayed by MaslowBot so that @copilot-swe-agent can respond to the request.

…home-and-zm-values-are-stored

Co-authored-by: MaslowBot <231786780+MaslowBot@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented May 17, 2026

@copilot-swe-agent

User @IDAbbott mentioned @MaslowBot with the following request:...

Done in 328235d. Merged origin/Maslow-Main (PRs #967 and #971) — clean merge, no conflicts. The new warning-handler functions from Maslow-Main (showZHomeResetWarningMessage, showZmInvalidWarningMessage) are now in alongside our zm/zhome additions.

@IDAbbott
Copy link
Copy Markdown

@MaslowBot please build

@github-actions
Copy link
Copy Markdown

🤖 Firmware & Web UI Compilation Complete 🤖

✅ Successfully compiled FluidNC firmware and ESP3D-WEBUI

Firmware Build Details:

  • Commit: 328235d0e4d6ec9c5229eed334eb0b6b382288cc
  • Version: v1.21-79-g328235d0-dirty
  • Environment: wifi_s3 (ESP32-S3)
  • Firmware size: 1.90 MB
  • Flash usage: 1.90 MB (64.7%)
  • RAM usage: 136.1 KB (42.5%)

Web UI Build Details:

  • Language: English only
  • WebUI size: 141.05 KB (compressed)
  • Format: index.html.gz

Download:
The firmware package (containing firmware.bin, index.html.gz, and installation instructions) has been uploaded as a build artifact named "firmware-package" and can be downloaded from the Actions tab.

To test this release please:
[] Try running calibration with a fresh maslow.yaml file
[] Test jogging the machine to see that movements are normal
[] Try running a simple gcode file

This comment was automatically generated in response to a build request comment.

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.

How are Z home and Zm values stored across restarts

4 participants