Skip to content

fix(job-status): current layer stuck at 0 during print - #336

Merged
gmmcosta15 merged 2 commits into
devfrom
bugfix/layer-counter-stuck-zero
Sep 24, 2026
Merged

gmmcosta15 merged 2 commits into
devfrom
bugfix/layer-counter-stuck-zero

Conversation

@gmmcosta15

Copy link
Copy Markdown
Collaborator

Description

  • Feature
  • Bug fix
  • Code refactor
  • Documentation

Current layer showed 0/total for the whole print. Regression from #280: _reset_job_display() cleared layer_fallback, and the Z-estimate could only be re-armed by a print_stats.info update, which Klipper never sends again when the slicer omits SET_PRINT_STATS_INFO (unchanged field, so Moonraker never re-emits it).

  • Dropped the layer_fallback gate for _reported_layer (sticky, None when Klipper reports nothing).
  • _refresh_layer_display() mirrors Mainsail's pure getters: info.current_layer wins, else the Z estimate, recomputed on every filament advance and on metadata arrival.
  • _max_layers() follows getPrintMaxLayers precedence: info.total_layer -> metadata layer_count -> geometry estimate.
  • _layer_from_z() keeps the last displayed layer when inputs are missing, so the counter never flickers back to 0.
  • Guarded on_fileinfo() by filename: fileinfo is a global signal, so browsing a file mid-print was overwriting the running job's totals.

Motivation

The counter must be stable and match Mainsail, which computes it as a derived value every frame rather than behind a one-shot arming flag. Any flag armed only by an info delta is unreachable on printers whose gcode has no SET_PRINT_STATS_INFO, which is the field case that broke.

@gmmcosta15 gmmcosta15 added bug Something is broken, or a fix for it enhancement New feature or improvement labels Sep 9, 2026
@gmmcosta15 gmmcosta15 self-assigned this Sep 9, 2026
@gmmcosta15
gmmcosta15 merged commit bd1e46f into dev Sep 24, 2026
8 checks passed
@gmmcosta15
gmmcosta15 deleted the bugfix/layer-counter-stuck-zero branch September 24, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is broken, or a fix for it enhancement New feature or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant