Realtime Reporting, S000, P000, R000 (#19330)

This commit is contained in:
fedetony
2021-04-16 08:59:28 +02:00
committed by GitHub
parent 58cc4b7043
commit 32dba5e0c7
17 changed files with 275 additions and 70 deletions

View File

@ -217,9 +217,10 @@ public:
* There's no extra effect if you have a fixed Z probe.
*/
G29_TYPE GcodeSuite::G29() {
TERN_(PROBE_MANUALLY, static) G29_State abl;
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
reset_stepper_timeout();
const bool seenQ = EITHER(DEBUG_LEVELING_FEATURE, PROBE_MANUALLY) && parser.seen('Q');
@ -897,6 +898,8 @@ G29_TYPE GcodeSuite::G29() {
report_current_position();
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
G29_RETURN(ISNAN(abl.measured_z));
}

View File

@ -60,6 +60,8 @@ inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM("
*/
void GcodeSuite::G29() {
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
static int mbl_probe_index = -1;
MeshLevelingState state = (MeshLevelingState)parser.byteval('S', (int8_t)MeshReport);
@ -187,6 +189,8 @@ void GcodeSuite::G29() {
}
report_current_position();
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
}
#endif // MESH_BED_LEVELING

View File

@ -31,6 +31,17 @@
#include "../../gcode.h"
#include "../../../feature/bedlevel/bedlevel.h"
void GcodeSuite::G29() { ubl.G29(); }
#if ENABLED(FULL_REPORT_TO_HOST_FEATURE)
#include "../../../module/motion.h"
#endif
void GcodeSuite::G29() {
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
ubl.G29();
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
}
#endif // AUTO_BED_LEVELING_UBL

View File

@ -211,6 +211,8 @@ void GcodeSuite::G28() {
TERN_(LASER_MOVE_G28_OFF, cutter.set_inline_enabled(false)); // turn off laser
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_HOMING));
#if ENABLED(DUAL_X_CARRIAGE)
bool IDEX_saved_duplication_state = extruder_duplication_enabled;
DualXMode IDEX_saved_mode = dual_x_carriage_mode;
@ -479,6 +481,8 @@ void GcodeSuite::G28() {
if (ENABLED(NANODLP_Z_SYNC) && (doZ || ENABLED(NANODLP_ALL_AXIS)))
SERIAL_ECHOLNPGM(STR_Z_MOVE_COMP);
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
#if HAS_L64XX
// Set L6470 absolute position registers to counts
// constexpr *might* move this to PROGMEM.

View File

@ -387,6 +387,8 @@ static float auto_tune_a() {
*/
void GcodeSuite::G33() {
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
const int8_t probe_points = parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
if (!WITHIN(probe_points, 0, 10)) {
SERIAL_ECHOLNPGM("?(P)oints implausible (0-10).");
@ -645,6 +647,8 @@ void GcodeSuite::G33() {
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));
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
}
#endif // DELTA_AUTO_CALIBRATION

View File

@ -289,8 +289,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
}
#endif
// Handle a known G, M, or T
// Handle a known command or reply "unknown command"
switch (parser.command_letter) {
case 'G': switch (parser.codenum) {
case 0: case 1: // G0: Fast Move, G1: Linear Move
@ -995,6 +997,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 'D': D(parser.codenum); break; // Dn: Debug codes
#endif
#if ENABLED(REALTIME_REPORTING_COMMANDS)
case 'S': case 'P': case 'R': break; // Invalid S, P, R commands already filtered
#endif
default:
#if ENABLED(WIFI_CUSTOM_COMMAND)
if (wifi_custom_command(parser.command_ptr)) break;
@ -1087,12 +1093,15 @@ void GcodeSuite::process_subcommands_now(char * gcode) {
case IN_HANDLER:
case IN_PROCESS:
SERIAL_ECHO_MSG(STR_BUSY_PROCESSING);
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_position_moving());
break;
case PAUSED_FOR_USER:
SERIAL_ECHO_MSG(STR_BUSY_PAUSED_FOR_USER);
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_HOLD));
break;
case PAUSED_FOR_INPUT:
SERIAL_ECHO_MSG(STR_BUSY_PAUSED_FOR_INPUT);
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_HOLD));
break;
default:
break;

View File

@ -176,6 +176,8 @@
const xyze_float_t diff = from_steppers - leveled;
SERIAL_ECHOPGM("Diff: ");
report_xyze(diff);
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_grblstate_moving());
}
#endif // M114_DETAIL
@ -211,4 +213,6 @@ void GcodeSuite::M114() {
TERN_(M114_LEGACY, planner.synchronize());
report_current_position_projected();
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_grblstate_moving());
}

View File

@ -54,6 +54,7 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
| (parser.seen('Z') ? _BV(Z_AXIS) : 0) )
#endif
) {
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_RUNNING));
#ifdef G0_FEEDRATE
feedRate_t old_feedrate;
@ -116,6 +117,9 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
planner.synchronize();
SERIAL_ECHOLNPGM(STR_Z_MOVE_COMP);
}
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
#else
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_grblstate_moving());
#endif
}
}

View File

@ -306,6 +306,8 @@ void plan_arc(
void GcodeSuite::G2_G3(const bool clockwise) {
if (MOTION_CONDITIONS) {
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_RUNNING));
#if ENABLED(SF_ARC_FIX)
const bool relative_mode_backup = relative_mode;
relative_mode = true;
@ -364,6 +366,8 @@ void GcodeSuite::G2_G3(const bool clockwise) {
}
else
SERIAL_ERROR_MSG(STR_ERR_ARC_ARGS);
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
}
}

View File

@ -106,8 +106,10 @@ void GCodeParser::reset() {
#endif
// Populate all fields by parsing a single line of GCode
// 58 bytes of SRAM are used to speed up seen/value
/**
* Populate the command line state (command_letter, codenum, subcode, and string_arg)
* by parsing a single line of GCode. 58 bytes of SRAM are used to speed up seen/value.
*/
void GCodeParser::parse(char *p) {
reset(); // No codes to report
@ -147,10 +149,12 @@ void GCodeParser::parse(char *p) {
#define SIGNED_CODENUM 1
#endif
// Bail if the letter is not G, M, or T
// (or a valid parameter for the current motion mode)
/**
* Screen for good command letters. G, M, and T are always accepted.
* With Motion Modes enabled any axis letter can come first.
* With Realtime Reporting, commands S000, P000, and R000 are allowed.
*/
switch (letter) {
case 'G': case 'M': case 'T': TERN_(MARLIN_DEV_MODE, case 'D':)
// Skip spaces to get the numeric part
while (*p == ' ') p++;
@ -227,6 +231,15 @@ void GCodeParser::parse(char *p) {
break;
#endif // GCODE_MOTION_MODES
#if ENABLED(REALTIME_REPORTING_COMMANDS)
case 'S': case 'P': case 'R': {
codenum = 0; // The only valid codenum is 0
uint8_t digits = 0;
while (*p++ == '0') digits++; // Count up '0' characters
command_letter = (digits == 3) ? letter : '?'; // Three '0' digits is a good command
} return; // No parameters, so return
#endif
default: return;
}