Browse Source

Added new G-Code: M78

pull/1/head
João Brázio 9 years ago
parent
commit
d6cfcc9c8b
No known key found for this signature in database GPG Key ID: F62CFD37DFFDB540
  1. 12
      Marlin/Marlin.h
  2. 24
      Marlin/Marlin_main.cpp

12
Marlin/Marlin.h

@ -65,7 +65,11 @@ typedef unsigned long millis_t;
#include "WString.h"
#include "stopwatch.h"
#if ENABLED(PRINTCOUNTER)
#include "printcounter.h"
#else
#include "stopwatch.h"
#endif
#ifdef USBCON
#if ENABLED(BLUETOOTH)
@ -364,7 +368,11 @@ extern bool axis_homed[3]; // axis[n].is_homed
#endif
// 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
extern uint8_t active_extruder;

24
Marlin/Marlin_main.cpp

@ -327,7 +327,11 @@ static millis_t max_inactive_time = 0;
static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
// 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;
@ -4252,6 +4256,15 @@ inline void gcode_M77() {
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
*/
@ -6636,6 +6649,12 @@ void process_next_command() {
gcode_M77();
break;
#if ENABLED(PRINTCOUNTER)
case 78: // Show print statistics
gcode_M78();
break;
#endif
#if ENABLED(M100_FREE_MEMORY_WATCHER)
case 100:
gcode_M100();
@ -7750,6 +7769,9 @@ void idle(
);
host_keepalive();
lcd_update();
#if ENABLED(PRINTCOUNTER)
print_job_timer.tick();
#endif
}
/**

Loading…
Cancel
Save