Fix and improve EEPROM storage (#12054)
* Clean up Temperature PID * Improve EEPROM read/write/validate * Group `SINGLENOZZLE` saved settings * Group planner saved settings * Group filament change saved settings * Group skew saved settings * Group `FWRETRACT` saved settings
This commit is contained in:
@ -60,7 +60,7 @@ void GcodeSuite::M201() {
|
||||
LOOP_XYZE(i) {
|
||||
if (parser.seen(axis_codes[i])) {
|
||||
const uint8_t a = i + (i == E_AXIS ? TARGET_EXTRUDER : 0);
|
||||
planner.max_acceleration_mm_per_s2[a] = parser.value_axis_units((AxisEnum)a);
|
||||
planner.settings.max_acceleration_mm_per_s2[a] = parser.value_axis_units((AxisEnum)a);
|
||||
}
|
||||
}
|
||||
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
|
||||
@ -79,7 +79,7 @@ void GcodeSuite::M203() {
|
||||
LOOP_XYZE(i)
|
||||
if (parser.seen(axis_codes[i])) {
|
||||
const uint8_t a = i + (i == E_AXIS ? TARGET_EXTRUDER : 0);
|
||||
planner.max_feedrate_mm_s[a] = parser.value_axis_units((AxisEnum)a);
|
||||
planner.settings.max_feedrate_mm_s[a] = parser.value_axis_units((AxisEnum)a);
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,25 +93,25 @@ void GcodeSuite::M203() {
|
||||
void GcodeSuite::M204() {
|
||||
bool report = true;
|
||||
if (parser.seenval('S')) { // Kept for legacy compatibility. Should NOT BE USED for new developments.
|
||||
planner.travel_acceleration = planner.acceleration = parser.value_linear_units();
|
||||
planner.settings.travel_acceleration = planner.settings.acceleration = parser.value_linear_units();
|
||||
report = false;
|
||||
}
|
||||
if (parser.seenval('P')) {
|
||||
planner.acceleration = parser.value_linear_units();
|
||||
planner.settings.acceleration = parser.value_linear_units();
|
||||
report = false;
|
||||
}
|
||||
if (parser.seenval('R')) {
|
||||
planner.retract_acceleration = parser.value_linear_units();
|
||||
planner.settings.retract_acceleration = parser.value_linear_units();
|
||||
report = false;
|
||||
}
|
||||
if (parser.seenval('T')) {
|
||||
planner.travel_acceleration = parser.value_linear_units();
|
||||
planner.settings.travel_acceleration = parser.value_linear_units();
|
||||
report = false;
|
||||
}
|
||||
if (report) {
|
||||
SERIAL_ECHOPAIR("Acceleration: P", planner.acceleration);
|
||||
SERIAL_ECHOPAIR(" R", planner.retract_acceleration);
|
||||
SERIAL_ECHOLNPAIR(" T", planner.travel_acceleration);
|
||||
SERIAL_ECHOPAIR("Acceleration: P", planner.settings.acceleration);
|
||||
SERIAL_ECHOPAIR(" R", planner.settings.retract_acceleration);
|
||||
SERIAL_ECHOLNPAIR(" T", planner.settings.travel_acceleration);
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,9 +128,9 @@ void GcodeSuite::M204() {
|
||||
* J = Junction Deviation (mm) (Requires JUNCTION_DEVIATION)
|
||||
*/
|
||||
void GcodeSuite::M205() {
|
||||
if (parser.seen('B')) planner.min_segment_time_us = parser.value_ulong();
|
||||
if (parser.seen('S')) planner.min_feedrate_mm_s = parser.value_linear_units();
|
||||
if (parser.seen('T')) planner.min_travel_feedrate_mm_s = parser.value_linear_units();
|
||||
if (parser.seen('B')) planner.settings.min_segment_time_us = parser.value_ulong();
|
||||
if (parser.seen('S')) planner.settings.min_feedrate_mm_s = parser.value_linear_units();
|
||||
if (parser.seen('T')) planner.settings.min_travel_feedrate_mm_s = parser.value_linear_units();
|
||||
#if ENABLED(JUNCTION_DEVIATION)
|
||||
if (parser.seen('J')) {
|
||||
const float junc_dev = parser.value_linear_units();
|
||||
|
@ -36,9 +36,9 @@ void M217_report(const bool eeprom=false) {
|
||||
const int16_t port = command_queue_port[cmd_queue_index_r];
|
||||
#endif
|
||||
serialprintPGM_P(port, eeprom ? PSTR(" M217") : PSTR("Singlenozzle:"));
|
||||
SERIAL_ECHOPAIR_P(port, " S", singlenozzle_swap_length);
|
||||
SERIAL_ECHOPAIR_P(port, " P", singlenozzle_prime_speed);
|
||||
SERIAL_ECHOLNPAIR_P(port, " R", singlenozzle_retract_speed);
|
||||
SERIAL_ECHOPAIR_P(port, " S", sn_settings.swap_length);
|
||||
SERIAL_ECHOPAIR_P(port, " P", sn_settings.prime_speed);
|
||||
SERIAL_ECHOLNPAIR_P(port, " R", sn_settings.retract_speed);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -52,9 +52,9 @@ void GcodeSuite::M217() {
|
||||
|
||||
bool report = true;
|
||||
|
||||
if (parser.seenval('S')) { report = false; const float v = parser.value_float(); singlenozzle_swap_length = constrain(v, 0, 500); }
|
||||
if (parser.seenval('P')) { report = false; const int16_t v = parser.value_int(); singlenozzle_prime_speed = constrain(v, 10, 5400); }
|
||||
if (parser.seenval('R')) { report = false; const int16_t v = parser.value_int(); singlenozzle_retract_speed = constrain(v, 10, 5400); }
|
||||
if (parser.seenval('S')) { report = false; const float v = parser.value_float(); sn_settings.swap_length = constrain(v, 0, 500); }
|
||||
if (parser.seenval('P')) { report = false; const int16_t v = parser.value_int(); sn_settings.prime_speed = constrain(v, 10, 5400); }
|
||||
if (parser.seenval('R')) { report = false; const int16_t v = parser.value_int(); sn_settings.retract_speed = constrain(v, 10, 5400); }
|
||||
|
||||
if (report) M217_report();
|
||||
|
||||
|
@ -72,7 +72,7 @@ void GcodeSuite::M218() {
|
||||
|
||||
#if ENABLED(DELTA)
|
||||
if (target_extruder == active_extruder)
|
||||
do_blocking_move_to_xy(current_position[X_AXIS], current_position[Y_AXIS], planner.max_feedrate_mm_s[X_AXIS]);
|
||||
do_blocking_move_to_xy(current_position[X_AXIS], current_position[Y_AXIS], planner.settings.max_feedrate_mm_s[X_AXIS]);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -28,14 +28,14 @@
|
||||
#include "../../module/temperature.h"
|
||||
|
||||
void GcodeSuite::M304() {
|
||||
if (parser.seen('P')) thermalManager.bedKp = parser.value_float();
|
||||
if (parser.seen('I')) thermalManager.bedKi = scalePID_i(parser.value_float());
|
||||
if (parser.seen('D')) thermalManager.bedKd = scalePID_d(parser.value_float());
|
||||
if (parser.seen('P')) thermalManager.bed_pid.Kp = parser.value_float();
|
||||
if (parser.seen('I')) thermalManager.bed_pid.Ki = scalePID_i(parser.value_float());
|
||||
if (parser.seen('D')) thermalManager.bed_pid.Kd = scalePID_d(parser.value_float());
|
||||
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPAIR(" p:", thermalManager.bedKp);
|
||||
SERIAL_ECHOPAIR(" i:", unscalePID_i(thermalManager.bedKi));
|
||||
SERIAL_ECHOLNPAIR(" d:", unscalePID_d(thermalManager.bedKd));
|
||||
SERIAL_ECHOPAIR(" p:", thermalManager.bed_pid.Kp);
|
||||
SERIAL_ECHOPAIR(" i:", unscalePID_i(thermalManager.bed_pid.Ki));
|
||||
SERIAL_ECHOLNPAIR(" d:", unscalePID_d(thermalManager.bed_pid.Kd));
|
||||
}
|
||||
|
||||
#endif // PIDTEMPBED
|
||||
|
@ -38,17 +38,17 @@ void GcodeSuite::M92() {
|
||||
if (i == E_AXIS) {
|
||||
const float value = parser.value_per_axis_unit((AxisEnum)(E_AXIS + TARGET_EXTRUDER));
|
||||
if (value < 20) {
|
||||
float factor = planner.axis_steps_per_mm[E_AXIS + TARGET_EXTRUDER] / value; // increase e constants if M92 E14 is given for netfab.
|
||||
float factor = planner.settings.axis_steps_per_mm[E_AXIS + TARGET_EXTRUDER] / value; // increase e constants if M92 E14 is given for netfab.
|
||||
#if HAS_CLASSIC_JERK && (DISABLED(JUNCTION_DEVIATION) || DISABLED(LIN_ADVANCE))
|
||||
planner.max_jerk[E_AXIS] *= factor;
|
||||
#endif
|
||||
planner.max_feedrate_mm_s[E_AXIS + TARGET_EXTRUDER] *= factor;
|
||||
planner.settings.max_feedrate_mm_s[E_AXIS + TARGET_EXTRUDER] *= factor;
|
||||
planner.max_acceleration_steps_per_s2[E_AXIS + TARGET_EXTRUDER] *= factor;
|
||||
}
|
||||
planner.axis_steps_per_mm[E_AXIS + TARGET_EXTRUDER] = value;
|
||||
planner.settings.axis_steps_per_mm[E_AXIS + TARGET_EXTRUDER] = value;
|
||||
}
|
||||
else {
|
||||
planner.axis_steps_per_mm[i] = parser.value_per_axis_unit((AxisEnum)i);
|
||||
planner.settings.axis_steps_per_mm[i] = parser.value_per_axis_unit((AxisEnum)i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user