G4 定义如下:
#include "../gcode.h"
#include "../../module/stepper.h"
#include "../../lcd/marlinui.h"
/**
* G4: Dwell S<seconds> or P<milliseconds>
*/
void GcodeSuite::G4() {
millis_t dwell_ms = 0;
if (parser.seenval('P')) dwell_ms = parser.value_millis(); // milliseconds to wait
if (parser.seenval('S')) dwell_ms = parser.value_millis_from_seconds(); // seconds to wait
planner.synchronize();
#if ENABLED(NANODLP_Z_SYNC)
SERIAL_ECHOLNPGM(STR_Z_MOVE_COMP);
#endif
if (!ui.has_status()) LCD_MESSAGE(MSG_DWELL);
dwell(dwell_ms);
}
M603 定义如下:
/**
* M603: Configure filament change
*
* T[toolhead] - Select extruder to configure, active extruder if not specified
* U[distance] - Retract distance for removal, for the specified extruder
* L[distance] - Extrude distance for insertion, for the specified extruder
*/
void GcodeSuite::M603() {
if (!parser.seen("TUL")) return M603_report();
const int8_t target_extruder = get_target_extruder_from_command();
if (target_extruder < 0) return;
// Unload length
if (parser.seenval('U')) {
fc_settings[target_extruder].unload_length = ABS(parser.value_axis_units(E_AXIS));
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
NOMORE(fc_settings[target_extruder].unload_length, EXTRUDE_MAXLENGTH);
#endif
}
// Load length
if (parser.seenval('L')) {
fc_settings[target_extruder].load_length = ABS(parser.value_axis_units(E_AXIS));
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
NOMORE(fc_settings[target_extruder].load_length, EXTRUDE_MAXLENGTH);
#endif
}
}