Added new G-Code: M78

This commit is contained in:
João Brázio 2016-04-27 02:13:27 +01:00
parent 4f541c5bb5
commit d6cfcc9c8b
No known key found for this signature in database
GPG Key ID: F62CFD37DFFDB540
2 changed files with 33 additions and 3 deletions

View File

@ -65,7 +65,11 @@ typedef unsigned long millis_t;
#include "WString.h" #include "WString.h"
#include "stopwatch.h" #if ENABLED(PRINTCOUNTER)
#include "printcounter.h"
#else
#include "stopwatch.h"
#endif
#ifdef USBCON #ifdef USBCON
#if ENABLED(BLUETOOTH) #if ENABLED(BLUETOOTH)
@ -364,7 +368,11 @@ extern bool axis_homed[3]; // axis[n].is_homed
#endif #endif
// Print job timer // Print job timer
extern Stopwatch print_job_timer; #if ENABLED(PRINTCOUNTER)
extern PrintCounter print_job_timer;
#else
extern Stopwatch print_job_timer;
#endif
// Handling multiple extruders pins // Handling multiple extruders pins
extern uint8_t active_extruder; extern uint8_t active_extruder;

View File

@ -327,7 +327,11 @@ static millis_t max_inactive_time = 0;
static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL; static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
// Print Job Timer // Print Job Timer
Stopwatch print_job_timer = Stopwatch(); #if ENABLED(PRINTCOUNTER)
PrintCounter print_job_timer = PrintCounter();
#else
Stopwatch print_job_timer = Stopwatch();
#endif
static uint8_t target_extruder; static uint8_t target_extruder;
@ -4252,6 +4256,15 @@ inline void gcode_M77() {
print_job_timer.stop(); print_job_timer.stop();
} }
#if ENABLED(PRINTCOUNTER)
/*+
* M78: Show print statistics
*/
inline void gcode_M78() {
print_job_timer.showStats();
}
#endif
/** /**
* M104: Set hot end temperature * M104: Set hot end temperature
*/ */
@ -6636,6 +6649,12 @@ void process_next_command() {
gcode_M77(); gcode_M77();
break; break;
#if ENABLED(PRINTCOUNTER)
case 78: // Show print statistics
gcode_M78();
break;
#endif
#if ENABLED(M100_FREE_MEMORY_WATCHER) #if ENABLED(M100_FREE_MEMORY_WATCHER)
case 100: case 100:
gcode_M100(); gcode_M100();
@ -7750,6 +7769,9 @@ void idle(
); );
host_keepalive(); host_keepalive();
lcd_update(); lcd_update();
#if ENABLED(PRINTCOUNTER)
print_job_timer.tick();
#endif
} }
/** /**