Merge c4f4e209b1 into 37b56e09a3
This commit is contained in:
commit
ff8f2e7943
19 changed files with 249 additions and 51 deletions
|
|
@ -1518,7 +1518,9 @@
|
||||||
//
|
//
|
||||||
#define HOST_KEEPALIVE_FEATURE // Disable this if your host doesn't like keepalive messages
|
#define HOST_KEEPALIVE_FEATURE // Disable this if your host doesn't like keepalive messages
|
||||||
#define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
|
#define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
|
||||||
|
#define KEEPALIVE_INTERVAL_DIVIDER 3 // Divide the KEEPALIVE_INTERVAL for faster reporting
|
||||||
#define BUSY_WHILE_HEATING // Some hosts require "busy" messages even during heating
|
#define BUSY_WHILE_HEATING // Some hosts require "busy" messages even during heating
|
||||||
|
#define FULL_REPORT_TO_HOST_FEATURE // Enable this to send Machine status reports while moving and status reports GRBL style
|
||||||
|
|
||||||
//
|
//
|
||||||
// G20/G21 Inch mode support
|
// G20/G21 Inch mode support
|
||||||
|
|
|
||||||
|
|
@ -240,6 +240,8 @@ PGMSTR(SP_X_LBL, " X:"); PGMSTR(SP_Y_LBL, " Y:"); PGMSTR(SP_Z_LBL, " Z:"); PGMST
|
||||||
|
|
||||||
MarlinState marlin_state = MF_INITIALIZING;
|
MarlinState marlin_state = MF_INITIALIZING;
|
||||||
|
|
||||||
|
M_StateEnum M_State_grbl = M_INIT;
|
||||||
|
|
||||||
// For M109 and M190, this flag may be cleared (by M108) to exit the wait loop
|
// For M109 and M190, this flag may be cleared (by M108) to exit the wait loop
|
||||||
bool wait_for_heatup = true;
|
bool wait_for_heatup = true;
|
||||||
|
|
||||||
|
|
@ -345,6 +347,16 @@ void quickstop_stepper() {
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void quickpause_stepper() {
|
||||||
|
planner.quick_pause();
|
||||||
|
//planner.synchronize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void quickresume_stepper() {
|
||||||
|
planner.quick_resume();
|
||||||
|
//planner.synchronize();
|
||||||
|
}
|
||||||
|
|
||||||
void enable_e_steppers() {
|
void enable_e_steppers() {
|
||||||
#define _ENA_E(N) ENABLE_AXIS_E##N();
|
#define _ENA_E(N) ENABLE_AXIS_E##N();
|
||||||
REPEAT(E_STEPPERS, _ENA_E)
|
REPEAT(E_STEPPERS, _ENA_E)
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,8 @@ void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, cons
|
||||||
void minkill(const bool steppers_off=false);
|
void minkill(const bool steppers_off=false);
|
||||||
|
|
||||||
void quickstop_stepper();
|
void quickstop_stepper();
|
||||||
|
void quickpause_stepper();
|
||||||
|
void quickresume_stepper();
|
||||||
|
|
||||||
// Global State of the firmware
|
// Global State of the firmware
|
||||||
enum MarlinState : uint8_t {
|
enum MarlinState : uint8_t {
|
||||||
|
|
@ -76,6 +78,27 @@ extern MarlinState marlin_state;
|
||||||
inline bool IsRunning() { return marlin_state == MF_RUNNING; }
|
inline bool IsRunning() { return marlin_state == MF_RUNNING; }
|
||||||
inline bool IsStopped() { return marlin_state != MF_RUNNING; }
|
inline bool IsStopped() { return marlin_state != MF_RUNNING; }
|
||||||
|
|
||||||
|
//
|
||||||
|
// Enumerated Status indices
|
||||||
|
// Coding as GRBL or TinyG for Machine states
|
||||||
|
//
|
||||||
|
enum M_StateEnum : uint8_t {
|
||||||
|
M_INIT = 0, // 0 machine is initializing
|
||||||
|
M_RESET, // 1 machine is ready for use
|
||||||
|
M_ALARM, // 2 machine is in alarm state (soft shut down)
|
||||||
|
M_IDLE, // 3 program stop or no more blocks (M0, M1, M60)
|
||||||
|
M_END, // 4 program end via M2, M30
|
||||||
|
M_RUNNING, // 5 motion is running
|
||||||
|
M_HOLD, // 6 motion is holding
|
||||||
|
M_PROBE, // 7 probe cycle active
|
||||||
|
M_CYCLING, // 8 machine is running (cycling)
|
||||||
|
M_HOMING, // 9 machine is homing
|
||||||
|
M_JOGGING, // 10 machine is jogging
|
||||||
|
M_ERROR // 11 machine is in hard alarm state (shut down)
|
||||||
|
};
|
||||||
|
|
||||||
|
extern M_StateEnum M_State_grbl;
|
||||||
|
|
||||||
bool printingIsActive();
|
bool printingIsActive();
|
||||||
bool printingIsPaused();
|
bool printingIsPaused();
|
||||||
void startOrResumeJob();
|
void startOrResumeJob();
|
||||||
|
|
|
||||||
|
|
@ -34,30 +34,29 @@
|
||||||
// External references
|
// External references
|
||||||
extern bool wait_for_user, wait_for_heatup;
|
extern bool wait_for_user, wait_for_heatup;
|
||||||
void quickstop_stepper();
|
void quickstop_stepper();
|
||||||
|
void quickpause_stepper();
|
||||||
|
void quickresume_stepper();
|
||||||
|
void report_current_position_moving();
|
||||||
|
|
||||||
class EmergencyParser {
|
class EmergencyParser {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Currently looking for: M108, M112, M410, M876
|
// Currently looking for: M108, M112, M410, M876
|
||||||
|
// S000 STATE , P000 for Pause, R000 for resume
|
||||||
enum State : char {
|
enum State : char {
|
||||||
EP_RESET,
|
EP_RESET,
|
||||||
EP_N,
|
EP_N,
|
||||||
EP_M,
|
EP_M,
|
||||||
EP_M1,
|
EP_M1,
|
||||||
EP_M10,
|
EP_M10, EP_M108,
|
||||||
EP_M108,
|
EP_M11, EP_M112,
|
||||||
EP_M11,
|
EP_M4, EP_M41, EP_M410,
|
||||||
EP_M112,
|
EP_S, EP_S0, EP_S00, EP_grblSTATUS,
|
||||||
EP_M4,
|
EP_R, EP_R0, EP_R00, EP_grblRESUME,
|
||||||
EP_M41,
|
EP_P, EP_P0, EP_P00, EP_grblPAUSE,
|
||||||
EP_M410,
|
|
||||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||||
EP_M8,
|
EP_M8, EP_M87, EP_M876, EP_M876S, EP_M876SN,
|
||||||
EP_M87,
|
|
||||||
EP_M876,
|
|
||||||
EP_M876S,
|
|
||||||
EP_M876SN,
|
|
||||||
#endif
|
#endif
|
||||||
EP_IGNORE // to '\n'
|
EP_IGNORE // to '\n'
|
||||||
};
|
};
|
||||||
|
|
@ -72,7 +71,6 @@ public:
|
||||||
EmergencyParser() { enable(); }
|
EmergencyParser() { enable(); }
|
||||||
|
|
||||||
FORCE_INLINE static void enable() { enabled = true; }
|
FORCE_INLINE static void enable() { enabled = true; }
|
||||||
|
|
||||||
FORCE_INLINE static void disable() { enabled = false; }
|
FORCE_INLINE static void disable() { enabled = false; }
|
||||||
|
|
||||||
FORCE_INLINE static void update(State &state, const uint8_t c) {
|
FORCE_INLINE static void update(State &state, const uint8_t c) {
|
||||||
|
|
@ -81,9 +79,12 @@ public:
|
||||||
case EP_RESET:
|
case EP_RESET:
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case ' ': case '\n': case '\r': break;
|
case ' ': case '\n': case '\r': break;
|
||||||
case 'N': state = EP_N; break;
|
case 'N': state = EP_N; break;
|
||||||
case 'M': state = EP_M; break;
|
case 'M': state = EP_M; break;
|
||||||
default: state = EP_IGNORE;
|
case 'S': state = EP_S; break;
|
||||||
|
case 'P': state = EP_P; break;
|
||||||
|
case 'R': state = EP_R; break;
|
||||||
|
default: state = EP_IGNORE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -92,10 +93,22 @@ public:
|
||||||
case '0' ... '9':
|
case '0' ... '9':
|
||||||
case '-': case ' ': break;
|
case '-': case ' ': break;
|
||||||
case 'M': state = EP_M; break;
|
case 'M': state = EP_M; break;
|
||||||
default: state = EP_IGNORE;
|
default: state = EP_IGNORE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EP_S: state = (c == '0' ? EP_S0 : EP_IGNORE); break;
|
||||||
|
case EP_S0: state = (c == '0' ? EP_S00 : EP_IGNORE); break;
|
||||||
|
case EP_S00: state = (c == '0' ? EP_grblSTATUS : EP_IGNORE); break;
|
||||||
|
|
||||||
|
case EP_R: state = (c == '0' ? EP_R0 : EP_IGNORE); break;
|
||||||
|
case EP_R0: state = (c == '0' ? EP_R00 : EP_IGNORE); break;
|
||||||
|
case EP_R00: state = (c == '0' ? EP_grblRESUME : EP_IGNORE); break;
|
||||||
|
|
||||||
|
case EP_P: state = (c == '0' ? EP_P0 : EP_IGNORE); break;
|
||||||
|
case EP_P0: state = (c == '0' ? EP_P00 : EP_IGNORE); break;
|
||||||
|
case EP_P00: state = (c == '0' ? EP_grblPAUSE : EP_IGNORE); break;
|
||||||
|
|
||||||
case EP_M:
|
case EP_M:
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case ' ': break;
|
case ' ': break;
|
||||||
|
|
@ -116,39 +129,24 @@ public:
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EP_M10:
|
case EP_M10: state = (c == '8') ? EP_M108 : EP_IGNORE; break;
|
||||||
state = (c == '8') ? EP_M108 : EP_IGNORE;
|
case EP_M11: state = (c == '2') ? EP_M112 : EP_IGNORE; break;
|
||||||
break;
|
case EP_M4: state = (c == '1') ? EP_M41 : EP_IGNORE; break;
|
||||||
|
case EP_M41: state = (c == '0') ? EP_M410 : EP_IGNORE; break;
|
||||||
case EP_M11:
|
|
||||||
state = (c == '2') ? EP_M112 : EP_IGNORE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EP_M4:
|
|
||||||
state = (c == '1') ? EP_M41 : EP_IGNORE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EP_M41:
|
|
||||||
state = (c == '0') ? EP_M410 : EP_IGNORE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||||
case EP_M8:
|
|
||||||
state = (c == '7') ? EP_M87 : EP_IGNORE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EP_M87:
|
case EP_M8: state = (c == '7') ? EP_M87 : EP_IGNORE; break;
|
||||||
state = (c == '6') ? EP_M876 : EP_IGNORE;
|
case EP_M87: state = (c == '6') ? EP_M876 : EP_IGNORE; break;
|
||||||
break;
|
|
||||||
|
|
||||||
case EP_M876:
|
|
||||||
switch (c) {
|
|
||||||
case ' ': break;
|
|
||||||
case 'S': state = EP_M876S; break;
|
|
||||||
default: state = EP_IGNORE; break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
case EP_M876:
|
||||||
|
switch (c) {
|
||||||
|
case ' ': break;
|
||||||
|
case 'S': state = EP_M876S; break;
|
||||||
|
default: state = EP_IGNORE; break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case EP_M876S:
|
case EP_M876S:
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case ' ': break;
|
case ' ': break;
|
||||||
|
|
@ -160,6 +158,7 @@ public:
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
case EP_IGNORE:
|
case EP_IGNORE:
|
||||||
if (ISEOL(c)) state = EP_RESET;
|
if (ISEOL(c)) state = EP_RESET;
|
||||||
break;
|
break;
|
||||||
|
|
@ -173,6 +172,9 @@ public:
|
||||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||||
case EP_M876SN: host_response_handler(M876_reason); break;
|
case EP_M876SN: host_response_handler(M876_reason); break;
|
||||||
#endif
|
#endif
|
||||||
|
case EP_grblSTATUS: report_current_position_moving(); break;
|
||||||
|
case EP_grblPAUSE: quickpause_stepper(); break;
|
||||||
|
case EP_grblRESUME: quickresume_stepper(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
state = EP_RESET;
|
state = EP_RESET;
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,9 @@
|
||||||
*/
|
*/
|
||||||
G29_TYPE GcodeSuite::G29() {
|
G29_TYPE GcodeSuite::G29() {
|
||||||
|
|
||||||
|
M_State_grbl = M_PROBE;
|
||||||
|
report_current_grblstate_moving();
|
||||||
|
|
||||||
reset_stepper_timeout();
|
reset_stepper_timeout();
|
||||||
|
|
||||||
const bool seenQ = EITHER(DEBUG_LEVELING_FEATURE, PROBE_MANUALLY) && parser.seen('Q');
|
const bool seenQ = EITHER(DEBUG_LEVELING_FEATURE, PROBE_MANUALLY) && parser.seen('Q');
|
||||||
|
|
@ -885,6 +888,9 @@ G29_TYPE GcodeSuite::G29() {
|
||||||
|
|
||||||
report_current_position();
|
report_current_position();
|
||||||
|
|
||||||
|
M_State_grbl = M_IDLE;
|
||||||
|
report_current_grblstate_moving();
|
||||||
|
|
||||||
G29_RETURN(isnan(measured_z));
|
G29_RETURN(isnan(measured_z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,9 @@ inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM("
|
||||||
*/
|
*/
|
||||||
void GcodeSuite::G29() {
|
void GcodeSuite::G29() {
|
||||||
|
|
||||||
|
M_State_grbl = M_PROBE;
|
||||||
|
report_current_grblstate_moving();
|
||||||
|
|
||||||
static int mbl_probe_index = -1;
|
static int mbl_probe_index = -1;
|
||||||
|
|
||||||
MeshLevelingState state = (MeshLevelingState)parser.byteval('S', (int8_t)MeshReport);
|
MeshLevelingState state = (MeshLevelingState)parser.byteval('S', (int8_t)MeshReport);
|
||||||
|
|
@ -188,6 +191,9 @@ void GcodeSuite::G29() {
|
||||||
}
|
}
|
||||||
|
|
||||||
report_current_position();
|
report_current_position();
|
||||||
|
|
||||||
|
M_State_grbl = M_IDLE;
|
||||||
|
report_current_grblstate_moving();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MESH_BED_LEVELING
|
#endif // MESH_BED_LEVELING
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,18 @@
|
||||||
#include "../../gcode.h"
|
#include "../../gcode.h"
|
||||||
#include "../../../feature/bedlevel/bedlevel.h"
|
#include "../../../feature/bedlevel/bedlevel.h"
|
||||||
|
|
||||||
void GcodeSuite::G29() { ubl.G29(); }
|
#include "../../../MarlinCore.h" // for M_State_grbl
|
||||||
|
|
||||||
|
void GcodeSuite::G29() {
|
||||||
|
|
||||||
|
M_State_grbl = M_PROBE;
|
||||||
|
report_current_grblstate_moving();
|
||||||
|
|
||||||
|
ubl.G29();
|
||||||
|
|
||||||
|
M_State_grbl = M_IDLE;
|
||||||
|
report_current_grblstate_moving();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // AUTO_BED_LEVELING_UBL
|
#endif // AUTO_BED_LEVELING_UBL
|
||||||
|
|
|
||||||
|
|
@ -209,6 +209,9 @@ void GcodeSuite::G28() {
|
||||||
|
|
||||||
TERN_(DWIN_CREALITY_LCD, HMI_flag.home_flag = true);
|
TERN_(DWIN_CREALITY_LCD, HMI_flag.home_flag = true);
|
||||||
|
|
||||||
|
M_State_grbl = M_HOMING;
|
||||||
|
report_current_grblstate_moving();
|
||||||
|
|
||||||
#if ENABLED(DUAL_X_CARRIAGE)
|
#if ENABLED(DUAL_X_CARRIAGE)
|
||||||
bool IDEX_saved_duplication_state = extruder_duplication_enabled;
|
bool IDEX_saved_duplication_state = extruder_duplication_enabled;
|
||||||
DualXMode IDEX_saved_mode = dual_x_carriage_mode;
|
DualXMode IDEX_saved_mode = dual_x_carriage_mode;
|
||||||
|
|
@ -463,6 +466,9 @@ void GcodeSuite::G28() {
|
||||||
if (ENABLED(NANODLP_Z_SYNC) && (doZ || ENABLED(NANODLP_ALL_AXIS)))
|
if (ENABLED(NANODLP_Z_SYNC) && (doZ || ENABLED(NANODLP_ALL_AXIS)))
|
||||||
SERIAL_ECHOLNPGM(STR_Z_MOVE_COMP);
|
SERIAL_ECHOLNPGM(STR_Z_MOVE_COMP);
|
||||||
|
|
||||||
|
M_State_grbl = M_IDLE;
|
||||||
|
report_current_grblstate_moving();
|
||||||
|
|
||||||
#if HAS_L64XX
|
#if HAS_L64XX
|
||||||
// Set L6470 absolute position registers to counts
|
// Set L6470 absolute position registers to counts
|
||||||
// constexpr *might* move this to PROGMEM.
|
// constexpr *might* move this to PROGMEM.
|
||||||
|
|
|
||||||
|
|
@ -385,6 +385,9 @@ static float auto_tune_a() {
|
||||||
*/
|
*/
|
||||||
void GcodeSuite::G33() {
|
void GcodeSuite::G33() {
|
||||||
|
|
||||||
|
M_State_grbl = M_PROBE;
|
||||||
|
report_current_grblstate_moving();
|
||||||
|
|
||||||
const int8_t probe_points = parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
|
const int8_t probe_points = parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
|
||||||
if (!WITHIN(probe_points, 0, 10)) {
|
if (!WITHIN(probe_points, 0, 10)) {
|
||||||
SERIAL_ECHOLNPGM("?(P)oints implausible (0-10).");
|
SERIAL_ECHOLNPGM("?(P)oints implausible (0-10).");
|
||||||
|
|
@ -643,6 +646,9 @@ void GcodeSuite::G33() {
|
||||||
while (((zero_std_dev < test_precision && iterations < 31) || iterations <= force_iterations) && zero_std_dev > calibration_precision);
|
while (((zero_std_dev < test_precision && iterations < 31) || iterations <= force_iterations) && zero_std_dev > calibration_precision);
|
||||||
|
|
||||||
ac_cleanup(TERN_(HAS_MULTI_HOTEND, old_tool_index));
|
ac_cleanup(TERN_(HAS_MULTI_HOTEND, old_tool_index));
|
||||||
|
|
||||||
|
M_State_grbl = M_IDLE;
|
||||||
|
report_current_grblstate_moving();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DELTA_AUTO_CALIBRATION
|
#endif // DELTA_AUTO_CALIBRATION
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ GcodeSuite gcode;
|
||||||
#include "../feature/password/password.h"
|
#include "../feature/password/password.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../MarlinCore.h" // for idle()
|
#include "../MarlinCore.h" // for idle(), M_State_grbl
|
||||||
|
|
||||||
// Inactivity shutdown
|
// Inactivity shutdown
|
||||||
millis_t GcodeSuite::previous_move_ms = 0,
|
millis_t GcodeSuite::previous_move_ms = 0,
|
||||||
|
|
@ -82,6 +82,10 @@ uint8_t GcodeSuite::axis_relative = (
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(HOST_KEEPALIVE_FEATURE)
|
#if ENABLED(HOST_KEEPALIVE_FEATURE)
|
||||||
|
#if !KEEPALIVE_INTERVAL_DIVIDER
|
||||||
|
#undef KEEPALIVE_INTERVAL_DIVIDER
|
||||||
|
#define KEEPALIVE_INTERVAL_DIVIDER 1
|
||||||
|
#endif
|
||||||
GcodeSuite::MarlinBusyState GcodeSuite::busy_state = NOT_BUSY;
|
GcodeSuite::MarlinBusyState GcodeSuite::busy_state = NOT_BUSY;
|
||||||
uint8_t GcodeSuite::host_keepalive_interval = DEFAULT_KEEPALIVE_INTERVAL;
|
uint8_t GcodeSuite::host_keepalive_interval = DEFAULT_KEEPALIVE_INTERVAL;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -256,8 +260,15 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Handle a known G, M, or T
|
// Handle a known G, M, or T (S,P & R from emergency parser)
|
||||||
switch (parser.command_letter) {
|
switch (parser.command_letter) {
|
||||||
|
#if ENABLED(FULL_REPORT_TO_HOST_FEATURE)
|
||||||
|
case 'S': case 'P': case 'R': switch (parser.codenum) {
|
||||||
|
case 0: if(parser.numchars==3) break;
|
||||||
|
default: parser.unknown_command_warning(); break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case 'G': switch (parser.codenum) {
|
case 'G': switch (parser.codenum) {
|
||||||
|
|
||||||
case 0: case 1: // G0: Fast Move, G1: Linear Move
|
case 0: case 1: // G0: Fast Move, G1: Linear Move
|
||||||
|
|
@ -1028,18 +1039,23 @@ void GcodeSuite::process_subcommands_now(char * gcode) {
|
||||||
case IN_HANDLER:
|
case IN_HANDLER:
|
||||||
case IN_PROCESS:
|
case IN_PROCESS:
|
||||||
SERIAL_ECHO_MSG(STR_BUSY_PROCESSING);
|
SERIAL_ECHO_MSG(STR_BUSY_PROCESSING);
|
||||||
|
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_position_moving());
|
||||||
break;
|
break;
|
||||||
case PAUSED_FOR_USER:
|
case PAUSED_FOR_USER:
|
||||||
SERIAL_ECHO_MSG(STR_BUSY_PAUSED_FOR_USER);
|
SERIAL_ECHO_MSG(STR_BUSY_PAUSED_FOR_USER);
|
||||||
|
M_State_grbl = M_HOLD;
|
||||||
|
report_current_grblstate_moving();
|
||||||
break;
|
break;
|
||||||
case PAUSED_FOR_INPUT:
|
case PAUSED_FOR_INPUT:
|
||||||
SERIAL_ECHO_MSG(STR_BUSY_PAUSED_FOR_INPUT);
|
SERIAL_ECHO_MSG(STR_BUSY_PAUSED_FOR_INPUT);
|
||||||
|
M_State_grbl = M_HOLD;
|
||||||
|
report_current_grblstate_moving();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
next_busy_signal_ms = ms + SEC_TO_MS(host_keepalive_interval);
|
next_busy_signal_ms = ms + SEC_TO_MS(host_keepalive_interval) / (KEEPALIVE_INTERVAL_DIVIDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HOST_KEEPALIVE_FEATURE
|
#endif // HOST_KEEPALIVE_FEATURE
|
||||||
|
|
|
||||||
|
|
@ -181,6 +181,7 @@
|
||||||
const xyze_float_t diff = from_steppers - leveled;
|
const xyze_float_t diff = from_steppers - leveled;
|
||||||
SERIAL_ECHOPGM("Diff: ");
|
SERIAL_ECHOPGM("Diff: ");
|
||||||
report_xyze(diff);
|
report_xyze(diff);
|
||||||
|
report_current_grblstate_moving();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // M114_DETAIL
|
#endif // M114_DETAIL
|
||||||
|
|
@ -216,4 +217,5 @@ void GcodeSuite::M114() {
|
||||||
|
|
||||||
TERN_(M114_LEGACY, planner.synchronize());
|
TERN_(M114_LEGACY, planner.synchronize());
|
||||||
report_current_position_projected();
|
report_current_position_projected();
|
||||||
|
report_current_grblstate_moving();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,8 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
|
||||||
| (parser.seen('Z') ? _BV(Z_AXIS) : 0) )
|
| (parser.seen('Z') ? _BV(Z_AXIS) : 0) )
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
|
M_State_grbl = M_RUNNING;
|
||||||
|
report_current_grblstate_moving();
|
||||||
|
|
||||||
#ifdef G0_FEEDRATE
|
#ifdef G0_FEEDRATE
|
||||||
feedRate_t old_feedrate;
|
feedRate_t old_feedrate;
|
||||||
|
|
@ -117,5 +119,10 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
|
||||||
SERIAL_ECHOLNPGM(STR_Z_MOVE_COMP);
|
SERIAL_ECHOLNPGM(STR_Z_MOVE_COMP);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(FULL_REPORT_TO_HOST_FEATURE)
|
||||||
|
TERN_(NANODLP_Z_SYNC, M_State_grbl = M_IDLE);
|
||||||
|
report_current_position_moving();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -292,6 +292,8 @@ void plan_arc(
|
||||||
*/
|
*/
|
||||||
void GcodeSuite::G2_G3(const bool clockwise) {
|
void GcodeSuite::G2_G3(const bool clockwise) {
|
||||||
if (MOTION_CONDITIONS) {
|
if (MOTION_CONDITIONS) {
|
||||||
|
M_State_grbl = M_RUNNING;
|
||||||
|
report_current_grblstate_moving();
|
||||||
|
|
||||||
#if ENABLED(SF_ARC_FIX)
|
#if ENABLED(SF_ARC_FIX)
|
||||||
const bool relative_mode_backup = relative_mode;
|
const bool relative_mode_backup = relative_mode;
|
||||||
|
|
@ -351,6 +353,9 @@ void GcodeSuite::G2_G3(const bool clockwise) {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SERIAL_ERROR_MSG(STR_ERR_ARC_ARGS);
|
SERIAL_ERROR_MSG(STR_ERR_ARC_ARGS);
|
||||||
|
|
||||||
|
M_State_grbl = M_IDLE;
|
||||||
|
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_position_moving());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ char *GCodeParser::command_ptr,
|
||||||
*GCodeParser::value_ptr;
|
*GCodeParser::value_ptr;
|
||||||
char GCodeParser::command_letter;
|
char GCodeParser::command_letter;
|
||||||
int GCodeParser::codenum;
|
int GCodeParser::codenum;
|
||||||
|
int GCodeParser::numchars;
|
||||||
|
|
||||||
#if ENABLED(USE_GCODE_SUBCODES)
|
#if ENABLED(USE_GCODE_SUBCODES)
|
||||||
uint8_t GCodeParser::subcode;
|
uint8_t GCodeParser::subcode;
|
||||||
|
|
@ -147,10 +148,34 @@ void GCodeParser::parse(char *p) {
|
||||||
#define SIGNED_CODENUM 1
|
#define SIGNED_CODENUM 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Bail if the letter is not S, P, or R
|
||||||
|
#if ENABLED(FULL_REPORT_TO_HOST_FEATURE)
|
||||||
|
switch (letter) {
|
||||||
|
case 'S': case 'P': case 'R':
|
||||||
|
// Bail if there's no command code number
|
||||||
|
if (!NUMERIC(*p)) break;
|
||||||
|
// Save the command letter at this point
|
||||||
|
// A '?' signifies an unknown command
|
||||||
|
command_letter = letter;
|
||||||
|
// Get the code number - integer digits only
|
||||||
|
codenum = 0;
|
||||||
|
numchars=0;
|
||||||
|
while (NUMERIC(*p)) {
|
||||||
|
codenum += *p++ - '0';
|
||||||
|
codenum *= 10;
|
||||||
|
numchars++;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Bail if the letter is not G, M, or T
|
// Bail if the letter is not G, M, or T
|
||||||
// (or a valid parameter for the current motion mode)
|
// (or a valid parameter for the current motion mode)
|
||||||
switch (letter) {
|
|
||||||
|
|
||||||
|
switch (letter) {
|
||||||
case 'G': case 'M': case 'T': TERN_(MARLIN_DEV_MODE, case 'D':)
|
case 'G': case 'M': case 'T': TERN_(MARLIN_DEV_MODE, case 'D':)
|
||||||
// Skip spaces to get the numeric part
|
// Skip spaces to get the numeric part
|
||||||
while (*p == ' ') p++;
|
while (*p == ' ') p++;
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,7 @@ public:
|
||||||
*string_arg, // string of command line
|
*string_arg, // string of command line
|
||||||
command_letter; // G, M, or T
|
command_letter; // G, M, or T
|
||||||
static int codenum; // 123
|
static int codenum; // 123
|
||||||
|
static int numchars; // 123
|
||||||
#if ENABLED(USE_GCODE_SUBCODES)
|
#if ENABLED(USE_GCODE_SUBCODES)
|
||||||
static uint8_t subcode; // .1
|
static uint8_t subcode; // .1
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -245,6 +245,48 @@ void report_current_position_projected() {
|
||||||
stepper.report_a_position(planner.position);
|
stepper.report_a_position(planner.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output the current position (processed) to serial while moving
|
||||||
|
*/
|
||||||
|
void report_current_position_moving() {
|
||||||
|
|
||||||
|
get_cartesian_from_steppers();
|
||||||
|
const xyz_pos_t lpos = cartes.asLogical();
|
||||||
|
SERIAL_ECHOPAIR("X:", lpos.x, " Y:", lpos.y, " Z:", lpos.z, " E:", current_position.e);
|
||||||
|
|
||||||
|
stepper.report_positions();
|
||||||
|
#if IS_SCARA
|
||||||
|
scara_report_positions();
|
||||||
|
#endif
|
||||||
|
report_current_grblstate_moving();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output the current grbl compatible state to serial while moving
|
||||||
|
*/
|
||||||
|
void report_current_grblstate_moving() {
|
||||||
|
#if ENABLED(FULL_REPORT_TO_HOST_FEATURE)
|
||||||
|
SERIAL_ECHOPAIR("S_XYZ:", M_State_grbl);
|
||||||
|
SERIAL_EOL();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* grbl compatible state to marlin_state
|
||||||
|
*/
|
||||||
|
void set_M_state_from_marlin_state() {
|
||||||
|
switch (marlin_state) {
|
||||||
|
case MF_INITIALIZING: M_State_grbl = M_INIT; break;
|
||||||
|
case MF_SD_COMPLETE: M_State_grbl = M_ALARM; break;
|
||||||
|
case MF_WAITING: M_State_grbl = M_IDLE; break;
|
||||||
|
case MF_STOPPED: M_State_grbl = M_END; break;
|
||||||
|
case MF_RUNNING: M_State_grbl = M_RUNNING; break;
|
||||||
|
case MF_PAUSED: M_State_grbl = M_HOLD; break;
|
||||||
|
case MF_KILLED: M_State_grbl = M_ERROR; break;
|
||||||
|
default: M_State_grbl = M_IDLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sync_plan_position
|
* sync_plan_position
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -201,6 +201,9 @@ inline float home_bump_mm(const AxisEnum axis) {
|
||||||
void report_real_position();
|
void report_real_position();
|
||||||
void report_current_position();
|
void report_current_position();
|
||||||
void report_current_position_projected();
|
void report_current_position_projected();
|
||||||
|
void report_current_position_moving();
|
||||||
|
void report_current_grblstate_moving();
|
||||||
|
void set_M_state_from_marlin_state();
|
||||||
|
|
||||||
void get_cartesian_from_steppers();
|
void get_cartesian_from_steppers();
|
||||||
void set_current_from_steppers_for_axis(const AxisEnum axis);
|
void set_current_from_steppers_for_axis(const AxisEnum axis);
|
||||||
|
|
|
||||||
|
|
@ -1592,6 +1592,23 @@ void Planner::quick_stop() {
|
||||||
stepper.quick_stop();
|
stepper.quick_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Planner::quick_pause() {
|
||||||
|
// Suspend until quick_resume is called
|
||||||
|
// Don't empty buffers or queues
|
||||||
|
if (stepper.suspend()) {
|
||||||
|
M_State_grbl = M_HOLD;
|
||||||
|
report_current_grblstate_moving();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Planner::quick_resume() {
|
||||||
|
// Resume if suspended
|
||||||
|
set_M_state_from_marlin_state();
|
||||||
|
report_current_grblstate_moving();
|
||||||
|
stepper.wake_up();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Planner::endstop_triggered(const AxisEnum axis) {
|
void Planner::endstop_triggered(const AxisEnum axis) {
|
||||||
// Record stepper position and discard the current block
|
// Record stepper position and discard the current block
|
||||||
stepper.endstop_triggered(axis);
|
stepper.endstop_triggered(axis);
|
||||||
|
|
|
||||||
|
|
@ -829,6 +829,11 @@ class Planner {
|
||||||
// a Full Shutdown is required, or when endstops are hit)
|
// a Full Shutdown is required, or when endstops are hit)
|
||||||
static void quick_stop();
|
static void quick_stop();
|
||||||
|
|
||||||
|
// Force a quick pause of the machine (for example, when a pause
|
||||||
|
// is required in the middle of move)
|
||||||
|
static void quick_pause();
|
||||||
|
static void quick_resume();
|
||||||
|
|
||||||
// Called when an endstop is triggered. Causes the machine to stop inmediately
|
// Called when an endstop is triggered. Causes the machine to stop inmediately
|
||||||
static void endstop_triggered(const AxisEnum axis);
|
static void endstop_triggered(const AxisEnum axis);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue