Hacking a more accurate remaining-time estimation
-
TL;DR This post explains how to hack a simple but accurate remaining time estimation on the PanelDue. It uses the slicer's time M73 markers and an auto post processing script.
The picture below shows the PanelDue screen a few minutes into a long print. The slicer's estimation is already accurate.
The long story. Duet provides three different remaining-time estimations which converge to reasonable values at about 30% of the print.
One way to have a more accurate estimation is to use the gcode time markers that slicers such as Prusa Slicer can generate. All we need to do is to display them somehow during the print.
For my printer I use the two Standby fields of the PanelDue for displaying hours and minutes respectively. This was done by adding to my auto post processing script a few lines that replace the M73 commands with commands to display the hours and minutes:
# Time marker, e.g. E.g. M73 P27 R16 match = re.fullmatch(r'M73 P([\d]+) R([\d]+)', original_line) if match: percents = int(match[1]) minutes_left = int(match[2]) hh = math.floor(minutes_left / 60) mm = minutes_left % 60 modified_lines.extend([ '; ' + original_line, f'M140 R-{hh}', # Bed standby f'G10 P0 R-{mm}', # Extruder standby ';' ])
That python code generates the following gcode:
; M73 P0 R308 M140 R-5 G10 P0 R-8 ;
Edit: full code at the bottom here https://github.com/zapta/misc/blob/master/duet3d_automesh/duet3d_automesh.py (this auto post processing file also does per-print partial mesh bed leveling).
-
Clever hack!