Move dwell to gcode

This commit is contained in:
Scott Lahteine
2017-09-15 20:44:40 -05:00
parent 4f1eadf41f
commit 51f195e698
7 changed files with 25 additions and 20 deletions

View File

@ -52,10 +52,10 @@
*/
// Wait for spindle to come up to speed
inline void delay_for_power_up() { dwell(SPINDLE_LASER_POWERUP_DELAY); }
inline void delay_for_power_up() { gcode.dwell(SPINDLE_LASER_POWERUP_DELAY); }
// Wait for spindle to stop turning
inline void delay_for_power_down() { dwell(SPINDLE_LASER_POWERDOWN_DELAY); }
inline void delay_for_power_down() { gcode.dwell(SPINDLE_LASER_POWERDOWN_DELAY); }
/**
* ocr_val_mode() is used for debugging and to get the points needed to compute the RPM vs ocr_val line

View File

@ -31,12 +31,13 @@ GcodeSuite gcode;
#include "parser.h"
#include "queue.h"
#include "../module/motion.h"
#include "../module/printcounter.h"
#if ENABLED(PRINTCOUNTER)
#include "../module/printcounter.h"
#endif
#include "../Marlin.h" // for idle()
uint8_t GcodeSuite::target_extruder;
millis_t GcodeSuite::previous_cmd_ms;
@ -99,6 +100,15 @@ void GcodeSuite::get_destination_from_command() {
#endif
}
/**
* Dwell waits immediately. It does not synchronize. Use M400 instead of G4
*/
void GcodeSuite::dwell(millis_t time) {
refresh_cmd_timeout();
time += previous_cmd_ms;
while (PENDING(millis(), time)) idle();
}
//
// Placeholders for non-migrated codes
//

View File

@ -299,6 +299,8 @@ public:
#define KEEPALIVE_STATE(n) NOOP
#endif
void dwell(millis_t time);
private:
static void G0_G1(

View File

@ -67,7 +67,7 @@ void gcode_M0_M1() {
gcode.refresh_cmd_timeout();
if (ms > 0) {
ms += previous_cmd_ms; // wait until this time for a click
ms += gcode.previous_cmd_ms; // wait until this time for a click
while (PENDING(millis(), ms) && wait_for_user) idle();
}
else {

View File

@ -33,5 +33,5 @@ void gcode_G4() {
if (!lcd_hasstatus()) LCD_MESSAGEPGM(MSG_DWELL);
dwell(dwell_ms);
gcode.dwell(dwell_ms);
}