Fix Mainsail livestats: wrong progress percentage and remaining time - #1041
Open
HK-Moebius wants to merge 1 commit into
Open
HK-Moebius wants to merge 1 commit into
HK-Moebius wants to merge 1 commit into
Conversation
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.
The Mainsail enhanced app (added in #642) shows wrong values while a print is running. This affects every Klipper/Moonraker printer, not a specific model.
Problems
Progress is always 0% or 1%.
Moonraker reports
display_status.progressas a fraction between0.0and1.0. The app rounds that value directly without multiplying by 100, so a print at 45% is shown as0%, and anything from 50% onwards as1%.The remaining time is unrelated to the print.
toolhead.estimated_print_timeis not the estimated duration of the print job. It is Klipper's internal print time clock, which keeps running since Klipper started. Subtractingprint_stats.print_durationfrom it produces a value that depends on the printer's uptime, so the "Finish" value grows the longer the printer has been powered on.Changes
display_status.progressis not set (no M73 in the G-code), fall back tovirtual_sdcard.progress./server/files/metadata,estimated_time) minusprint_stats.print_duration. This is the same data Mainsail itself uses for its slicer-based estimate.virtual_sdcardinstead oftoolhead, sincetoolheadis no longer needed.The output keys (
completed_pct,estimated,state) and the presentation are unchanged, solivestats.blade.phpdoes not need to change.Testing
Tested with a Klipper/Moonraker printer (Prusa Pro HT90) during a running print. Progress and remaining time now match what Mainsail shows.