🎨 Standardize G-code reporting
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user