Move dwell to gcode
This commit is contained in:
parent
4f1eadf41f
commit
51f195e698
@ -163,7 +163,6 @@ volatile bool wait_for_heatup = true;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Inactivity shutdown
|
// Inactivity shutdown
|
||||||
millis_t previous_cmd_ms = 0;
|
|
||||||
static millis_t max_inactive_time = 0;
|
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;
|
||||||
|
|
||||||
@ -366,16 +365,6 @@ void suicide() {
|
|||||||
***************** GCode Handlers *****************
|
***************** GCode Handlers *****************
|
||||||
**************************************************/
|
**************************************************/
|
||||||
|
|
||||||
#if ENABLED(ARC_SUPPORT)
|
|
||||||
#include "gcode/motion/G2_G3.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void dwell(millis_t time) {
|
|
||||||
gcode.refresh_cmd_timeout();
|
|
||||||
time += previous_cmd_ms;
|
|
||||||
while (PENDING(millis(), time)) idle();
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "gcode/motion/G4.h"
|
#include "gcode/motion/G4.h"
|
||||||
|
|
||||||
#if ENABLED(BEZIER_CURVE_SUPPORT)
|
#if ENABLED(BEZIER_CURVE_SUPPORT)
|
||||||
@ -882,7 +871,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
|
|||||||
|
|
||||||
const millis_t ms = millis();
|
const millis_t ms = millis();
|
||||||
|
|
||||||
if (max_inactive_time && ELAPSED(ms, previous_cmd_ms + max_inactive_time)) {
|
if (max_inactive_time && ELAPSED(ms, gcode.previous_cmd_ms + max_inactive_time)) {
|
||||||
SERIAL_ERROR_START();
|
SERIAL_ERROR_START();
|
||||||
SERIAL_ECHOLNPAIR(MSG_KILL_INACTIVE_TIME, parser.command_ptr);
|
SERIAL_ECHOLNPAIR(MSG_KILL_INACTIVE_TIME, parser.command_ptr);
|
||||||
kill(PSTR(MSG_KILLED));
|
kill(PSTR(MSG_KILLED));
|
||||||
@ -895,7 +884,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
|
|||||||
#define MOVE_AWAY_TEST true
|
#define MOVE_AWAY_TEST true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (MOVE_AWAY_TEST && stepper_inactive_time && ELAPSED(ms, previous_cmd_ms + stepper_inactive_time)
|
if (MOVE_AWAY_TEST && stepper_inactive_time && ELAPSED(ms, gcode.previous_cmd_ms + stepper_inactive_time)
|
||||||
&& !ignore_stepper_queue && !planner.blocks_queued()) {
|
&& !ignore_stepper_queue && !planner.blocks_queued()) {
|
||||||
#if ENABLED(DISABLE_INACTIVE_X)
|
#if ENABLED(DISABLE_INACTIVE_X)
|
||||||
disable_X();
|
disable_X();
|
||||||
@ -965,7 +954,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
|
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
|
||||||
if (ELAPSED(ms, previous_cmd_ms + (EXTRUDER_RUNOUT_SECONDS) * 1000UL)
|
if (ELAPSED(ms, gcode.previous_cmd_ms + (EXTRUDER_RUNOUT_SECONDS) * 1000UL)
|
||||||
&& thermalManager.degHotend(active_extruder) > EXTRUDER_RUNOUT_MINTEMP) {
|
&& thermalManager.degHotend(active_extruder) > EXTRUDER_RUNOUT_MINTEMP) {
|
||||||
#if ENABLED(SWITCHING_EXTRUDER)
|
#if ENABLED(SWITCHING_EXTRUDER)
|
||||||
const bool oldstatus = E0_ENABLE_READ;
|
const bool oldstatus = E0_ENABLE_READ;
|
||||||
|
@ -52,10 +52,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Wait for spindle to come up to speed
|
// 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
|
// 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
|
* ocr_val_mode() is used for debugging and to get the points needed to compute the RPM vs ocr_val line
|
||||||
|
@ -31,12 +31,13 @@ GcodeSuite gcode;
|
|||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
#include "../module/motion.h"
|
#include "../module/motion.h"
|
||||||
#include "../module/printcounter.h"
|
|
||||||
|
|
||||||
#if ENABLED(PRINTCOUNTER)
|
#if ENABLED(PRINTCOUNTER)
|
||||||
#include "../module/printcounter.h"
|
#include "../module/printcounter.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "../Marlin.h" // for idle()
|
||||||
|
|
||||||
uint8_t GcodeSuite::target_extruder;
|
uint8_t GcodeSuite::target_extruder;
|
||||||
millis_t GcodeSuite::previous_cmd_ms;
|
millis_t GcodeSuite::previous_cmd_ms;
|
||||||
|
|
||||||
@ -99,6 +100,15 @@ void GcodeSuite::get_destination_from_command() {
|
|||||||
#endif
|
#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
|
// Placeholders for non-migrated codes
|
||||||
//
|
//
|
||||||
|
@ -299,6 +299,8 @@ public:
|
|||||||
#define KEEPALIVE_STATE(n) NOOP
|
#define KEEPALIVE_STATE(n) NOOP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void dwell(millis_t time);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static void G0_G1(
|
static void G0_G1(
|
||||||
|
@ -67,7 +67,7 @@ void gcode_M0_M1() {
|
|||||||
gcode.refresh_cmd_timeout();
|
gcode.refresh_cmd_timeout();
|
||||||
|
|
||||||
if (ms > 0) {
|
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();
|
while (PENDING(millis(), ms) && wait_for_user) idle();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -33,5 +33,5 @@ void gcode_G4() {
|
|||||||
|
|
||||||
if (!lcd_hasstatus()) LCD_MESSAGEPGM(MSG_DWELL);
|
if (!lcd_hasstatus()) LCD_MESSAGEPGM(MSG_DWELL);
|
||||||
|
|
||||||
dwell(dwell_ms);
|
gcode.dwell(dwell_ms);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,10 @@
|
|||||||
|
|
||||||
#include "../inc/MarlinConfig.h"
|
#include "../inc/MarlinConfig.h"
|
||||||
|
|
||||||
|
#if ENABLED(PARKING_EXTRUDER) && PARKING_EXTRUDER_SOLENOIDS_DELAY > 0
|
||||||
|
#include "../gcode/gcode.h" // for dwell()
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(SWITCHING_EXTRUDER)
|
#if ENABLED(SWITCHING_EXTRUDER)
|
||||||
|
|
||||||
#if EXTRUDERS > 3
|
#if EXTRUDERS > 3
|
||||||
@ -74,7 +78,7 @@
|
|||||||
default: OUT_WRITE(SOL0_PIN, state); break;
|
default: OUT_WRITE(SOL0_PIN, state); break;
|
||||||
}
|
}
|
||||||
#if PARKING_EXTRUDER_SOLENOIDS_DELAY > 0
|
#if PARKING_EXTRUDER_SOLENOIDS_DELAY > 0
|
||||||
dwell(PARKING_EXTRUDER_SOLENOIDS_DELAY);
|
gcode.dwell(PARKING_EXTRUDER_SOLENOIDS_DELAY);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user