🎨 Standardize G-code reporting

This commit is contained in:
Scott Lahteine 2021-09-07 18:06:10 -05:00 committed by Scott Lahteine
parent a596faf4e5
commit 6d96c221bd
48 changed files with 1360 additions and 1170 deletions

View File

@ -235,7 +235,7 @@ static void print_is_also_tied() { SERIAL_ECHOPGM(" is also tied to this pin");
inline void com_print(const uint8_t N, const uint8_t Z) {
const uint8_t *TCCRA = (uint8_t*)TCCR_A(N);
SERIAL_ECHOPAIR(" COM", AS_CHAR('0' + N));
SERIAL_ECHOPAIR(" COM", AS_DIGIT(N));
SERIAL_CHAR(Z);
SERIAL_ECHOPAIR(": ", int((*TCCRA >> (6 - Z * 2)) & 0x03));
}
@ -247,7 +247,7 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N -
uint8_t WGM = (((*TCCRB & _BV(WGM_2)) >> 1) | (*TCCRA & (_BV(WGM_0) | _BV(WGM_1))));
if (N == 4) WGM |= ((*TCCRB & _BV(WGM_3)) >> 1);
SERIAL_ECHOPAIR(" TIMER", AS_CHAR(T + '0'));
SERIAL_ECHOPAIR(" TIMER", AS_DIGIT(T));
SERIAL_CHAR(L);
SERIAL_ECHO_SP(3);
@ -262,11 +262,11 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N -
SERIAL_ECHOPAIR(" WGM: ", WGM);
com_print(T,L);
SERIAL_ECHOPAIR(" CS: ", (*TCCRB & (_BV(CS_0) | _BV(CS_1) | _BV(CS_2)) ));
SERIAL_ECHOPAIR(" TCCR", AS_CHAR(T + '0'), "A: ", *TCCRA);
SERIAL_ECHOPAIR(" TCCR", AS_CHAR(T + '0'), "B: ", *TCCRB);
SERIAL_ECHOPAIR(" TCCR", AS_DIGIT(T), "A: ", *TCCRA);
SERIAL_ECHOPAIR(" TCCR", AS_DIGIT(T), "B: ", *TCCRB);
const uint8_t *TMSK = (uint8_t*)TIMSK(T);
SERIAL_ECHOPAIR(" TIMSK", AS_CHAR(T + '0'), ": ", *TMSK);
SERIAL_ECHOPAIR(" TIMSK", AS_DIGIT(T), ": ", *TMSK);
const uint8_t OCIE = L - 'A' + 1;
if (N == 3) { if (WGM == 0 || WGM == 2 || WGM == 4 || WGM == 6) err_is_counter(); }

View File

@ -158,9 +158,7 @@
#define STR_OFF "OFF"
#define STR_ENDSTOP_HIT "TRIGGERED"
#define STR_ENDSTOP_OPEN "open"
#define STR_HOTEND_OFFSET "Hotend offsets:"
#define STR_DUPLICATION_MODE "Duplication mode: "
#define STR_SOFT_ENDSTOPS "Soft endstops: "
#define STR_SOFT_MIN " Min: "
#define STR_SOFT_MAX " Max: "
@ -262,6 +260,49 @@
#define STR_REMINDER_SAVE_SETTINGS "Remember to save!"
#define STR_PASSWORD_SET "Password is "
// Settings Report Strings
#define STR_Z_AUTO_ALIGN "Z Auto-Align"
#define STR_BACKLASH_COMPENSATION "Backlash compensation"
#define STR_DELTA_SETTINGS "Delta settings (L<diagonal-rod> R<radius> H<height> S<segments-per-sec> XYZ<tower-angle-trim> ABC<rod-trim>)"
#define STR_SCARA_SETTINGS "SCARA settings"
#define STR_SCARA_S "S<seg-per-sec>"
#define STR_SCARA_P_T_Z "P<theta-psi-offset> T<theta-offset> Z<home-offset>"
#define STR_ENDSTOP_ADJUSTMENT "Endstop adjustment"
#define STR_SKEW_FACTOR "Skew Factor"
#define STR_FILAMENT_SETTINGS "Filament settings"
#define STR_MAX_ACCELERATION "Max Acceleration (units/s2)"
#define STR_MAX_FEEDRATES "Max feedrates (units/s)"
#define STR_ACCELERATION_P_R_T "Acceleration (units/s2) (P<print-accel> R<retract-accel> T<travel-accel>)"
#define STR_TOOL_CHANGING "Tool-changing"
#define STR_HOTEND_OFFSETS "Hotend offsets"
#define STR_SERVO_ANGLES "Servo Angles"
#define STR_HOTEND_PID "Hotend PID"
#define STR_BED_PID "Bed PID"
#define STR_CHAMBER_PID "Chamber PID"
#define STR_STEPS_PER_UNIT "Steps per unit"
#define STR_LINEAR_ADVANCE "Linear Advance"
#define STR_CONTROLLER_FAN "Controller Fan"
#define STR_STEPPER_MOTOR_CURRENTS "Stepper motor currents"
#define STR_RETRACT_S_F_Z "Retract (S<length> F<feedrate> Z<lift>)"
#define STR_RECOVER_S_F "Recover (S<length> F<feedrate>)"
#define STR_AUTO_RETRACT_S "Auto-Retract (S<enable>)"
#define STR_FILAMENT_LOAD_UNLOAD "Filament load/unload"
#define STR_POWER_LOSS_RECOVERY "Power-loss recovery"
#define STR_FILAMENT_RUNOUT_SENSOR "Filament runout sensor"
#define STR_DRIVER_STEPPING_MODE "Driver stepping mode"
#define STR_STEPPER_DRIVER_CURRENT "Stepper driver current"
#define STR_HYBRID_THRESHOLD "Hybrid Threshold"
#define STR_STALLGUARD_THRESHOLD "StallGuard threshold"
#define STR_HOME_OFFSET "Home offset"
#define STR_SOFT_ENDSTOPS "Soft endstops"
#define STR_MATERIAL_HEATUP "Material heatup parameters"
#define STR_LCD_CONTRAST "LCD Contrast"
#define STR_LCD_BRIGHTNESS "LCD Brightness"
#define STR_UI_LANGUAGE "UI Language"
#define STR_Z_PROBE_OFFSET "Z-Probe Offset"
#define STR_TEMPERATURE_UNITS "Temperature Units"
#define STR_USER_THERMISTORS "User thermistors"
//
// Endstop Names used by Endstops::report_states
//
@ -290,7 +331,7 @@
#define STR_Z_PROBE "z_probe"
#define STR_PROBE_EN "probe_en"
#define STR_FILAMENT_RUNOUT_SENSOR "filament"
#define STR_FILAMENT "filament"
// General axis names
#define STR_X "X"

View File

@ -55,6 +55,8 @@ struct IF<true, L, R> { typedef L type; };
#define LOGICAL_AXIS_ELEM(O) LOGICAL_AXIS_LIST(O.e, O.x, O.y, O.z, O.i, O.j, O.k)
#define LOGICAL_AXIS_DECL(T,V) LOGICAL_AXIS_LIST(T e=V, T x=V, T y=V, T z=V, T i=V, T j=V, T k=V)
#define LOGICAL_AXES_STRING LOGICAL_AXIS_GANG("E", "X", "Y", "Z", AXIS4_STR, AXIS5_STR, AXIS6_STR)
#if HAS_EXTRUDERS
#define LIST_ITEM_E(N) , N
#define CODE_ITEM_E(N) ; N

View File

@ -36,7 +36,7 @@ FWRetract fwretract; // Single instance - this calls the constructor
#include "../module/planner.h"
#include "../module/stepper.h"
#include "../gcode/parser.h"
#include "../gcode/gcode.h"
#if ENABLED(RETRACT_SYNC_MIXING)
#include "mixing.h"
@ -214,8 +214,7 @@ void FWRetract::M207() {
if (parser.seenval('W')) settings.swap_retract_length = parser.value_axis_units(E_AXIS);
}
void FWRetract::M207_report(const bool forReplay/*=false*/) {
if (!forReplay) { SERIAL_ECHO_MSG("; Retract: S<length> F<units/m> Z<lift>"); SERIAL_ECHO_START(); }
void FWRetract::M207_report() {
SERIAL_ECHOLNPAIR_P(
PSTR(" M207 S"), LINEAR_UNIT(settings.retract_length)
, PSTR(" W"), LINEAR_UNIT(settings.swap_retract_length)
@ -240,8 +239,7 @@ void FWRetract::M208() {
if (parser.seen('W')) settings.swap_retract_recover_extra = parser.value_axis_units(E_AXIS);
}
void FWRetract::M208_report(const bool forReplay/*=false*/) {
if (!forReplay) { SERIAL_ECHO_MSG("; Recover: S<length> F<units/m>"); SERIAL_ECHO_START(); }
void FWRetract::M208_report() {
SERIAL_ECHOLNPAIR(
" M208 S", LINEAR_UNIT(settings.retract_recover_extra)
, " W", LINEAR_UNIT(settings.swap_retract_recover_extra)
@ -262,8 +260,7 @@ void FWRetract::M208_report(const bool forReplay/*=false*/) {
enable_autoretract(parser.value_bool());
}
void FWRetract::M209_report(const bool forReplay/*=false*/) {
if (!forReplay) { SERIAL_ECHO_MSG("; Auto-Retract: S=0 to disable, 1 to interpret E-only moves as retract/recover"); SERIAL_ECHO_START(); }
void FWRetract::M209_report() {
SERIAL_ECHOLNPAIR(" M209 S", AS_DIGIT(autoretract_enabled));
}

View File

@ -76,13 +76,13 @@ public:
static void retract(const bool retracting OPTARG(HAS_MULTI_EXTRUDER, bool swapping = false));
static void M207_report();
static void M207();
static void M207_report(const bool forReplay=false);
static void M208_report();
static void M208();
static void M208_report(const bool forReplay=false);
#if ENABLED(FWRETRACT_AUTORETRACT)
static void M209_report();
static void M209();
static void M209_report(const bool forReplay=false);
#endif
};

View File

@ -242,4 +242,18 @@ void GcodeSuite::M420() {
report_current_position();
}
void GcodeSuite::M420_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(
TERN(MESH_BED_LEVELING, "Mesh Bed Leveling", TERN(AUTO_BED_LEVELING_UBL, "Unified Bed Leveling", "Auto Bed Leveling"))
));
SERIAL_ECHOPAIR_P(
PSTR(" M420 S"), planner.leveling_active
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
, SP_Z_STR, LINEAR_UNIT(planner.z_fade_height)
#endif
, " ; Leveling "
);
serialprintln_onoff(planner.leveling_active);
}
#endif // HAS_LEVELING

View File

@ -475,21 +475,13 @@ void GcodeSuite::G34() {
*/
void GcodeSuite::M422() {
if (!parser.seen_any()) return M422_report();
if (parser.seen('R')) {
z_stepper_align.reset_to_default();
return;
}
if (!parser.seen_any()) {
LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS)
SERIAL_ECHOLNPAIR_P(PSTR("M422 S"), i + 1, SP_X_STR, z_stepper_align.xy[i].x, SP_Y_STR, z_stepper_align.xy[i].y);
#if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS)
SERIAL_ECHOLNPAIR_P(PSTR("M422 W"), i + 1, SP_X_STR, z_stepper_align.stepper_xy[i].x, SP_Y_STR, z_stepper_align.stepper_xy[i].y);
#endif
return;
}
const bool is_probe_point = parser.seen('S');
if (TERN0(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS, is_probe_point && parser.seen('W'))) {
@ -545,4 +537,26 @@ void GcodeSuite::M422() {
pos_dest[position_index] = pos;
}
void GcodeSuite::M422_report(const bool forReplay/*=true*/) {
report_heading(forReplay, PSTR(STR_Z_AUTO_ALIGN));
LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) {
report_echo_start(forReplay);
SERIAL_ECHOLNPAIR_P(
PSTR(" M422 S"), i + 1,
SP_X_STR, z_stepper_align.xy[i].x,
SP_Y_STR, z_stepper_align.xy[i].y
);
}
#if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) {
report_echo_start(forReplay);
SERIAL_ECHOLNPAIR_P(
PSTR(" M422 W"), i + 1,
SP_X_STR, z_stepper_align.stepper_xy[i].x,
SP_Y_STR, z_stepper_align.stepper_xy[i].y
);
}
#endif
}
#endif // Z_STEPPER_AUTO_ALIGN

View File

@ -113,4 +113,22 @@ void GcodeSuite::M425() {
}
}
void GcodeSuite::M425_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_BACKLASH_COMPENSATION));
SERIAL_ECHOLNPAIR_P(
PSTR(" M425 F"), backlash.get_correction()
#ifdef BACKLASH_SMOOTHING_MM
, PSTR(" S"), LINEAR_UNIT(backlash.smoothing_mm)
#endif
, LIST_N(DOUBLE(LINEAR_AXES),
SP_X_STR, LINEAR_UNIT(backlash.distance_mm.x),
SP_Y_STR, LINEAR_UNIT(backlash.distance_mm.y),
SP_Z_STR, LINEAR_UNIT(backlash.distance_mm.z),
SP_I_STR, LINEAR_UNIT(backlash.distance_mm.i),
SP_J_STR, LINEAR_UNIT(backlash.distance_mm.j),
SP_K_STR, LINEAR_UNIT(backlash.distance_mm.k)
)
);
}
#endif // BACKLASH_GCODE

View File

@ -30,6 +30,7 @@
#if ENABLED(DELTA)
#include "../../module/delta.h"
/**
* M665: Set delta configurations
*
@ -45,6 +46,8 @@
* C = Gamma (Tower 3) diagonal rod trim
*/
void GcodeSuite::M665() {
if (!parser.seen_any()) return M665_report();
if (parser.seenval('H')) delta_height = parser.value_linear_units();
if (parser.seenval('L')) delta_diagonal_rod = parser.value_linear_units();
if (parser.seenval('R')) delta_radius = parser.value_linear_units();
@ -58,6 +61,22 @@
recalc_delta_settings();
}
void GcodeSuite::M665_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_DELTA_SETTINGS));
SERIAL_ECHOLNPAIR_P(
PSTR(" M665 L"), LINEAR_UNIT(delta_diagonal_rod)
, PSTR(" R"), LINEAR_UNIT(delta_radius)
, PSTR(" H"), LINEAR_UNIT(delta_height)
, PSTR(" S"), segments_per_second
, SP_X_STR, LINEAR_UNIT(delta_tower_angle_trim.a)
, SP_Y_STR, LINEAR_UNIT(delta_tower_angle_trim.b)
, SP_Z_STR, LINEAR_UNIT(delta_tower_angle_trim.c)
, PSTR(" A"), LINEAR_UNIT(delta_diagonal_rod_trim.a)
, PSTR(" B"), LINEAR_UNIT(delta_diagonal_rod_trim.b)
, PSTR(" C"), LINEAR_UNIT(delta_diagonal_rod_trim.c)
);
}
#elif IS_SCARA
#include "../../module/scara.h"
@ -68,6 +87,9 @@
* Parameters:
*
* S[segments-per-second] - Segments-per-second
*
* Without NO_WORKSPACE_OFFSETS:
*
* P[theta-psi-offset] - Theta-Psi offset, added to the shoulder (A/X) angle
* T[theta-offset] - Theta offset, added to the elbow (B/Y) angle
* Z[z-offset] - Z offset, added to Z
@ -76,6 +98,8 @@
* B, T, and Y are all aliases for the elbow angle
*/
void GcodeSuite::M665() {
if (!parser.seen_any()) return M665_report();
if (parser.seenval('S')) segments_per_second = parser.value_float();
#if HAS_SCARA_OFFSET
@ -107,6 +131,18 @@
#endif // HAS_SCARA_OFFSET
}
void GcodeSuite::M665_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_SCARA_SETTINGS " (" STR_SCARA_S TERN_(HAS_SCARA_OFFSET, " " STR_SCARA_P_T_Z) ")"));
SERIAL_ECHOLNPAIR_P(
PSTR(" M665 S"), segments_per_second
#if HAS_SCARA_OFFSET
, SP_P_STR, scara_home_offset.a
, SP_T_STR, scara_home_offset.b
, SP_Z_STR, LINEAR_UNIT(scara_home_offset.z)
#endif
);
}
#endif
#endif // IS_KINEMATIC

View File

@ -36,38 +36,6 @@
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../../core/debug_out.h"
void M666_report(const bool forReplay=true) {
if (!forReplay) { SERIAL_ECHOLNPGM("; Endstop adjustment:"); SERIAL_ECHO_START(); }
#if ENABLED(DELTA)
SERIAL_ECHOLNPAIR_P(
PSTR(" M666 X"), LINEAR_UNIT(delta_endstop_adj.a)
, SP_Y_STR, LINEAR_UNIT(delta_endstop_adj.b)
, SP_Z_STR, LINEAR_UNIT(delta_endstop_adj.c)
);
#else
SERIAL_ECHOPGM(" M666");
#if ENABLED(X_DUAL_ENDSTOPS)
SERIAL_ECHOLNPAIR_P(SP_X_STR, LINEAR_UNIT(endstops.x2_endstop_adj));
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
SERIAL_ECHOLNPAIR_P(SP_Y_STR, LINEAR_UNIT(endstops.y2_endstop_adj));
#endif
#if ENABLED(Z_MULTI_ENDSTOPS)
#if NUM_Z_STEPPER_DRIVERS >= 3
SERIAL_ECHOPAIR(" S2 Z", LINEAR_UNIT(endstops.z3_endstop_adj));
if (!forReplay) SERIAL_ECHO_START();
SERIAL_ECHOPAIR(" M666 S3 Z", LINEAR_UNIT(endstops.z3_endstop_adj));
#if NUM_Z_STEPPER_DRIVERS >= 4
if (!forReplay) SERIAL_ECHO_START();
SERIAL_ECHOPAIR(" M666 S4 Z", LINEAR_UNIT(endstops.z4_endstop_adj));
#endif
#else
SERIAL_ECHOLNPAIR_P(SP_Z_STR, LINEAR_UNIT(endstops.z2_endstop_adj));
#endif
#endif
#endif
}
#if ENABLED(DELTA)
/**
@ -92,6 +60,15 @@ void M666_report(const bool forReplay=true) {
if (!is_set) M666_report();
}
void GcodeSuite::M666_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_ENDSTOP_ADJUSTMENT));
SERIAL_ECHOLNPAIR_P(
PSTR(" M666 X"), LINEAR_UNIT(delta_endstop_adj.a)
, SP_Y_STR, LINEAR_UNIT(delta_endstop_adj.b)
, SP_Z_STR, LINEAR_UNIT(delta_endstop_adj.c)
);
}
#else
/**
@ -105,6 +82,8 @@ void M666_report(const bool forReplay=true) {
* Set All: M666 Z<offset>
*/
void GcodeSuite::M666() {
if (!parser.seen_any()) return M666_report();
#if ENABLED(X_DUAL_ENDSTOPS)
if (parser.seenval('X')) endstops.x2_endstop_adj = parser.value_linear_units();
#endif
@ -123,7 +102,30 @@ void M666_report(const bool forReplay=true) {
#endif
}
#endif
if (!parser.seen("XYZ")) M666_report();
}
void GcodeSuite::M666_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_ENDSTOP_ADJUSTMENT));
SERIAL_ECHOPGM(" M666");
#if ENABLED(X_DUAL_ENDSTOPS)
SERIAL_ECHOLNPAIR_P(SP_X_STR, LINEAR_UNIT(endstops.x2_endstop_adj));
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
SERIAL_ECHOLNPAIR_P(SP_Y_STR, LINEAR_UNIT(endstops.y2_endstop_adj));
#endif
#if ENABLED(Z_MULTI_ENDSTOPS)
#if NUM_Z_STEPPER_DRIVERS >= 3
SERIAL_ECHOPAIR(" S2 Z", LINEAR_UNIT(endstops.z3_endstop_adj));
report_echo_start(forReplay);
SERIAL_ECHOPAIR(" M666 S3 Z", LINEAR_UNIT(endstops.z3_endstop_adj));
#if NUM_Z_STEPPER_DRIVERS >= 4
report_echo_start(forReplay);
SERIAL_ECHOPAIR(" M666 S4 Z", LINEAR_UNIT(endstops.z4_endstop_adj));
#endif
#else
SERIAL_ECHOLNPAIR_P(SP_Z_STR, LINEAR_UNIT(endstops.z2_endstop_adj));
#endif
#endif
}
#endif // HAS_EXTRA_ENDSTOPS

View File

@ -36,10 +36,11 @@
* K[yz_factor] - New YZ skew factor
*/
void GcodeSuite::M852() {
uint8_t ijk = 0, badval = 0, setval = 0;
if (!parser.seen("SIJK")) return M852_report();
if (parser.seen('I') || parser.seen('S')) {
++ijk;
uint8_t badval = 0, setval = 0;
if (parser.seenval('I') || parser.seenval('S')) {
const float value = parser.value_linear_units();
if (WITHIN(value, SKEW_FACTOR_MIN, SKEW_FACTOR_MAX)) {
if (planner.skew_factor.xy != value) {
@ -53,8 +54,7 @@ void GcodeSuite::M852() {
#if ENABLED(SKEW_CORRECTION_FOR_Z)
if (parser.seen('J')) {
++ijk;
if (parser.seenval('J')) {
const float value = parser.value_linear_units();
if (WITHIN(value, SKEW_FACTOR_MIN, SKEW_FACTOR_MAX)) {
if (planner.skew_factor.xz != value) {
@ -66,8 +66,7 @@ void GcodeSuite::M852() {
++badval;
}
if (parser.seen('K')) {
++ijk;
if (parser.seenval('K')) {
const float value = parser.value_linear_units();
if (WITHIN(value, SKEW_FACTOR_MIN, SKEW_FACTOR_MAX)) {
if (planner.skew_factor.yz != value) {
@ -90,17 +89,18 @@ void GcodeSuite::M852() {
sync_plan_position();
report_current_position();
}
}
if (!ijk) {
SERIAL_ECHO_START();
SERIAL_ECHOPGM("Skew Factor");
SERIAL_ECHOPAIR_F(" XY: ", planner.skew_factor.xy, 6);
#if ENABLED(SKEW_CORRECTION_FOR_Z)
SERIAL_ECHOPAIR_F(" XZ: ", planner.skew_factor.xz, 6);
SERIAL_ECHOPAIR_F(" YZ: ", planner.skew_factor.yz, 6);
#endif
SERIAL_EOL();
}
void GcodeSuite::M852_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_SKEW_FACTOR));
SERIAL_ECHOPAIR_F(" M851 I", planner.skew_factor.xy, 6);
#if ENABLED(SKEW_CORRECTION_FOR_Z)
SERIAL_ECHOPAIR_F(" J", planner.skew_factor.xz, 6);
SERIAL_ECHOPAIR_F(" K", planner.skew_factor.yz, 6);
SERIAL_ECHOLNPGM(" ; XY, XZ, YZ");
#else
SERIAL_ECHOLNPGM(" ; XY");
#endif
}
#endif // SKEW_CORRECTION_GCODE

View File

@ -32,9 +32,14 @@
* T<extruder> - Optional extruder number. Current extruder if omitted.
* D<linear> - Set filament diameter and enable. D0 disables volumetric.
* S<bool> - Turn volumetric ON or OFF.
*
* With VOLUMETRIC_EXTRUDER_LIMIT:
*
* L<float> - Volumetric extruder limit (in mm^3/sec). L0 disables the limit.
*/
void GcodeSuite::M200() {
if (!parser.seen("DST" TERN_(VOLUMETRIC_EXTRUDER_LIMIT, "L")))
return M200_report();
const int8_t target_extruder = get_target_extruder_from_command();
if (target_extruder < 0) return;
@ -69,6 +74,37 @@
planner.calculate_volumetric_multipliers();
}
void GcodeSuite::M200_report(const bool forReplay/*=true*/) {
if (!forReplay) {
report_heading(forReplay, PSTR(STR_FILAMENT_SETTINGS), false);
if (!parser.volumetric_enabled) SERIAL_ECHOPGM(" (Disabled):");
SERIAL_EOL();
report_echo_start(forReplay);
}
#if EXTRUDERS == 1
{
SERIAL_ECHOLNPAIR(
" M200 S", parser.volumetric_enabled, " D", LINEAR_UNIT(planner.filament_size[0])
#if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
, " L", LINEAR_UNIT(planner.volumetric_extruder_limit[0])
#endif
);
}
#else
SERIAL_ECHOLNPAIR(" M200 S", parser.volumetric_enabled);
LOOP_L_N(i, EXTRUDERS) {
report_echo_start(forReplay);
SERIAL_ECHOLNPAIR(
" M200 T", i, " D", LINEAR_UNIT(planner.filament_size[i])
#if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
, " L", LINEAR_UNIT(planner.volumetric_extruder_limit[i])
#endif
);
}
#endif
}
#endif // !NO_VOLUMETRICS
/**
@ -77,6 +113,8 @@
* With multiple extruders use T to specify which one.
*/
void GcodeSuite::M201() {
if (!parser.seen("T" LOGICAL_AXES_STRING))
return M201_report();
const int8_t target_extruder = get_target_extruder_from_command();
if (target_extruder < 0) return;
@ -94,12 +132,40 @@ void GcodeSuite::M201() {
}
}
void GcodeSuite::M201_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_MAX_ACCELERATION));
SERIAL_ECHOLNPAIR_P(
LIST_N(DOUBLE(LINEAR_AXES),
PSTR(" M201 X"), LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[X_AXIS]),
SP_Y_STR, LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Y_AXIS]),
SP_Z_STR, LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Z_AXIS]),
SP_I_STR, LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[I_AXIS]),
SP_J_STR, LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[J_AXIS]),
SP_K_STR, LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[K_AXIS])
)
#if HAS_EXTRUDERS && DISABLED(DISTINCT_E_FACTORS)
, SP_E_STR, VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS])
#endif
);
#if ENABLED(DISTINCT_E_FACTORS)
LOOP_L_N(i, E_STEPPERS) {
report_echo_start(forReplay);
SERIAL_ECHOLNPAIR_P(
PSTR(" M201 T"), i
, SP_E_STR, VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(i)])
);
}
#endif
}
/**
* M203: Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in units/sec
*
* With multiple extruders use T to specify which one.
*/
void GcodeSuite::M203() {
if (!parser.seen("T" LOGICAL_AXES_STRING))
return M203_report();
const int8_t target_extruder = get_target_extruder_from_command();
if (target_extruder < 0) return;
@ -111,6 +177,32 @@ void GcodeSuite::M203() {
}
}
void GcodeSuite::M203_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_MAX_FEEDRATES));
SERIAL_ECHOLNPAIR_P(
LIST_N(DOUBLE(LINEAR_AXES),
PSTR(" M203 X"), LINEAR_UNIT(planner.settings.max_feedrate_mm_s[X_AXIS]),
SP_Y_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Y_AXIS]),
SP_Z_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Z_AXIS]),
SP_I_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[I_AXIS]),
SP_J_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[J_AXIS]),
SP_K_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[K_AXIS])
)
#if HAS_EXTRUDERS && DISABLED(DISTINCT_E_FACTORS)
, SP_E_STR, VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS])
#endif
);
#if ENABLED(DISTINCT_E_FACTORS)
LOOP_L_N(i, E_STEPPERS) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR_P(
PSTR(" M203 T"), i
, SP_E_STR, VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS_N(i)])
);
}
#endif
}
/**
* M204: Set Accelerations in units/sec^2 (M204 P1200 R3000 T3000)
*
@ -119,11 +211,8 @@ void GcodeSuite::M203() {
* T = Travel (non printing) moves
*/
void GcodeSuite::M204() {
if (!parser.seen("PRST")) {
SERIAL_ECHOPAIR("Acceleration: P", planner.settings.acceleration);
SERIAL_ECHOPAIR(" R", planner.settings.retract_acceleration);
SERIAL_ECHOLNPAIR_P(SP_T_STR, planner.settings.travel_acceleration);
}
if (!parser.seen("PRST"))
return M204_report();
else {
//planner.synchronize();
// 'S' for legacy compatibility. Should NOT BE USED for new development
@ -134,6 +223,15 @@ void GcodeSuite::M204() {
}
}
void GcodeSuite::M204_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_ACCELERATION_P_R_T));
SERIAL_ECHOLNPAIR_P(
PSTR(" M204 P"), LINEAR_UNIT(planner.settings.acceleration)
, PSTR(" R"), LINEAR_UNIT(planner.settings.retract_acceleration)
, SP_T_STR, LINEAR_UNIT(planner.settings.travel_acceleration)
);
}
/**
* M205: Set Advanced Settings
*
@ -147,7 +245,8 @@ void GcodeSuite::M204() {
* J = Junction Deviation (mm) (If not using CLASSIC_JERK)
*/
void GcodeSuite::M205() {
if (!parser.seen("BST" TERN_(HAS_JUNCTION_DEVIATION, "J") TERN_(HAS_CLASSIC_JERK, "XYZE"))) return;
if (!parser.seen("BST" TERN_(HAS_JUNCTION_DEVIATION, "J") TERN_(HAS_CLASSIC_JERK, "XYZE")))
return M205_report();
//planner.synchronize();
if (parser.seenval('B')) planner.settings.min_segment_time_us = parser.value_ulong();
@ -184,3 +283,34 @@ void GcodeSuite::M205() {
#endif
#endif // HAS_CLASSIC_JERK
}
void GcodeSuite::M205_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(
"Advanced (B<min_segment_time_us> S<min_feedrate> T<min_travel_feedrate>"
TERN_(HAS_JUNCTION_DEVIATION, " J<junc_dev>")
TERN_(HAS_CLASSIC_JERK, " X<max_x_jerk> Y<max_y_jerk> Z<max_z_jerk>")
TERN_(HAS_CLASSIC_E_JERK, " E<max_e_jerk>")
")"
));
SERIAL_ECHOLNPAIR_P(
PSTR(" M205 B"), LINEAR_UNIT(planner.settings.min_segment_time_us)
, PSTR(" S"), LINEAR_UNIT(planner.settings.min_feedrate_mm_s)
, SP_T_STR, LINEAR_UNIT(planner.settings.min_travel_feedrate_mm_s)
#if HAS_JUNCTION_DEVIATION
, PSTR(" J"), LINEAR_UNIT(planner.junction_deviation_mm)
#endif
#if HAS_CLASSIC_JERK
, LIST_N(DOUBLE(LINEAR_AXES),
SP_X_STR, LINEAR_UNIT(planner.max_jerk.x),
SP_Y_STR, LINEAR_UNIT(planner.max_jerk.y),
SP_Z_STR, LINEAR_UNIT(planner.max_jerk.z),
SP_I_STR, LINEAR_UNIT(planner.max_jerk.i),
SP_J_STR, LINEAR_UNIT(planner.max_jerk.j),
SP_K_STR, LINEAR_UNIT(planner.max_jerk.k)
)
#if HAS_CLASSIC_E_JERK
, SP_E_STR, LINEAR_UNIT(planner.max_jerk.e)
#endif
#endif
);
}

View File

@ -33,44 +33,6 @@
#include "../../MarlinCore.h" // for SP_X_STR, etc.
void M217_report(const bool eeprom=false) {
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
SERIAL_ECHOPGM_P(eeprom ? PSTR(" M217") : PSTR("Toolchange:"));
SERIAL_ECHOPAIR(" S", LINEAR_UNIT(toolchange_settings.swap_length));
SERIAL_ECHOPAIR_P(SP_B_STR, LINEAR_UNIT(toolchange_settings.extra_resume),
SP_E_STR, LINEAR_UNIT(toolchange_settings.extra_prime),
SP_P_STR, LINEAR_UNIT(toolchange_settings.prime_speed));
SERIAL_ECHOPAIR(" R", LINEAR_UNIT(toolchange_settings.retract_speed),
" U", LINEAR_UNIT(toolchange_settings.unretract_speed),
" F", toolchange_settings.fan_speed,
" G", toolchange_settings.fan_time);
#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
SERIAL_ECHOPAIR(" A", migration.automode);
SERIAL_ECHOPAIR(" L", LINEAR_UNIT(migration.last));
#endif
#if ENABLED(TOOLCHANGE_PARK)
SERIAL_ECHOPAIR(" W", LINEAR_UNIT(toolchange_settings.enable_park));
SERIAL_ECHOPAIR_P(SP_X_STR, LINEAR_UNIT(toolchange_settings.change_point.x));
SERIAL_ECHOPAIR_P(SP_Y_STR, LINEAR_UNIT(toolchange_settings.change_point.y));
#endif
#if ENABLED(TOOLCHANGE_FS_PRIME_FIRST_USED)
SERIAL_ECHOPAIR(" V", LINEAR_UNIT(enable_first_prime));
#endif
#else
UNUSED(eeprom);
#endif
SERIAL_ECHOPAIR_P(SP_Z_STR, LINEAR_UNIT(toolchange_settings.z_raise));
SERIAL_EOL();
}
/**
* M217 - Set SINGLENOZZLE toolchange parameters
*
@ -168,4 +130,39 @@ void GcodeSuite::M217() {
M217_report();
}
void GcodeSuite::M217_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_TOOL_CHANGING));
SERIAL_ECHOPGM(" M217");
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
SERIAL_ECHOPAIR(" S", LINEAR_UNIT(toolchange_settings.swap_length));
SERIAL_ECHOPAIR_P(SP_B_STR, LINEAR_UNIT(toolchange_settings.extra_resume),
SP_E_STR, LINEAR_UNIT(toolchange_settings.extra_prime),
SP_P_STR, LINEAR_UNIT(toolchange_settings.prime_speed));
SERIAL_ECHOPAIR(" R", LINEAR_UNIT(toolchange_settings.retract_speed),
" U", LINEAR_UNIT(toolchange_settings.unretract_speed),
" F", toolchange_settings.fan_speed,
" G", toolchange_settings.fan_time);
#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
SERIAL_ECHOPAIR(" A", migration.automode);
SERIAL_ECHOPAIR(" L", LINEAR_UNIT(migration.last));
#endif
#if ENABLED(TOOLCHANGE_PARK)
SERIAL_ECHOPAIR(" W", LINEAR_UNIT(toolchange_settings.enable_park));
SERIAL_ECHOPAIR_P(SP_X_STR, LINEAR_UNIT(toolchange_settings.change_point.x));
SERIAL_ECHOPAIR_P(SP_Y_STR, LINEAR_UNIT(toolchange_settings.change_point.y));
#endif
#if ENABLED(TOOLCHANGE_FS_PRIME_FIRST_USED)
SERIAL_ECHOPAIR(" V", LINEAR_UNIT(enable_first_prime));
#endif
#endif
SERIAL_ECHOLNPAIR_P(SP_Z_STR, LINEAR_UNIT(toolchange_settings.z_raise));
}
#endif // HAS_MULTI_EXTRUDER

View File

@ -41,6 +41,8 @@
*/
void GcodeSuite::M218() {
if (!parser.seen_any()) return M218_report();
const int8_t target_extruder = get_target_extruder_from_command();
if (target_extruder < 0) return;
@ -48,24 +50,23 @@ void GcodeSuite::M218() {
if (parser.seenval('Y')) hotend_offset[target_extruder].y = parser.value_linear_units();
if (parser.seenval('Z')) hotend_offset[target_extruder].z = parser.value_linear_units();
if (!parser.seen("XYZ")) {
SERIAL_ECHO_START();
SERIAL_ECHOPGM(STR_HOTEND_OFFSET);
HOTEND_LOOP() {
SERIAL_CHAR(' ');
SERIAL_ECHO(hotend_offset[e].x);
SERIAL_CHAR(',');
SERIAL_ECHO(hotend_offset[e].y);
SERIAL_CHAR(',');
SERIAL_ECHO_F(hotend_offset[e].z, 3);
}
SERIAL_EOL();
}
#if ENABLED(DELTA)
if (target_extruder == active_extruder)
do_blocking_move_to_xy(current_position, planner.settings.max_feedrate_mm_s[X_AXIS]);
#endif
}
void GcodeSuite::M218_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_HOTEND_OFFSETS));
LOOP_S_L_N(e, 1, HOTENDS) {
report_echo_start(forReplay);
SERIAL_ECHOPAIR_P(
PSTR(" M218 T"), e,
SP_X_STR, LINEAR_UNIT(hotend_offset[e].x),
SP_Y_STR, LINEAR_UNIT(hotend_offset[e].y)
);
SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(hotend_offset[e].z), 3);
}
}
#endif // HAS_HOTEND_OFFSET

View File

@ -34,6 +34,7 @@
* U<angle> - Stowed Angle
*/
void GcodeSuite::M281() {
if (!parser.seen_any()) return M281_report();
if (!parser.seenval('P')) return;
@ -45,24 +46,32 @@ void GcodeSuite::M281() {
return;
}
#endif
bool angle_change = false;
if (parser.seen('L')) {
servo_angles[servo_index][0] = parser.value_int();
angle_change = true;
}
if (parser.seen('U')) {
servo_angles[servo_index][1] = parser.value_int();
angle_change = true;
}
if (!angle_change) {
SERIAL_ECHO_MSG(" Servo ", servo_index,
" L", servo_angles[servo_index][0],
" U", servo_angles[servo_index][1]);
}
if (parser.seen('L')) servo_angles[servo_index][0] = parser.value_int();
if (parser.seen('U')) servo_angles[servo_index][1] = parser.value_int();
}
else
SERIAL_ERROR_MSG("Servo ", servo_index, " out of range");
}
void GcodeSuite::M281_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_SERVO_ANGLES));
LOOP_L_N(i, NUM_SERVOS) {
switch (i) {
default: break;
#if ENABLED(SWITCHING_EXTRUDER)
case SWITCHING_EXTRUDER_SERVO_NR:
#if EXTRUDERS > 3
case SWITCHING_EXTRUDER_E23_SERVO_NR:
#endif
#elif ENABLED(SWITCHING_NOZZLE)
case SWITCHING_NOZZLE_SERVO_NR:
#elif ENABLED(BLTOUCH) || (HAS_Z_SERVO_PROBE && defined(Z_SERVO_ANGLES))
case Z_PROBE_SERVO_NR:
#endif
report_echo_start(forReplay);
SERIAL_ECHOLNPAIR(" M281 P", i, " L", servo_angles[i][0], " U", servo_angles[i][1]);
}
}
}
#endif // EDITABLE_SERVO_ANGLES

View File

@ -46,46 +46,63 @@
* F[float] Kf term
*/
void GcodeSuite::M301() {
// multi-extruder PID patch: M301 updates or prints a single extruder's PID values
// default behavior (omitting E parameter) is to update for extruder 0 only
const uint8_t e = parser.byteval('E'); // extruder being updated
int8_t e = parser.byteval('E', -1); // extruder being updated
if (!parser.seen("PID" TERN_(PID_EXTRUSION_SCALING, "CL") TERN_(PID_FAN_SCALING, "F")))
return M301_report(true, e);
if (e == -1) e = 0;
if (e < HOTENDS) { // catch bad input value
if (parser.seen('P')) PID_PARAM(Kp, e) = parser.value_float();
if (parser.seen('I')) PID_PARAM(Ki, e) = scalePID_i(parser.value_float());
if (parser.seen('D')) PID_PARAM(Kd, e) = scalePID_d(parser.value_float());
if (parser.seenval('P')) PID_PARAM(Kp, e) = parser.value_float();
if (parser.seenval('I')) PID_PARAM(Ki, e) = scalePID_i(parser.value_float());
if (parser.seenval('D')) PID_PARAM(Kd, e) = scalePID_d(parser.value_float());
#if ENABLED(PID_EXTRUSION_SCALING)
if (parser.seen('C')) PID_PARAM(Kc, e) = parser.value_float();
if (parser.seenval('C')) PID_PARAM(Kc, e) = parser.value_float();
if (parser.seenval('L')) thermalManager.lpq_len = parser.value_int();
NOMORE(thermalManager.lpq_len, LPQ_MAX_LEN);
NOLESS(thermalManager.lpq_len, 0);
#endif
#if ENABLED(PID_FAN_SCALING)
if (parser.seen('F')) PID_PARAM(Kf, e) = parser.value_float();
if (parser.seenval('F')) PID_PARAM(Kf, e) = parser.value_float();
#endif
thermalManager.updatePID();
SERIAL_ECHO_START();
#if ENABLED(PID_PARAMS_PER_HOTEND)
SERIAL_ECHOPAIR(" e:", e); // specify extruder in serial output
#endif
SERIAL_ECHOPAIR(" p:", PID_PARAM(Kp, e),
" i:", unscalePID_i(PID_PARAM(Ki, e)),
" d:", unscalePID_d(PID_PARAM(Kd, e)));
#if ENABLED(PID_EXTRUSION_SCALING)
SERIAL_ECHOPAIR(" c:", PID_PARAM(Kc, e));
#endif
#if ENABLED(PID_FAN_SCALING)
SERIAL_ECHOPAIR(" f:", PID_PARAM(Kf, e));
#endif
SERIAL_EOL();
}
else
SERIAL_ERROR_MSG(STR_INVALID_EXTRUDER);
}
void GcodeSuite::M301_report(const bool forReplay/*=true*/, const int8_t eindex/*=-1*/) {
report_heading(forReplay, PSTR(STR_HOTEND_PID));
HOTEND_LOOP() {
if (e == eindex || eindex == -1) {
report_echo_start(forReplay);
SERIAL_ECHOPAIR_P(
#if ENABLED(PID_PARAMS_PER_HOTEND)
PSTR(" M301 E"), e, SP_P_STR
#else
PSTR(" M301 P")
#endif
, PID_PARAM(Kp, e)
, PSTR(" I"), unscalePID_i(PID_PARAM(Ki, e))
, PSTR(" D"), unscalePID_d(PID_PARAM(Kd, e))
);
#if ENABLED(PID_EXTRUSION_SCALING)
SERIAL_ECHOPAIR_P(SP_C_STR, PID_PARAM(Kc, e));
if (e == 0) SERIAL_ECHOPAIR(" L", thermalManager.lpq_len);
#endif
#if ENABLED(PID_FAN_SCALING)
SERIAL_ECHOPAIR(" F", PID_PARAM(Kf, e));
#endif
SERIAL_EOL();
}
}
}
#endif // PIDTEMP

View File

@ -35,15 +35,19 @@
* D<dval> - Set the D value
*/
void GcodeSuite::M304() {
if (!parser.seen("PID")) return M304_report();
if (parser.seen('P')) thermalManager.temp_bed.pid.Kp = parser.value_float();
if (parser.seen('I')) thermalManager.temp_bed.pid.Ki = scalePID_i(parser.value_float());
if (parser.seen('D')) thermalManager.temp_bed.pid.Kd = scalePID_d(parser.value_float());
}
SERIAL_ECHO_MSG(" p:", thermalManager.temp_bed.pid.Kp,
" i:", unscalePID_i(thermalManager.temp_bed.pid.Ki),
" d:", unscalePID_d(thermalManager.temp_bed.pid.Kd));
void GcodeSuite::M304_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_BED_PID));
SERIAL_ECHO_MSG(
" M304 P", thermalManager.temp_bed.pid.Kp
, " I", unscalePID_i(thermalManager.temp_bed.pid.Ki)
, " D", unscalePID_d(thermalManager.temp_bed.pid.Kd)
);
}
#endif // PIDTEMPBED

View File

@ -70,10 +70,10 @@ void GcodeSuite::M305() {
} // If not setting then report parameters
else if (t_index < 0) { // ...all user thermistors
LOOP_L_N(i, USER_THERMISTORS)
thermalManager.log_user_thermistor(i);
thermalManager.M305_report(i);
}
else // ...one user thermistor
thermalManager.log_user_thermistor(t_index);
thermalManager.M305_report(t_index);
}
#endif // HAS_USER_THERMISTORS

View File

@ -35,14 +35,19 @@
* D<dval> - Set the D value
*/
void GcodeSuite::M309() {
if (!parser.seen("PID")) return M309_report();
if (parser.seen('P')) thermalManager.temp_chamber.pid.Kp = parser.value_float();
if (parser.seen('I')) thermalManager.temp_chamber.pid.Ki = scalePID_i(parser.value_float());
if (parser.seen('D')) thermalManager.temp_chamber.pid.Kd = scalePID_d(parser.value_float());
}
SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR(" p:", thermalManager.temp_chamber.pid.Kp,
" i:", unscalePID_i(thermalManager.temp_chamber.pid.Ki),
" d:", unscalePID_d(thermalManager.temp_chamber.pid.Kd));
void GcodeSuite::M309_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_CHAMBER_PID));
SERIAL_ECHOLNPAIR(
" M309 P", thermalManager.temp_chamber.pid.Kp
, " I", unscalePID_i(thermalManager.temp_chamber.pid.Ki)
, " D", unscalePID_d(thermalManager.temp_chamber.pid.Kd)
);
}
#endif // PIDTEMPCHAMBER

View File

@ -53,13 +53,13 @@ void GcodeSuite::M575() {
case 115200: case 250000: case 500000: case 1000000: {
const int8_t port = parser.intval('P', -99);
const bool set1 = (port == -99 || port == 0);
if (set1) SERIAL_ECHO_MSG(" Serial ", AS_CHAR('0'), " baud rate set to ", baud);
if (set1) SERIAL_ECHO_MSG(" Serial ", AS_DIGIT(0), " baud rate set to ", baud);
#if HAS_MULTI_SERIAL
const bool set2 = (port == -99 || port == 1);
if (set2) SERIAL_ECHO_MSG(" Serial ", AS_CHAR('1'), " baud rate set to ", baud);
if (set2) SERIAL_ECHO_MSG(" Serial ", AS_DIGIT(1), " baud rate set to ", baud);
#ifdef SERIAL_PORT_3
const bool set3 = (port == -99 || port == 2);
if (set3) SERIAL_ECHO_MSG(" Serial ", AS_CHAR('2'), " baud rate set to ", baud);
if (set3) SERIAL_ECHO_MSG(" Serial ", AS_DIGIT(2), " baud rate set to ", baud);
#endif
#endif

View File

@ -23,33 +23,6 @@
#include "../gcode.h"
#include "../../module/planner.h"
void report_M92(const bool echo=true, const int8_t e=-1) {
if (echo) SERIAL_ECHO_START(); else SERIAL_CHAR(' ');
SERIAL_ECHOPAIR_P(LIST_N(DOUBLE(LINEAR_AXES),
PSTR(" M92 X"), LINEAR_UNIT(planner.settings.axis_steps_per_mm[X_AXIS]),
SP_Y_STR, LINEAR_UNIT(planner.settings.axis_steps_per_mm[Y_AXIS]),
SP_Z_STR, LINEAR_UNIT(planner.settings.axis_steps_per_mm[Z_AXIS]),
SP_I_STR, LINEAR_UNIT(planner.settings.axis_steps_per_mm[I_AXIS]),
SP_J_STR, LINEAR_UNIT(planner.settings.axis_steps_per_mm[J_AXIS]),
SP_K_STR, LINEAR_UNIT(planner.settings.axis_steps_per_mm[K_AXIS]))
);
#if HAS_EXTRUDERS && DISABLED(DISTINCT_E_FACTORS)
SERIAL_ECHOPAIR_P(SP_E_STR, VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS]));
#endif
SERIAL_EOL();
#if ENABLED(DISTINCT_E_FACTORS)
LOOP_L_N(i, E_STEPPERS) {
if (e >= 0 && i != e) continue;
if (echo) SERIAL_ECHO_START(); else SERIAL_CHAR(' ');
SERIAL_ECHOLNPAIR_P(PSTR(" M92 T"), i,
SP_E_STR, VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS_N(i)]));
}
#endif
UNUSED(e);
}
/**
* M92: Set axis steps-per-unit for one or more axes, X, Y, Z, and E.
* (Follows the same syntax as G92)
@ -58,10 +31,11 @@ void report_M92(const bool echo=true, const int8_t e=-1) {
*
* If no argument is given print the current values.
*
* With MAGIC_NUMBERS_GCODE:
* Use 'H' and/or 'L' to get ideal layer-height information.
* 'H' specifies micro-steps to use. We guess if it's not supplied.
* 'L' specifies a desired layer height. Nearest good heights are shown.
* With MAGIC_NUMBERS_GCODE:
*
* Use 'H' and/or 'L' to get ideal layer-height information.
* H<microsteps> - Specify micro-steps to use. Best guess if not supplied.
* L<linear> - Desired layer height in current units. Nearest good heights are shown.
*/
void GcodeSuite::M92() {
@ -69,10 +43,8 @@ void GcodeSuite::M92() {
if (target_extruder < 0) return;
// No arguments? Show M92 report.
if (!parser.seen(
LOGICAL_AXIS_GANG("E", "X", "Y", "Z", AXIS4_STR, AXIS5_STR, AXIS6_STR)
TERN_(MAGIC_NUMBERS_GCODE, "HL")
)) return report_M92(true, target_extruder);
if (!parser.seen(LOGICAL_AXES_STRING TERN_(MAGIC_NUMBERS_GCODE, "HL")))
return M92_report(true, target_extruder);
LOOP_LOGICAL_AXES(i) {
if (parser.seenval(axis_codes[i])) {
@ -100,7 +72,7 @@ void GcodeSuite::M92() {
#ifndef Z_MICROSTEPS
#define Z_MICROSTEPS 16
#endif
const float wanted = parser.floatval('L');
const float wanted = parser.linearval('L');
if (parser.seen('H') || wanted) {
const uint16_t argH = parser.ushortval('H'),
micro_steps = argH ?: Z_MICROSTEPS;
@ -117,3 +89,32 @@ void GcodeSuite::M92() {
}
#endif
}
void GcodeSuite::M92_report(const bool forReplay/*=true*/, const int8_t e/*=-1*/) {
report_heading_etc(forReplay, PSTR(STR_STEPS_PER_UNIT));
SERIAL_ECHOPAIR_P(LIST_N(DOUBLE(LINEAR_AXES),
PSTR(" M92 X"), LINEAR_UNIT(planner.settings.axis_steps_per_mm[X_AXIS]),
SP_Y_STR, LINEAR_UNIT(planner.settings.axis_steps_per_mm[Y_AXIS]),
SP_Z_STR, LINEAR_UNIT(planner.settings.axis_steps_per_mm[Z_AXIS]),
SP_I_STR, LINEAR_UNIT(planner.settings.axis_steps_per_mm[I_AXIS]),
SP_J_STR, LINEAR_UNIT(planner.settings.axis_steps_per_mm[J_AXIS]),
SP_K_STR, LINEAR_UNIT(planner.settings.axis_steps_per_mm[K_AXIS]))
);
#if HAS_EXTRUDERS && DISABLED(DISTINCT_E_FACTORS)
SERIAL_ECHOPAIR_P(SP_E_STR, VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS]));
#endif
SERIAL_EOL();
#if ENABLED(DISTINCT_E_FACTORS)
LOOP_L_N(i, E_STEPPERS) {
if (e >= 0 && i != e) continue;
report_echo_start(forReplay);
SERIAL_ECHOLNPAIR_P(
PSTR(" M92 T"), i,
SP_E_STR, VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS_N(i)])
);
}
#else
UNUSED(e);
#endif
}

View File

@ -33,7 +33,7 @@
* M17: Enable stepper motors
*/
void GcodeSuite::M17() {
if (parser.seen(LOGICAL_AXIS_GANG("E", "X", "Y", "Z", AXIS4_STR, AXIS5_STR, AXIS6_STR))) {
if (parser.seen_axis()) {
LOGICAL_AXIS_CODE(
if (TERN0(HAS_E_STEPPER_ENABLE, parser.seen_test('E'))) enable_e_steppers(),
if (parser.seen_test('X')) ENABLE_AXIS_X(),
@ -59,7 +59,7 @@ void GcodeSuite::M18_M84() {
stepper_inactive_time = parser.value_millis_from_seconds();
}
else {
if (parser.seen(LOGICAL_AXIS_GANG("E", "X", "Y", "Z", AXIS4_STR, AXIS5_STR, AXIS6_STR))) {
if (parser.seen_axis()) {
planner.synchronize();
LOGICAL_AXIS_CODE(
if (TERN0(HAS_E_STEPPER_ENABLE, parser.seen_test('E'))) disable_e_steppers(),

View File

@ -33,14 +33,22 @@
* Usage: M211 S1 to enable, M211 S0 to disable, M211 alone for report
*/
void GcodeSuite::M211() {
if (parser.seen('S'))
soft_endstop._enabled = parser.value_bool();
else
M211_report();
}
void GcodeSuite::M211_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_SOFT_ENDSTOPS));
SERIAL_ECHOPAIR(" M211 S", AS_DIGIT(soft_endstop._enabled), " ; ");
serialprintln_onoff(soft_endstop._enabled);
report_echo_start(forReplay);
const xyz_pos_t l_soft_min = soft_endstop.min.asLogical(),
l_soft_max = soft_endstop.max.asLogical();
SERIAL_ECHO_START();
SERIAL_ECHOPGM(STR_SOFT_ENDSTOPS);
if (parser.seen('S')) soft_endstop._enabled = parser.value_bool();
serialprint_onoff(soft_endstop._enabled);
print_pos(l_soft_min, PSTR(STR_SOFT_MIN), PSTR(" "));
print_pos(l_soft_max, PSTR(STR_SOFT_MAX));
}
#endif
#endif // HAS_SOFTWARE_ENDSTOPS

View File

@ -144,4 +144,17 @@ void GcodeSuite::M900() {
}
void GcodeSuite::M900_report(const bool forReplay/*=true*/) {
report_heading(forReplay, PSTR(STR_LINEAR_ADVANCE));
#if EXTRUDERS < 2
report_echo_start(forReplay);
SERIAL_ECHOLNPAIR(" M900 K", planner.extruder_advance_K[0]);
#else
LOOP_L_N(i, EXTRUDERS) {
report_echo_start(forReplay);
SERIAL_ECHOLNPAIR(" M900 T", i, " K", planner.extruder_advance_K[i]);
}
#endif
}
#endif // LIN_ADVANCE

View File

@ -27,18 +27,6 @@
#include "../../gcode.h"
#include "../../../feature/controllerfan.h"
void M710_report(const bool forReplay=true) {
if (!forReplay) { SERIAL_ECHOLNPGM("; Controller Fan"); SERIAL_ECHO_START(); }
SERIAL_ECHOLNPAIR(" M710"
" S", int(controllerFan.settings.active_speed),
" I", int(controllerFan.settings.idle_speed),
" A", int(controllerFan.settings.auto_mode),
" D", controllerFan.settings.duration,
" ; (", (int(controllerFan.settings.active_speed) * 100) / 255, "%"
" ", (int(controllerFan.settings.idle_speed) * 100) / 255, "%)"
);
}
/**
* M710: Set controller fan settings
*
@ -78,4 +66,16 @@ void GcodeSuite::M710() {
M710_report();
}
void GcodeSuite::M710_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_CONTROLLER_FAN));
SERIAL_ECHOLNPAIR(" M710"
" S", int(controllerFan.settings.active_speed),
" I", int(controllerFan.settings.idle_speed),
" A", int(controllerFan.settings.auto_mode),
" D", controllerFan.settings.duration,
" ; (", (int(controllerFan.settings.active_speed) * 100) / 255, "%"
" ", (int(controllerFan.settings.idle_speed) * 100) / 255, "%)"
);
}
#endif // CONTROLLER_FAN_EDITABLE

View File

@ -22,7 +22,7 @@
#include "../../../inc/MarlinConfig.h"
#if ANY(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_PWM, HAS_MOTOR_CURRENT_I2C, HAS_MOTOR_CURRENT_DAC)
#if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM || HAS_MOTOR_CURRENT_I2C || HAS_MOTOR_CURRENT_DAC
#include "../../gcode.h"
@ -44,12 +44,27 @@
void GcodeSuite::M907() {
#if HAS_MOTOR_CURRENT_SPI
if (!parser.seen("BS" LOGICAL_AXES_STRING))
return M907_report();
LOOP_LOGICAL_AXES(i) if (parser.seenval(axis_codes[i])) stepper.set_digipot_current(i, parser.value_int());
if (parser.seenval('B')) stepper.set_digipot_current(4, parser.value_int());
if (parser.seenval('S')) LOOP_LE_N(i, 4) stepper.set_digipot_current(i, parser.value_int());
#elif HAS_MOTOR_CURRENT_PWM
if (!parser.seen(
#if ANY_PIN(MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_XY)
"XY"
#endif
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
"Z"
#endif
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
"E"
#endif
)) return M907_report();
#if ANY_PIN(MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_XY)
if (parser.seenval('X') || parser.seenval('Y')) stepper.set_digipot_current(0, parser.value_int());
#endif
@ -82,7 +97,30 @@ void GcodeSuite::M907() {
#endif
}
#if EITHER(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_DAC)
#if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM
void GcodeSuite::M907_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_STEPPER_MOTOR_CURRENTS));
#if HAS_MOTOR_CURRENT_PWM
SERIAL_ECHOLNPAIR_P( // PWM-based has 3 values:
PSTR(" M907 X"), stepper.motor_current_setting[0] // X and Y
, SP_Z_STR, stepper.motor_current_setting[1] // Z
, SP_E_STR, stepper.motor_current_setting[2] // E
);
#elif HAS_MOTOR_CURRENT_SPI
SERIAL_ECHOPGM(" M907"); // SPI-based has 5 values:
LOOP_LOGICAL_AXES(q) { // X Y Z (I J K) E (map to X Y Z (I J K) E0 by default)
SERIAL_CHAR(' ', axis_codes[q]);
SERIAL_ECHO(stepper.motor_current_setting[q]);
}
SERIAL_CHAR(' ', 'B'); // B (maps to E1 by default)
SERIAL_ECHOLN(stepper.motor_current_setting[4]);
#endif
}
#endif // HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM
#if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_DAC
/**
* M908: Control digital trimpot directly (M908 P<pin> S<current>)

View File

@ -29,14 +29,34 @@
/**
* M207: Set firmware retraction values
*
* S[+units] retract_length
* W[+units] swap_retract_length (multi-extruder)
* F[units/min] retract_feedrate_mm_s
* Z[units] retract_zraise
*/
void GcodeSuite::M207() { fwretract.M207(); }
void GcodeSuite::M207_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_RETRACT_S_F_Z));
fwretract.M207_report();
}
/**
* M208: Set firmware un-retraction values
*
* S[+units] retract_recover_extra (in addition to M207 S*)
* W[+units] swap_retract_recover_extra (multi-extruder)
* F[units/min] retract_recover_feedrate_mm_s
* R[units/min] swap_retract_recover_feedrate_mm_s
*/
void GcodeSuite::M208() { fwretract.M208(); }
void GcodeSuite::M208_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_RECOVER_S_F));
fwretract.M208_report();
}
#if ENABLED(FWRETRACT_AUTORETRACT)
/**
@ -47,6 +67,11 @@ void GcodeSuite::M208() { fwretract.M208(); }
*/
void GcodeSuite::M209() { fwretract.M209(); }
void GcodeSuite::M209_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_AUTO_RETRACT_S));
fwretract.M209_report();
}
#endif
#endif // FWRETRACT

View File

@ -64,17 +64,7 @@ void ip_report(const uint16_t cmd, PGM_P const post, const IPAddress &ipo) {
if (i < 3) SERIAL_CHAR('.');
}
SERIAL_ECHOPGM(" ; ");
SERIAL_ECHOPGM_P(post);
SERIAL_EOL();
}
void M552_report() {
ip_report(552, PSTR("ip address"), Ethernet.linkStatus() == LinkON ? Ethernet.localIP() : ethernet.ip);
}
void M553_report() {
ip_report(553, PSTR("subnet mask"), Ethernet.linkStatus() == LinkON ? Ethernet.subnetMask() : ethernet.subnet);
}
void M554_report() {
ip_report(554, PSTR("gateway"), Ethernet.linkStatus() == LinkON ? Ethernet.gatewayIP() : ethernet.gateway);
SERIAL_ECHOLNPGM_P(post);
}
/**
@ -107,20 +97,36 @@ void GcodeSuite::M552() {
if (nopar || seenP) M552_report();
}
void GcodeSuite::M552_report() {
ip_report(552, PSTR("ip address"), Ethernet.linkStatus() == LinkON ? Ethernet.localIP() : ethernet.ip);
}
/**
* M553 Pnnn - Set netmask
*/
void GcodeSuite::M553() {
if (parser.seenval('P')) ethernet.subnet.fromString(parser.value_string());
M553_report();
if (parser.seenval('P'))
ethernet.subnet.fromString(parser.value_string());
else
M553_report();
}
void GcodeSuite::M553_report() {
ip_report(553, PSTR("subnet mask"), Ethernet.linkStatus() == LinkON ? Ethernet.subnetMask() : ethernet.subnet);
}
/**
* M554 Pnnn - Set Gateway
*/
void GcodeSuite::M554() {
if (parser.seenval('P')) ethernet.gateway.fromString(parser.value_string());
M554_report();
if (parser.seenval('P'))
ethernet.gateway.fromString(parser.value_string());
else
M554_report();
}
void GcodeSuite::M554_report() {
ip_report(554, PSTR("gateway"), Ethernet.linkStatus() == LinkON ? Ethernet.gatewayIP() : ethernet.gateway);
}
#endif // HAS_ETHERNET

View File

@ -42,6 +42,8 @@
*/
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;
@ -62,4 +64,20 @@ void GcodeSuite::M603() {
}
}
void GcodeSuite::M603_report(const bool forReplay/*=true*/) {
report_heading(forReplay, PSTR(STR_FILAMENT_LOAD_UNLOAD));
#if EXTRUDERS == 1
report_echo_start(forReplay);
SERIAL_ECHOPAIR(" M603 L", LINEAR_UNIT(fc_settings[0].load_length), " U", LINEAR_UNIT(fc_settings[0].unload_length), " ;");
say_units();
#else
LOOP_L_N(e, EXTRUDERS) {
report_echo_start(forReplay);
SERIAL_ECHOPAIR(" M603 T", e, " L", LINEAR_UNIT(fc_settings[e].load_length), " U", LINEAR_UNIT(fc_settings[e].unload_length), " ;");
say_units();
}
#endif
}
#endif // ADVANCED_PAUSE_FEATURE

View File

@ -40,11 +40,8 @@ void GcodeSuite::M413() {
if (parser.seen('S'))
recovery.enable(parser.value_bool());
else {
SERIAL_ECHO_START();
SERIAL_ECHOPGM("Power-loss recovery ");
serialprintln_onoff(recovery.enabled);
}
else
M413_report();
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
if (parser.seen("RL")) recovery.load();
@ -59,4 +56,10 @@ void GcodeSuite::M413() {
#endif
}
void GcodeSuite::M413_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_POWER_LOSS_RECOVERY));
SERIAL_ECHOPAIR(" M413 S", AS_DIGIT(recovery.enabled), " ; ");
serialprintln_onoff(recovery.enabled);
}
#endif // POWER_LOSS_RECOVERY

View File

@ -66,4 +66,16 @@ void GcodeSuite::M412() {
}
}
void GcodeSuite::M412_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_FILAMENT_RUNOUT_SENSOR));
SERIAL_ECHOLNPAIR(
" M412 S", runout.enabled
#if HAS_FILAMENT_RUNOUT_DISTANCE
, " D", LINEAR_UNIT(runout.runout_distance())
#endif
, " ; Sensor "
);
serialprintln_onoff(runout.enabled);
}
#endif // HAS_FILAMENT_SENSOR

View File

@ -138,4 +138,66 @@ void GcodeSuite::M569() {
say_stealth_status();
}
void GcodeSuite::M569_report(const bool forReplay/*=true*/) {
report_heading(forReplay, PSTR(STR_DRIVER_STEPPING_MODE));
auto say_M569 = [](const bool forReplay, const char * const etc=nullptr, const bool eol=false) {
if (!forReplay) SERIAL_ECHO_START();
SERIAL_ECHOPGM(" M569 S1");
if (etc) {
SERIAL_CHAR(' ');
SERIAL_ECHOPGM_P(etc);
}
if (eol) SERIAL_EOL();
};
const bool chop_x = TERN0(X_HAS_STEALTHCHOP, stepperX.get_stored_stealthChop()),
chop_y = TERN0(Y_HAS_STEALTHCHOP, stepperY.get_stored_stealthChop()),
chop_z = TERN0(Z_HAS_STEALTHCHOP, stepperZ.get_stored_stealthChop()),
chop_i = TERN0(I_HAS_STEALTHCHOP, stepperI.get_stored_stealthChop()),
chop_j = TERN0(J_HAS_STEALTHCHOP, stepperJ.get_stored_stealthChop()),
chop_k = TERN0(K_HAS_STEALTHCHOP, stepperK.get_stored_stealthChop());
if (chop_x || chop_y || chop_z || chop_i || chop_j || chop_k) {
say_M569(forReplay);
LINEAR_AXIS_CODE(
if (chop_x) SERIAL_ECHOPGM_P(SP_X_STR),
if (chop_y) SERIAL_ECHOPGM_P(SP_Y_STR),
if (chop_z) SERIAL_ECHOPGM_P(SP_Z_STR),
if (chop_i) SERIAL_ECHOPGM_P(SP_I_STR),
if (chop_j) SERIAL_ECHOPGM_P(SP_J_STR),
if (chop_k) SERIAL_ECHOPGM_P(SP_K_STR)
);
SERIAL_EOL();
}
const bool chop_x2 = TERN0(X2_HAS_STEALTHCHOP, stepperX2.get_stored_stealthChop()),
chop_y2 = TERN0(Y2_HAS_STEALTHCHOP, stepperY2.get_stored_stealthChop()),
chop_z2 = TERN0(Z2_HAS_STEALTHCHOP, stepperZ2.get_stored_stealthChop());
if (chop_x2 || chop_y2 || chop_z2) {
say_M569(forReplay, PSTR("I1"));
if (chop_x2) SERIAL_ECHOPGM_P(SP_X_STR);
if (chop_y2) SERIAL_ECHOPGM_P(SP_Y_STR);
if (chop_z2) SERIAL_ECHOPGM_P(SP_Z_STR);
SERIAL_EOL();
}
if (TERN0(Z3_HAS_STEALTHCHOP, stepperZ3.get_stored_stealthChop())) { say_M569(forReplay, PSTR("I2 Z"), true); }
if (TERN0(Z4_HAS_STEALTHCHOP, stepperZ4.get_stored_stealthChop())) { say_M569(forReplay, PSTR("I3 Z"), true); }
if (TERN0( I_HAS_STEALTHCHOP, stepperI.get_stored_stealthChop())) { say_M569(forReplay, SP_I_STR, true); }
if (TERN0( J_HAS_STEALTHCHOP, stepperJ.get_stored_stealthChop())) { say_M569(forReplay, SP_J_STR, true); }
if (TERN0( K_HAS_STEALTHCHOP, stepperK.get_stored_stealthChop())) { say_M569(forReplay, SP_K_STR, true); }
if (TERN0(E0_HAS_STEALTHCHOP, stepperE0.get_stored_stealthChop())) { say_M569(forReplay, PSTR("T0 E"), true); }
if (TERN0(E1_HAS_STEALTHCHOP, stepperE1.get_stored_stealthChop())) { say_M569(forReplay, PSTR("T1 E"), true); }
if (TERN0(E2_HAS_STEALTHCHOP, stepperE2.get_stored_stealthChop())) { say_M569(forReplay, PSTR("T2 E"), true); }
if (TERN0(E3_HAS_STEALTHCHOP, stepperE3.get_stored_stealthChop())) { say_M569(forReplay, PSTR("T3 E"), true); }
if (TERN0(E4_HAS_STEALTHCHOP, stepperE4.get_stored_stealthChop())) { say_M569(forReplay, PSTR("T4 E"), true); }
if (TERN0(E5_HAS_STEALTHCHOP, stepperE5.get_stored_stealthChop())) { say_M569(forReplay, PSTR("T5 E"), true); }
if (TERN0(E6_HAS_STEALTHCHOP, stepperE6.get_stored_stealthChop())) { say_M569(forReplay, PSTR("T6 E"), true); }
if (TERN0(E7_HAS_STEALTHCHOP, stepperE7.get_stored_stealthChop())) { say_M569(forReplay, PSTR("T7 E"), true); }
}
#endif // HAS_STEALTHCHOP

View File

@ -198,4 +198,99 @@ void GcodeSuite::M906() {
}
}
void GcodeSuite::M906_report(const bool forReplay/*=true*/) {
report_heading(forReplay, PSTR(STR_STEPPER_DRIVER_CURRENT));
auto say_M906 = [](const bool forReplay) {
report_echo_start(forReplay);
SERIAL_ECHOPGM(" M906");
};
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z)
say_M906(forReplay);
#if AXIS_IS_TMC(X)
SERIAL_ECHOPAIR_P(SP_X_STR, stepperX.getMilliamps());
#endif
#if AXIS_IS_TMC(Y)
SERIAL_ECHOPAIR_P(SP_Y_STR, stepperY.getMilliamps());
#endif
#if AXIS_IS_TMC(Z)
SERIAL_ECHOPAIR_P(SP_Z_STR, stepperZ.getMilliamps());
#endif
SERIAL_EOL();
#endif
#if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2)
say_M906(forReplay);
SERIAL_ECHOPGM(" I1");
#if AXIS_IS_TMC(X2)
SERIAL_ECHOPAIR_P(SP_X_STR, stepperX2.getMilliamps());
#endif
#if AXIS_IS_TMC(Y2)
SERIAL_ECHOPAIR_P(SP_Y_STR, stepperY2.getMilliamps());
#endif
#if AXIS_IS_TMC(Z2)
SERIAL_ECHOPAIR_P(SP_Z_STR, stepperZ2.getMilliamps());
#endif
SERIAL_EOL();
#endif
#if AXIS_IS_TMC(Z3)
say_M906(forReplay);
SERIAL_ECHOLNPAIR(" I2 Z", stepperZ3.getMilliamps());
#endif
#if AXIS_IS_TMC(Z4)
say_M906(forReplay);
SERIAL_ECHOLNPAIR(" I3 Z", stepperZ4.getMilliamps());
#endif
#if AXIS_IS_TMC(I)
say_M906(forReplay);
SERIAL_ECHOLNPAIR_P(SP_I_STR, stepperI.getMilliamps());
#endif
#if AXIS_IS_TMC(J)
say_M906(forReplay);
SERIAL_ECHOLNPAIR_P(SP_J_STR, stepperJ.getMilliamps());
#endif
#if AXIS_IS_TMC(K)
say_M906(forReplay);
SERIAL_ECHOLNPAIR_P(SP_K_STR, stepperK.getMilliamps());
#endif
#if AXIS_IS_TMC(E0)
say_M906(forReplay);
SERIAL_ECHOLNPAIR(" T0 E", stepperE0.getMilliamps());
#endif
#if AXIS_IS_TMC(E1)
say_M906(forReplay);
SERIAL_ECHOLNPAIR(" T1 E", stepperE1.getMilliamps());
#endif
#if AXIS_IS_TMC(E2)
say_M906(forReplay);
SERIAL_ECHOLNPAIR(" T2 E", stepperE2.getMilliamps());
#endif
#if AXIS_IS_TMC(E3)
say_M906(forReplay);
SERIAL_ECHOLNPAIR(" T3 E", stepperE3.getMilliamps());
#endif
#if AXIS_IS_TMC(E4)
say_M906(forReplay);
SERIAL_ECHOLNPAIR(" T4 E", stepperE4.getMilliamps());
#endif
#if AXIS_IS_TMC(E5)
say_M906(forReplay);
SERIAL_ECHOLNPAIR(" T5 E", stepperE5.getMilliamps());
#endif
#if AXIS_IS_TMC(E6)
say_M906(forReplay);
SERIAL_ECHOLNPAIR(" T6 E", stepperE6.getMilliamps());
#endif
#if AXIS_IS_TMC(E7)
say_M906(forReplay);
SERIAL_ECHOLNPAIR(" T7 E", stepperE7.getMilliamps());
#endif
SERIAL_EOL();
}
#endif // HAS_TRINAMIC_CONFIG

View File

@ -227,6 +227,7 @@
* M913: Set HYBRID_THRESHOLD speed.
*/
#if ENABLED(HYBRID_THRESHOLD)
void GcodeSuite::M913() {
#define TMC_SAY_PWMTHRS(A,Q) tmc_print_pwmthrs(stepper##Q)
#define TMC_SET_PWMTHRS(A,Q) stepper##Q.set_pwm_thrs(value)
@ -308,12 +309,109 @@
TERN_(E7_HAS_STEALTHCHOP, TMC_SAY_PWMTHRS_E(7));
}
}
void GcodeSuite::M913_report(const bool forReplay/*=true*/) {
report_heading(forReplay, PSTR(STR_HYBRID_THRESHOLD));
auto say_M913 = [](const bool forReplay) {
report_echo_start(forReplay);
SERIAL_ECHOPGM(" M913");
};
#if X_HAS_STEALTHCHOP || Y_HAS_STEALTHCHOP || Z_HAS_STEALTHCHOP
say_M913(forReplay);
#if X_HAS_STEALTHCHOP
SERIAL_ECHOPAIR_P(SP_X_STR, stepperX.get_pwm_thrs());
#endif
#if Y_HAS_STEALTHCHOP
SERIAL_ECHOPAIR_P(SP_Y_STR, stepperY.get_pwm_thrs());
#endif
#if Z_HAS_STEALTHCHOP
SERIAL_ECHOPAIR_P(SP_Z_STR, stepperZ.get_pwm_thrs());
#endif
SERIAL_EOL();
#endif
#if X2_HAS_STEALTHCHOP || Y2_HAS_STEALTHCHOP || Z2_HAS_STEALTHCHOP
say_M913(forReplay);
SERIAL_ECHOPGM(" I1");
#if X2_HAS_STEALTHCHOP
SERIAL_ECHOPAIR_P(SP_X_STR, stepperX2.get_pwm_thrs());
#endif
#if Y2_HAS_STEALTHCHOP
SERIAL_ECHOPAIR_P(SP_Y_STR, stepperY2.get_pwm_thrs());
#endif
#if Z2_HAS_STEALTHCHOP
SERIAL_ECHOPAIR_P(SP_Z_STR, stepperZ2.get_pwm_thrs());
#endif
SERIAL_EOL();
#endif
#if Z3_HAS_STEALTHCHOP
say_M913(forReplay);
SERIAL_ECHOLNPAIR(" I2 Z", stepperZ3.get_pwm_thrs());
#endif
#if Z4_HAS_STEALTHCHOP
say_M913(forReplay);
SERIAL_ECHOLNPAIR(" I3 Z", stepperZ4.get_pwm_thrs());
#endif
#if I_HAS_STEALTHCHOP
say_M913(forReplay);
SERIAL_ECHOLNPAIR_P(SP_I_STR, stepperI.get_pwm_thrs());
#endif
#if J_HAS_STEALTHCHOP
say_M913(forReplay);
SERIAL_ECHOLNPAIR_P(SP_J_STR, stepperJ.get_pwm_thrs());
#endif
#if K_HAS_STEALTHCHOP
say_M913(forReplay);
SERIAL_ECHOLNPAIR_P(SP_K_STR, stepperK.get_pwm_thrs());
#endif
#if E0_HAS_STEALTHCHOP
say_M913(forReplay);
SERIAL_ECHOLNPAIR(" T0 E", stepperE0.get_pwm_thrs());
#endif
#if E1_HAS_STEALTHCHOP
say_M913(forReplay);
SERIAL_ECHOLNPAIR(" T1 E", stepperE1.get_pwm_thrs());
#endif
#if E2_HAS_STEALTHCHOP
say_M913(forReplay);
SERIAL_ECHOLNPAIR(" T2 E", stepperE2.get_pwm_thrs());
#endif
#if E3_HAS_STEALTHCHOP
say_M913(forReplay);
SERIAL_ECHOLNPAIR(" T3 E", stepperE3.get_pwm_thrs());
#endif
#if E4_HAS_STEALTHCHOP
say_M913(forReplay);
SERIAL_ECHOLNPAIR(" T4 E", stepperE4.get_pwm_thrs());
#endif
#if E5_HAS_STEALTHCHOP
say_M913(forReplay);
SERIAL_ECHOLNPAIR(" T5 E", stepperE5.get_pwm_thrs());
#endif
#if E6_HAS_STEALTHCHOP
say_M913(forReplay);
SERIAL_ECHOLNPAIR(" T6 E", stepperE6.get_pwm_thrs());
#endif
#if E7_HAS_STEALTHCHOP
say_M913(forReplay);
SERIAL_ECHOLNPAIR(" T7 E", stepperE7.get_pwm_thrs());
#endif
SERIAL_EOL();
}
#endif // HYBRID_THRESHOLD
/**
* M914: Set StallGuard sensitivity.
*/
#if USE_SENSORLESS
void GcodeSuite::M914() {
bool report = true;
@ -412,6 +510,68 @@
#endif
}
}
void GcodeSuite::M914_report(const bool forReplay/*=true*/) {
report_heading(forReplay, PSTR(STR_STALLGUARD_THRESHOLD));
auto say_M914 = [](const bool forReplay) {
report_echo_start(forReplay);
SERIAL_ECHOPGM(" M914");
};
#if X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS
say_M914(forReplay);
#if X_SENSORLESS
SERIAL_ECHOPAIR_P(SP_X_STR, stepperX.homing_threshold());
#endif
#if Y_SENSORLESS
SERIAL_ECHOPAIR_P(SP_Y_STR, stepperY.homing_threshold());
#endif
#if Z_SENSORLESS
SERIAL_ECHOPAIR_P(SP_Z_STR, stepperZ.homing_threshold());
#endif
SERIAL_EOL();
#endif
#if X2_SENSORLESS || Y2_SENSORLESS || Z2_SENSORLESS
say_M914(forReplay);
SERIAL_ECHOPGM(" I1");
#if X2_SENSORLESS
SERIAL_ECHOPAIR_P(SP_X_STR, stepperX2.homing_threshold());
#endif
#if Y2_SENSORLESS
SERIAL_ECHOPAIR_P(SP_Y_STR, stepperY2.homing_threshold());
#endif
#if Z2_SENSORLESS
SERIAL_ECHOPAIR_P(SP_Z_STR, stepperZ2.homing_threshold());
#endif
SERIAL_EOL();
#endif
#if Z3_SENSORLESS
say_M914(forReplay);
SERIAL_ECHOLNPAIR(" I2 Z", stepperZ3.homing_threshold());
#endif
#if Z4_SENSORLESS
say_M914(forReplay);
SERIAL_ECHOLNPAIR(" I3 Z", stepperZ4.homing_threshold());
#endif
#if I_SENSORLESS
say_M914(forReplay);
SERIAL_ECHOLNPAIR_P(SP_I_STR, stepperI.homing_threshold());
#endif
#if J_SENSORLESS
say_M914(forReplay);
SERIAL_ECHOLNPAIR_P(SP_J_STR, stepperJ.homing_threshold());
#endif
#if K_SENSORLESS
say_M914(forReplay);
SERIAL_ECHOLNPAIR_P(SP_K_STR, stepperK.homing_threshold());
#endif
}
#endif // USE_SENSORLESS
#endif // HAS_TRINAMIC_CONFIG

View File

@ -102,6 +102,24 @@ uint8_t GcodeSuite::axis_relative = 0 LOGICAL_AXIS_GANG(
xyz_pos_t GcodeSuite::coordinate_system[MAX_COORDINATE_SYSTEMS];
#endif
void GcodeSuite::report_echo_start(const bool forReplay) { if (!forReplay) SERIAL_ECHO_START(); }
void GcodeSuite::report_heading(const bool forReplay, PGM_P const pstr, const bool eol/*=true*/) {
if (forReplay) return;
if (pstr) {
SERIAL_ECHO_START();
SERIAL_ECHOPGM("; ");
SERIAL_ECHOPGM_P(pstr);
}
if (eol) { SERIAL_CHAR(':'); SERIAL_EOL(); }
}
void GcodeSuite::say_units() {
SERIAL_ECHOLNPGM_P(
TERN_(INCH_MODE_SUPPORT, parser.linear_unit_factor != 1.0 ? PSTR(" (in)") :)
PSTR(" (mm)")
);
}
/**
* Get the target extruder from the T parameter or the active_extruder
* Return -1 if the T parameter is out of range
@ -180,7 +198,7 @@ void GcodeSuite::get_destination_from_command() {
recovery.save();
#endif
if (parser.linearval('F') > 0)
if (parser.floatval('F') > 0)
feedrate_mm_s = parser.value_feedrate();
#if ENABLED(PRINTCOUNTER)

View File

@ -379,6 +379,14 @@ public:
return ELAPSED(ms, previous_move_ms + stepper_inactive_time);
}
static void report_echo_start(const bool forReplay);
static void report_heading(const bool forReplay, PGM_P const pstr, const bool eol=true);
static inline void report_heading_etc(const bool forReplay, PGM_P const pstr, const bool eol=true) {
report_heading(forReplay, pstr, eol);
report_echo_start(forReplay);
}
static void say_units();
static int8_t get_target_extruder_from_command();
static int8_t get_target_e_stepper_from_command();
static void get_destination_from_command();
@ -434,6 +442,8 @@ public:
private:
friend class MarlinSettings;
#if ENABLED(MARLIN_DEV_MODE)
static void D(const int16_t dcode);
#endif
@ -514,6 +524,7 @@ private:
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
static void M422();
static void M422_report(const bool forReplay=true);
#endif
#if ENABLED(ASSISTED_TRAMMING)
@ -658,6 +669,7 @@ private:
static void M85();
static void M92();
static void M92_report(const bool forReplay=true, const int8_t e=-1);
#if ENABLED(M100_FREE_MEMORY_WATCHER)
static void M100();
@ -737,10 +749,12 @@ private:
#if PREHEAT_COUNT
static void M145();
static void M145_report(const bool forReplay=true);
#endif
#if ENABLED(TEMPERATURE_UNITS_SUPPORT)
static void M149();
static void M149_report(const bool forReplay=true);
#endif
#if HAS_COLOR_LEDS
@ -766,37 +780,51 @@ private:
#endif
#endif
static void M200();
#if DISABLED(NO_VOLUMETRICS)
static void M200();
static void M200_report(const bool forReplay=true);
#endif
static void M201();
static void M201_report(const bool forReplay=true);
#if 0
static void M202(); // Not used for Sprinter/grbl gen6
#endif
static void M203();
static void M203_report(const bool forReplay=true);
static void M204();
static void M204_report(const bool forReplay=true);
static void M205();
static void M205_report(const bool forReplay=true);
#if HAS_M206_COMMAND
static void M206();
static void M206_report(const bool forReplay=true);
#endif
#if ENABLED(FWRETRACT)
static void M207();
static void M207_report(const bool forReplay=true);
static void M208();
static void M208_report(const bool forReplay=true);
#if ENABLED(FWRETRACT_AUTORETRACT)
static void M209();
static void M209_report(const bool forReplay=true);
#endif
#endif
static void M211();
static void M211_report(const bool forReplay=true);
#if HAS_MULTI_EXTRUDER
static void M217();
static void M217_report(const bool forReplay=true);
#endif
#if HAS_HOTEND_OFFSET
static void M218();
static void M218_report(const bool forReplay=true);
#endif
static void M220();
@ -815,10 +843,12 @@ private:
#if HAS_LCD_CONTRAST
static void M250();
static void M250_report(const bool forReplay=true);
#endif
#if HAS_LCD_BRIGHTNESS
static void M256();
static void M256_report(const bool forReplay=true);
#endif
#if ENABLED(EXPERIMENTAL_I2CBUS)
@ -830,6 +860,7 @@ private:
static void M280();
#if ENABLED(EDITABLE_SERVO_ANGLES)
static void M281();
static void M281_report(const bool forReplay=true);
#endif
#endif
@ -843,6 +874,7 @@ private:
#if ENABLED(PIDTEMP)
static void M301();
static void M301_report(const bool forReplay=true, const int8_t eindex=-1);
#endif
#if ENABLED(PREVENT_COLD_EXTRUSION)
@ -855,6 +887,7 @@ private:
#if ENABLED(PIDTEMPBED)
static void M304();
static void M304_report(const bool forReplay=true);
#endif
#if HAS_USER_THERMISTORS
@ -863,6 +896,7 @@ private:
#if ENABLED(PIDTEMPCHAMBER)
static void M309();
static void M309_report(const bool forReplay=true);
#endif
#if HAS_MICROSTEPS
@ -911,19 +945,23 @@ private:
#if HAS_FILAMENT_SENSOR
static void M412();
static void M412_report(const bool forReplay=true);
#endif
#if HAS_MULTI_LANGUAGE
static void M414();
static void M414_report(const bool forReplay=true);
#endif
#if HAS_LEVELING
static void M420();
static void M420_report(const bool forReplay=true);
static void M421();
#endif
#if ENABLED(BACKLASH_GCODE)
static void M425();
static void M425_report(const bool forReplay=true);
#endif
#if HAS_M206_COMMAND
@ -968,8 +1006,16 @@ private:
#if HAS_ETHERNET
static void M552();
static void M552_report();
static void M553();
static void M553_report();
static void M554();
static void M554_report();
#endif
#if HAS_STEALTHCHOP
static void M569();
static void M569_report(const bool forReplay=true);
#endif
#if ENABLED(BAUD_RATE_GCODE)
@ -979,6 +1025,7 @@ private:
#if ENABLED(ADVANCED_PAUSE_FEATURE)
static void M600();
static void M603();
static void M603_report(const bool forReplay=true);
#endif
#if HAS_DUPLICATION_MODE
@ -987,10 +1034,12 @@ private:
#if IS_KINEMATIC
static void M665();
static void M665_report(const bool forReplay=true);
#endif
#if ENABLED(DELTA) || HAS_EXTRA_ENDSTOPS
#if EITHER(DELTA, HAS_EXTRA_ENDSTOPS)
static void M666();
static void M666_report(const bool forReplay=true);
#endif
#if ENABLED(DUET_SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD)
@ -1012,10 +1061,12 @@ private:
#if HAS_BED_PROBE
static void M851();
static void M851_report(const bool forReplay=true);
#endif
#if ENABLED(SKEW_CORRECTION_GCODE)
static void M852();
static void M852_report(const bool forReplay=true);
#endif
#if ENABLED(I2C_POSITION_ENCODERS)
@ -1038,23 +1089,24 @@ private:
#if ENABLED(LIN_ADVANCE)
static void M900();
static void M900_report(const bool forReplay=true);
#endif
#if HAS_TRINAMIC_CONFIG
static void M122();
static void M906();
#if HAS_STEALTHCHOP
static void M569();
#endif
static void M906_report(const bool forReplay=true);
#if ENABLED(MONITOR_DRIVER_STATUS)
static void M911();
static void M912();
#endif
#if ENABLED(HYBRID_THRESHOLD)
static void M913();
static void M913_report(const bool forReplay=true);
#endif
#if ENABLED(USE_SENSORLESS)
static void M914();
static void M914_report(const bool forReplay=true);
#endif
#endif
@ -1066,16 +1118,19 @@ private:
static void M918();
#endif
#if ANY(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_PWM, HAS_MOTOR_CURRENT_I2C, HAS_MOTOR_CURRENT_DAC)
#if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM || HAS_MOTOR_CURRENT_I2C || HAS_MOTOR_CURRENT_DAC
static void M907();
#if EITHER(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_DAC)
static void M908();
#if HAS_MOTOR_CURRENT_DAC
static void M909();
static void M910();
#endif
#if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM
static void M907_report(const bool forReplay=true);
#endif
#endif
#if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_DAC
static void M908();
#endif
#if HAS_MOTOR_CURRENT_DAC
static void M909();
static void M910();
#endif
#if ENABLED(SDSUPPORT)
static void M928();
@ -1102,6 +1157,7 @@ private:
#if ENABLED(POWER_LOSS_RECOVERY)
static void M413();
static void M413_report(const bool forReplay=true);
static void M1000();
#endif
@ -1123,6 +1179,7 @@ private:
#if ENABLED(CONTROLLER_FAN_EDITABLE)
static void M710();
static void M710_report(const bool forReplay=true);
#endif
static void T(const int8_t tool_index);

View File

@ -30,19 +30,6 @@
#include "../../libs/buzzer.h"
#include "../../MarlinCore.h"
void M206_report() {
SERIAL_ECHOLNPAIR_P(
LIST_N(DOUBLE(LINEAR_AXES),
PSTR("M206 X"), home_offset.x,
SP_Y_STR, home_offset.y,
SP_Z_STR, home_offset.z,
SP_I_STR, home_offset.i,
SP_J_STR, home_offset.j,
SP_K_STR, home_offset.k,
)
);
}
/**
* M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
*
@ -51,6 +38,8 @@ void M206_report() {
* *** In the 2.0 release, it will simply be disabled by default.
*/
void GcodeSuite::M206() {
if (!parser.seen_any()) return M206_report();
LOOP_LINEAR_AXES(i)
if (parser.seen(AXIS_CHAR(i)))
set_home_offset((AxisEnum)i, parser.value_linear_units());
@ -60,10 +49,25 @@ void GcodeSuite::M206() {
if (parser.seen('P')) set_home_offset(B_AXIS, parser.value_float()); // Psi
#endif
if (!parser.seen(LINEAR_AXIS_GANG("X", "Y", "Z", "I", "J", "K")))
M206_report();
else
report_current_position();
report_current_position();
}
void GcodeSuite::M206_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_HOME_OFFSET));
SERIAL_ECHOLNPAIR_P(
#if IS_CARTESIAN
LIST_N(DOUBLE(LINEAR_AXES),
PSTR(" M206 X"), LINEAR_UNIT(home_offset.x),
SP_Y_STR, LINEAR_UNIT(home_offset.y),
SP_Z_STR, LINEAR_UNIT(home_offset.z),
SP_I_STR, LINEAR_UNIT(home_offset.i),
SP_J_STR, LINEAR_UNIT(home_offset.j),
SP_K_STR, LINEAR_UNIT(home_offset.k)
)
#else
PSTR(" M206 Z"), LINEAR_UNIT(home_offset.z)
#endif
);
}
/**

View File

@ -60,4 +60,23 @@ void GcodeSuite::M145() {
}
}
void GcodeSuite::M145_report(const bool forReplay/*=true*/) {
report_heading(forReplay, PSTR(STR_MATERIAL_HEATUP));
LOOP_L_N(i, PREHEAT_COUNT) {
report_echo_start(forReplay);
SERIAL_ECHOLNPAIR_P(
PSTR(" M145 S"), i
#if HAS_HOTEND
, PSTR(" H"), parser.to_temp_units(ui.material_preset[i].hotend_temp)
#endif
#if HAS_HEATED_BED
, SP_B_STR, parser.to_temp_units(ui.material_preset[i].bed_temp)
#endif
#if HAS_FAN
, PSTR(" F"), ui.material_preset[i].fan_speed
#endif
);
}
}
#endif // PREHEAT_COUNT

View File

@ -19,7 +19,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if HAS_LCD_CONTRAST
@ -31,8 +30,15 @@
* M250: Read and optionally set the LCD contrast
*/
void GcodeSuite::M250() {
if (parser.seen('C')) ui.set_contrast(parser.value_int());
SERIAL_ECHOLNPAIR("LCD Contrast: ", ui.contrast);
if (parser.seenval('C'))
ui.set_contrast(parser.value_int());
else
M250_report();
}
void GcodeSuite::M250_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_LCD_CONTRAST));
SERIAL_ECHOLNPAIR(" M250 C", ui.contrast);
}
#endif // HAS_LCD_CONTRAST

View File

@ -30,8 +30,15 @@
* M256: Set the LCD brightness
*/
void GcodeSuite::M256() {
if (parser.seenval('B')) ui.set_brightness(parser.value_int());
SERIAL_ECHOLNPAIR("LCD Brightness: ", ui.brightness);
if (parser.seenval('B'))
ui.set_brightness(parser.value_int());
else
M256_report();
}
void GcodeSuite::M256_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_LCD_BRIGHTNESS));
SERIAL_ECHOLNPAIR(" M256 B", ui.brightness);
}
#endif // HAS_LCD_BRIGHTNESS

View File

@ -38,7 +38,14 @@ void GcodeSuite::M414() {
if (parser.seenval('S'))
ui.set_language(parser.value_byte());
else
M414_report();
}
void GcodeSuite::M414_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_UI_LANGUAGE));
SERIAL_ECHOLNPAIR(" M414 S", ui.language);
}
#endif // HAS_MULTI_LANGUAGE

View File

@ -225,9 +225,7 @@ public:
#endif // !FASTER_GCODE_PARSER
// Seen any axis parameter
static inline bool seen_axis() {
return seen(LOGICAL_AXIS_GANG("E", "X", "Y", "Z", AXIS4_STR, AXIS5_STR, AXIS6_STR));
}
static inline bool seen_axis() { return seen(LOGICAL_AXES_STRING); }
#if ENABLED(GCODE_QUOTED_STRINGS)
static char* unescape_string(char* &src);
@ -350,14 +348,15 @@ public:
static inline void set_input_temp_units(const TempUnit units) { input_temp_units = units; }
static inline char temp_units_code() {
return input_temp_units == TEMPUNIT_K ? 'K' : input_temp_units == TEMPUNIT_F ? 'F' : 'C';
}
static inline PGM_P temp_units_name() {
return input_temp_units == TEMPUNIT_K ? PSTR("Kelvin") : input_temp_units == TEMPUNIT_F ? PSTR("Fahrenheit") : PSTR("Celsius");
}
#if HAS_LCD_MENU && DISABLED(DISABLE_M503)
static inline char temp_units_code() {
return input_temp_units == TEMPUNIT_K ? 'K' : input_temp_units == TEMPUNIT_F ? 'F' : 'C';
}
static inline PGM_P temp_units_name() {
return input_temp_units == TEMPUNIT_K ? PSTR("Kelvin") : input_temp_units == TEMPUNIT_F ? PSTR("Fahrenheit") : PSTR("Celsius");
}
static inline float to_temp_units(celsius_t c) {
switch (input_temp_units) {
default:

View File

@ -32,19 +32,8 @@
* M851: Set the nozzle-to-probe offsets in current units
*/
void GcodeSuite::M851() {
// Show usage with no parameters
if (!parser.seen("XYZ")) {
SERIAL_ECHOLNPAIR_P(
#if HAS_PROBE_XY_OFFSET
PSTR(STR_PROBE_OFFSET " X"), probe.offset_xy.x, SP_Y_STR, probe.offset_xy.y, SP_Z_STR
#else
PSTR(STR_PROBE_OFFSET " X0 Y0 Z")
#endif
, probe.offset.z
);
return;
}
// No parameters? Show current state.
if (!parser.seen("XYZ")) return M851_report();
// Start with current offsets and modify
xyz_pos_t offs = probe.offset;
@ -94,4 +83,20 @@ void GcodeSuite::M851() {
if (ok) probe.offset = offs;
}
void GcodeSuite::M851_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_Z_PROBE_OFFSET));
SERIAL_ECHOPAIR_P(
#if HAS_PROBE_XY_OFFSET
PSTR(" M851 X"), LINEAR_UNIT(probe.offset_xy.x),
SP_Y_STR, LINEAR_UNIT(probe.offset_xy.y),
SP_Z_STR
#else
PSTR(" M851 X0 Y0 Z")
#endif
, LINEAR_UNIT(probe.offset.z)
, " ;"
);
say_units();
}
#endif // HAS_BED_PROBE

View File

@ -33,6 +33,13 @@ void GcodeSuite::M149() {
if (parser.seenval('C')) parser.set_input_temp_units(TEMPUNIT_C);
else if (parser.seenval('K')) parser.set_input_temp_units(TEMPUNIT_K);
else if (parser.seenval('F')) parser.set_input_temp_units(TEMPUNIT_F);
else M149_report();
}
void GcodeSuite::M149_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_TEMPERATURE_UNITS));
SERIAL_ECHOPAIR(" M149 ", AS_CHAR(parser.temp_units_code()), " ; Units in ");
SERIAL_ECHOLNPGM_P(parser.temp_units_name());
}
#endif // TEMPERATURE_UNITS_SUPPORT

View File

@ -578,13 +578,13 @@ void _O2 Endstops::report_states() {
default: continue;
REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_RUNOUT)
}
SERIAL_ECHOPGM(STR_FILAMENT_RUNOUT_SENSOR);
SERIAL_ECHOPGM(STR_FILAMENT);
if (i > 1) SERIAL_CHAR(' ', '0' + i);
print_es_state(extDigitalRead(pin) != state);
}
#undef _CASE_RUNOUT
#elif HAS_FILAMENT_SENSOR
print_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE, PSTR(STR_FILAMENT_RUNOUT_SENSOR));
print_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE, PSTR(STR_FILAMENT));
#endif
TERN_(BLTOUCH, bltouch._reset_SW_mode());

File diff suppressed because it is too large Load Diff

View File

@ -59,6 +59,10 @@
#include "../feature/host_actions.h"
#endif
#if HAS_TEMP_SENSOR
#include "../gcode/gcode.h"
#endif
// MAX TC related macros
#define TEMP_SENSOR_IS_MAX(n, M) (ENABLED(TEMP_SENSOR_##n##_IS_MAX##M) || (ENABLED(TEMP_SENSOR_REDUNDANT_IS_MAX##M) && REDUNDANT_TEMP_MATCH(SOURCE, E##n)))
#define TEMP_SENSOR_IS_ANY_MAX_TC(n) (ENABLED(TEMP_SENSOR_##n##_IS_MAX_TC) || (ENABLED(TEMP_SENSOR_REDUNDANT_IS_MAX_TC) && REDUNDANT_TEMP_MATCH(SOURCE, E##n)))
@ -1722,13 +1726,9 @@ void Temperature::manage_heater() {
COPY(user_thermistor, default_user_thermistor);
}
void Temperature::log_user_thermistor(const uint8_t t_index, const bool eprom/*=false*/) {
if (eprom)
SERIAL_ECHOPGM(" M305 ");
else
SERIAL_ECHO_START();
SERIAL_CHAR('P', '0' + t_index);
void Temperature::M305_report(const uint8_t t_index, const bool forReplay/*=true*/) {
gcode.report_heading_etc(forReplay, PSTR(STR_USER_THERMISTORS));
SERIAL_ECHOPAIR(" M305 P", AS_DIGIT(t_index));
const user_thermistor_t &t = user_thermistor[t_index];
@ -1794,13 +1794,13 @@ void Temperature::manage_heater() {
// Derived from RepRap FiveD extruder::getTemperature()
// For hot end temperature measurement.
celsius_float_t Temperature::analog_to_celsius_hotend(const int16_t raw, const uint8_t e) {
if (e >= HOTENDS) {
SERIAL_ERROR_START();
SERIAL_ECHO(e);
SERIAL_ECHOLNPGM(STR_INVALID_EXTRUDER_NUM);
kill();
return 0;
}
if (e >= HOTENDS) {
SERIAL_ERROR_START();
SERIAL_ECHO(e);
SERIAL_ECHOLNPGM(STR_INVALID_EXTRUDER_NUM);
kill();
return 0;
}
switch (e) {
case 0:
@ -3490,9 +3490,6 @@ void Temperature::isr() {
}
#if HAS_TEMP_SENSOR
#include "../gcode/gcode.h"
/**
* Print a single heater state in the form:
* Bed: " B:nnn.nn /nnn.nn"

View File

@ -527,7 +527,7 @@ class Temperature {
#if HAS_USER_THERMISTORS
static user_thermistor_t user_thermistor[USER_THERMISTORS];
static void log_user_thermistor(const uint8_t t_index, const bool eprom=false);
static void M305_report(const uint8_t t_index, const bool forReplay=true);
static void reset_user_thermistors();
static celsius_float_t user_thermistor_to_deg_c(const uint8_t t_index, const int16_t raw);
static inline bool set_pull_up_res(int8_t t_index, float value) {