|
@@ -134,6 +134,7 @@
|
|
|
// Call gcode file : "M32 P !filename#" and return to caller file after finishing (similar to #include).
|
|
|
// The '#' is necessary when calling from within sd files, as it stops buffer prereading
|
|
|
// M42 - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
|
|
|
+// M73 - Show percent done and print time remaining
|
|
|
// M80 - Turn on Power Supply
|
|
|
// M81 - Turn off Power Supply
|
|
|
// M82 - Set E codes absolute (default)
|
|
@@ -401,6 +402,13 @@ bool no_response = false;
|
|
|
uint8_t important_status;
|
|
|
uint8_t saved_filament_type;
|
|
|
|
|
|
+
|
|
|
+// storing estimated time to end of print counted by slicer
|
|
|
+uint8_t print_percent_done_normal = PRINT_PERCENT_DONE_INIT;
|
|
|
+uint16_t print_time_remaining_normal = PRINT_TIME_REMAINING_INIT; //estimated remaining print time in minutes
|
|
|
+uint8_t print_percent_done_silent = PRINT_PERCENT_DONE_INIT;
|
|
|
+uint16_t print_time_remaining_silent = PRINT_TIME_REMAINING_INIT; //estimated remaining print time in minutes
|
|
|
+
|
|
|
//===========================================================================
|
|
|
//=============================Private Variables=============================
|
|
|
//===========================================================================
|
|
@@ -501,6 +509,8 @@ static int saved_feedmultiply_mm = 100;
|
|
|
//=============================Routines======================================
|
|
|
//===========================================================================
|
|
|
|
|
|
+static void print_time_remaining_init();
|
|
|
+
|
|
|
void get_arc_coordinates();
|
|
|
bool setTargetedHotend(int code);
|
|
|
|
|
@@ -4305,6 +4315,22 @@ Sigma_Exit:
|
|
|
}
|
|
|
#endif // Z_PROBE_REPEATABILITY_TEST
|
|
|
#endif // ENABLE_AUTO_BED_LEVELING
|
|
|
+ case 73: //M73 show percent done and time remaining
|
|
|
+ if(code_seen('P')) print_percent_done_normal = code_value();
|
|
|
+ if(code_seen('R')) print_time_remaining_normal = code_value();
|
|
|
+ if(code_seen('Q')) print_percent_done_silent = code_value();
|
|
|
+ if(code_seen('S')) print_time_remaining_silent = code_value();
|
|
|
+
|
|
|
+ SERIAL_ECHOPGM("NORMAL MODE: Percent done: ");
|
|
|
+ MYSERIAL.print(int(print_percent_done_normal));
|
|
|
+ SERIAL_ECHOPGM("; print time remaining in mins: ");
|
|
|
+ MYSERIAL.println(print_time_remaining_normal);
|
|
|
+ SERIAL_ECHOPGM("SILENT MODE: Percent done: ");
|
|
|
+ MYSERIAL.print(int(print_percent_done_silent));
|
|
|
+ SERIAL_ECHOPGM("; print time remaining in mins: ");
|
|
|
+ MYSERIAL.println(print_time_remaining_silent);
|
|
|
+
|
|
|
+ break;
|
|
|
|
|
|
case 104: // M104
|
|
|
if(setTargetedHotend(104)){
|
|
@@ -4602,6 +4628,8 @@ Sigma_Exit:
|
|
|
#endif
|
|
|
}
|
|
|
}
|
|
|
+ //in the end of print set estimated time to end of print and extruders used during print to default values for next print
|
|
|
+ print_time_remaining_init();
|
|
|
snmm_filaments_used = 0;
|
|
|
break;
|
|
|
case 85: // M85
|
|
@@ -6998,3 +7026,29 @@ void serialecho_temperatures() {
|
|
|
SERIAL_PROTOCOL_F(degBed(), 1);
|
|
|
SERIAL_PROTOCOLLN("");
|
|
|
}
|
|
|
+
|
|
|
+uint16_t print_time_remaining() {
|
|
|
+ uint16_t print_t = PRINT_TIME_REMAINING_INIT;
|
|
|
+ print_t = print_time_remaining_normal;
|
|
|
+ if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply;
|
|
|
+ return print_t;
|
|
|
+}
|
|
|
+
|
|
|
+uint8_t print_percent_done() {
|
|
|
+ //in case that we have information from M73 gcode return percentage counted by slicer, else return percentage counted as byte_printed/filesize
|
|
|
+ uint8_t percent_done = 0;
|
|
|
+ if (print_percent_done_normal <= 100) {
|
|
|
+ percent_done = print_percent_done_normal;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ percent_done = card.percentDone();
|
|
|
+ }
|
|
|
+ return percent_done;
|
|
|
+}
|
|
|
+
|
|
|
+static void print_time_remaining_init() {
|
|
|
+ print_time_remaining_normal = PRINT_TIME_REMAINING_INIT;
|
|
|
+ print_time_remaining_silent = PRINT_TIME_REMAINING_INIT;
|
|
|
+ print_percent_done_normal = PRINT_PERCENT_DONE_INIT;
|
|
|
+ print_percent_done_silent = PRINT_PERCENT_DONE_INIT;
|
|
|
+}
|