From 98154870dc03b651243b5017584bb91559126ae9 Mon Sep 17 00:00:00 2001 From: Bjoern Kerler Date: Sun, 18 Feb 2024 20:59:58 +0100 Subject: [PATCH] gcode: M73 add missing get report functionality --- lib/Marlin/Marlin/src/gcode/lcd/M73_PE.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/Marlin/Marlin/src/gcode/lcd/M73_PE.cpp b/lib/Marlin/Marlin/src/gcode/lcd/M73_PE.cpp index 0e9cbbe4e7..b52f431374 100644 --- a/lib/Marlin/Marlin/src/gcode/lcd/M73_PE.cpp +++ b/lib/Marlin/Marlin/src/gcode/lcd/M73_PE.cpp @@ -6,6 +6,7 @@ #include "M73_PE.h" #include "../Marlin/src/libs/stopwatch.h" +#include "marlin_vars.hpp" extern Stopwatch print_job_timer; ClProgressData oProgressData; @@ -102,6 +103,23 @@ void M73_PE_no_parser(std::optional P, std::optional R, std:: if (T) { oProgressData.oTime2Pause.mSetValue(*T, nTimeNow); // [min] -> [s] } + + // Print progress report. Do not remove as third party tools might depend on this + if (!P && !R && !T) { + SERIAL_ECHO_START(); + SERIAL_ECHOLNPAIR(" M73 Progress: ", marlin_vars()->sd_percent_done, "%;"); + const uint32_t time_to_end = marlin_vars_t().time_to_end; + if (time_to_end != marlin_server::TIME_TO_END_INVALID) { + SERIAL_ECHOPAIR(" Time left: ", time_to_end / 60, "m;"); + SERIAL_EOL(); + } + const uint32_t time_to_pause = oProgressData.oTime2Pause.mGetValue(); + if (time_to_pause != marlin_server::TIME_TO_END_INVALID) { + const int print_speed = marlin_vars()->print_speed; + SERIAL_ECHOPAIR(" Change: ", print_speed > 0 ? ((time_to_pause * 100) / print_speed) / 60 : 0, "m;"); + SERIAL_EOL(); + } + } } #endif