Closed luc-github closed 2 years ago
here messages that need to be handled as POC with Marlin, according command or status
Not printing:
Not SD printing
Current file: (no file)
Printing
SD printing byte 2432/5557
Current file: TESTPR~1.GCO testprint.gcode
Printing done
Done printing file
Status:
echo:busy: processing
Error:Heating failed, system stopped! Heater_ID: E0
echo:Homing Failed
Error:Printer halted. kill() called!
For status some are successively displayed - so will display the last one, for other need to refer to terminal output
e.g: echo:Homing Failed
won't be displayed or very fast because just after Error:Printer halted. kill() called!
will be displayed
Implemented
It already works great, but would it be possible to handle M31 (time elapsed since the start of the current print job) in the print status panel?
https://reprap.org/wiki/G-code#M31:_Output_time_since_last_M109_or_SD_card_start_to_serial Example M31 The response looks like: echo:54 min, 38 sec
And also maybe an estimate of the remaining time as: remaining = elapsed * (100 - progress) / progress
How the M31 output looks after 1hour ? and after 1 day?
The example from reprap showed "min" and "sec" with a comma, but Marlin seems to be using "y", "d", "h", "m" and "s" with spaces. It could be shown as is for the "elapsed time". It only has to be parsed for the computation/estimation of the "remaining time".
Relevant parts from Marlin 2.1 source code:
src/gcode/stats/M31.cpp: duration_t(print_job_timer.duration()).toString(buffer);
src/libs/duration_t.h: char toString(char const buffer) const { const uint16_t y = this->year(), d = this->day() % 365, h = this->hour() % 24, m = this->minute() % 60, s = this->second() % 60;
if (y) sprintf_P(buffer, PSTR("%iy %id %ih %im %is"), y, d, h, m, s); else if (d) sprintf_P(buffer, PSTR("%id %ih %im %is"), d, h, m, s); else if (h) sprintf_P(buffer, PSTR("%ih %im %is"), h, m, s); else if (m) sprintf_P(buffer, PSTR("%im %is"), m, s); else sprintf_P(buffer, PSTR("%is"), s);
Hmm I am not sure if it will be very reliable to detect this output, need to add a regex to detect and extract the value for computation here : https://github.com/luc-github/ESP3D-WEBUI/blob/3.0/src/targets/Printer3D/Marlin/filters.js#L96-L131
I am not sure the computation will be correct as it come from 2 differents outputs with possible delay between them
Also this output should be ignored if no SD print job is on going
EDIT: this regex should to the job:
/echo:((?<year>[0-9]*)y\s)*((?<day>[0-9]*)d\s)*((?<hour>[0-9]*)h\s)*((?<min>[0-9]*)m\s)*((?<sec>[0-9]*)s)/
for echo:1y 23d 22h 0m 21s
and for echo:22h 0m 21s
I just tested on the printer, and the message appears with a "Print time: " description after "echo:" echo:Print time: 9m 57s
That's now an explicit message, and it can be displayed as is in "Print time" in the status panel without the need to match the full regexp. The full regexp is still useful if we want to reconstruct the time in seconds, estimate the remaining time, and back transform it into y/d/h/m/s.
By the way, when there is no print job, the output is echo:Print time: 0s which should be easy to ignore
doc says it display time if M109 is active, is it the case ?
With echo:Print time:
trigger filter will be definitively better
the regex will be also used to be able to translate (Y/d/h/m/s) in other language - which make me think I forget to handle translation for status : https://github.com/luc-github/ESP3D-WEBUI/blob/3.0/src/targets/Printer3D/Marlin/filters.js#L115
I have implemented the stream support in GRBL webUI - it actully does not support the job progress but the stream progression which is different - so it act exactly as offline controler:
I will check if this can be improved but I am not sure as in ESP3D the streaming process only react to ok
and does not catch/analyze any others answers as WebUI do
Next Week I will add the M31
support for Marlin as I have missed it
M31 support for Marlin is implemented
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Need to display print status with correspondig informations / commands
status
progress
printing filename
pause / resume / stop buttons
information page would show only status / progress