Finish M900 updates

2.0.x
Scott Lahteine 5 years ago
parent eb4d5120bf
commit 646599d0d9

@ -47,41 +47,7 @@ void GcodeSuite::M900() {
SERIAL_ECHOPGM(" value out of range"); SERIAL_ECHOPGM(" value out of range");
if (ten) SERIAL_ECHOPGM(" (0-10)"); if (ten) SERIAL_ECHOPGM(" (0-10)");
SERIAL_ECHOLNPGM("."); SERIAL_ECHOLNPGM(".");
} };
if (!parser.seen_any()) {
#if ENABLED(EXTRA_LIN_ADVANCE_K)
#if EXTRUDERS < 2
SERIAL_ECHOLNPAIR("Advance S", int(new_slot), " K", kref, "(S", int(!new_slot), " K", lref, ")");
#else
LOOP_L_N(i, EXTRUDERS) {
const bool slot = TEST(lin_adv_slot, i);
SERIAL_ECHOLNPAIR("Advance T", int(i), " S", int(slot), " K", planner.extruder_advance_K[i],
"(S", int(!slot), " K", other_extruder_advance_K[i], ")");
SERIAL_EOL();
}
#endif
#else
SERIAL_ECHO_START();
#if EXTRUDERS < 2
SERIAL_ECHOLNPAIR("Advance K=", planner.extruder_advance_K[0]);
#else
SERIAL_ECHOPGM("Advance K");
LOOP_L_N(i, EXTRUDERS) {
SERIAL_CHAR(' ', '0' + i, ':');
SERIAL_ECHO(planner.extruder_advance_K[i]);
}
SERIAL_EOL();
#endif
#endif
return;
}
#if EXTRUDERS < 2 #if EXTRUDERS < 2
constexpr uint8_t tool_index = 0; constexpr uint8_t tool_index = 0;
@ -93,9 +59,13 @@ void GcodeSuite::M900() {
} }
#endif #endif
float &kref = planner.extruder_advance_K[tool_index], float &kref = planner.extruder_advance_K[tool_index];
&lref = other_extruder_advance_K[tool_index];
const float oldK = kref, oldOther = lref; #if ENABLED(EXTRA_LIN_ADVANCE_K)
float &lref = other_extruder_advance_K[tool_index];
#endif
const float oldK = kref;
float newK = oldK; float newK = oldK;
#if ENABLED(EXTRA_LIN_ADVANCE_K) #if ENABLED(EXTRA_LIN_ADVANCE_K)
@ -107,32 +77,32 @@ void GcodeSuite::M900() {
// saved K values. Do here so K/L will apply correctly. // saved K values. Do here so K/L will apply correctly.
if (new_slot != old_slot) { // Not the same slot? if (new_slot != old_slot) { // Not the same slot?
SET_BIT_TO(lin_adv_slot, tool_index, new_slot); // Update the slot for the tool SET_BIT_TO(lin_adv_slot, tool_index, new_slot); // Update the slot for the tool
newK = oldOther; // Get new K value from backup newK = lref; // Get new K value from backup
lref = oldK; // Save K to backup lref = oldK; // Save K to backup
} }
// Set the main K value. Apply if the main slot is active. // Set the main K value. Apply if the main slot is active.
if (parser.seenval('K')) { if (parser.seenval('K')) {
const float newK = parser.value_float(); const float K = parser.value_float();
if (!WITHIN(newK, 0, 10)) echo_value_oor('K'); if (!WITHIN(K, 0, 10)) echo_value_oor('K');
else if (new_slot) lref = newK; // S1 Knn else if (new_slot) lref = K; // S1 Knn
else newK = newK; // S0 Knn else newK = K; // S0 Knn
} }
// Set the extra K value. Apply if the extra slot is active. // Set the extra K value. Apply if the extra slot is active.
if (parser.seenval('L')) { if (parser.seenval('L')) {
const float newL = parser.value_float(); const float L = parser.value_float();
if (!WITHIN(newL, 0, 10)) echo_value_oor('L'); if (!WITHIN(L, 0, 10)) echo_value_oor('L');
else if (!new_slot) lref = newL; // S0 Lnn else if (!new_slot) lref = L; // S0 Lnn
else newK = newL; // S1 Lnn else newK = L; // S1 Lnn
} }
#else #else
if (parser.seenval('K')) { if (parser.seenval('K')) {
const float newK = parser.value_float(); const float K = parser.value_float();
if (WITHIN(newK, 0, 10)) if (WITHIN(K, 0, 10))
newK = newK; newK = K;
else else
echo_value_oor('K'); echo_value_oor('K');
} }
@ -143,6 +113,39 @@ void GcodeSuite::M900() {
planner.synchronize(); planner.synchronize();
kref = newK; kref = newK;
} }
if (!parser.seen_any()) {
#if ENABLED(EXTRA_LIN_ADVANCE_K)
#if EXTRUDERS < 2
SERIAL_ECHOLNPAIR("Advance S", int(new_slot), " K", kref, "(S", int(!new_slot), " K", lref, ")");
#else
LOOP_L_N(i, EXTRUDERS) {
const bool slot = TEST(lin_adv_slot, i);
SERIAL_ECHOLNPAIR("Advance T", int(i), " S", int(slot), " K", planner.extruder_advance_K[i],
"(S", int(!slot), " K", other_extruder_advance_K[i], ")");
SERIAL_EOL();
}
#endif
#else
SERIAL_ECHO_START();
#if EXTRUDERS < 2
SERIAL_ECHOLNPAIR("Advance K=", planner.extruder_advance_K[0]);
#else
SERIAL_ECHOPGM("Advance K");
LOOP_L_N(i, EXTRUDERS) {
SERIAL_CHAR(' ', '0' + i, ':');
SERIAL_ECHO(planner.extruder_advance_K[i]);
}
SERIAL_EOL();
#endif
#endif
}
} }
#endif // LIN_ADVANCE #endif // LIN_ADVANCE

@ -45,7 +45,7 @@ opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER LCD_PROGRESS_BAR LCD_PROGRESS_BAR_TE
BACKLASH_COMPENSATION BACKLASH_GCODE BAUD_RATE_GCODE BEZIER_CURVE_SUPPORT \ BACKLASH_COMPENSATION BACKLASH_GCODE BAUD_RATE_GCODE BEZIER_CURVE_SUPPORT \
FWRETRACT ARC_P_CIRCLES CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS \ FWRETRACT ARC_P_CIRCLES CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS \
PSU_CONTROL AUTO_POWER_CONTROL POWER_LOSS_RECOVERY POWER_LOSS_PIN POWER_LOSS_STATE \ PSU_CONTROL AUTO_POWER_CONTROL POWER_LOSS_RECOVERY POWER_LOSS_PIN POWER_LOSS_STATE \
SLOW_PWM_HEATERS THERMAL_PROTECTION_CHAMBER LIN_ADVANCE \ SLOW_PWM_HEATERS THERMAL_PROTECTION_CHAMBER LIN_ADVANCE EXTRA_LIN_ADVANCE_K \
HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT PINS_DEBUGGING MAX7219_DEBUG M114_DETAIL HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT PINS_DEBUGGING MAX7219_DEBUG M114_DETAIL
exec_test $1 $2 "RAMPS | EXTRUDERS 2 | CHAR LCD + SD | FIX Probe | ABL-Linear | Advanced Pause | PLR | LEDs ..." exec_test $1 $2 "RAMPS | EXTRUDERS 2 | CHAR LCD + SD | FIX Probe | ABL-Linear | Advanced Pause | PLR | LEDs ..."
@ -66,7 +66,7 @@ opt_enable AUTO_BED_LEVELING_UBL RESTORE_LEVELING_AFTER_G28 DEBUG_LEVELING_FEATU
REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER LIGHTWEIGHT_UI STATUS_MESSAGE_SCROLLING BOOT_MARLIN_LOGO_SMALL \ REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER LIGHTWEIGHT_UI STATUS_MESSAGE_SCROLLING BOOT_MARLIN_LOGO_SMALL \
SDSUPPORT SDCARD_SORT_ALPHA USB_FLASH_DRIVE_SUPPORT SCROLL_LONG_FILENAMES CANCEL_OBJECTS \ SDSUPPORT SDCARD_SORT_ALPHA USB_FLASH_DRIVE_SUPPORT SCROLL_LONG_FILENAMES CANCEL_OBJECTS \
EEPROM_SETTINGS EEPROM_CHITCHAT GCODE_MACROS CUSTOM_USER_MENUS \ EEPROM_SETTINGS EEPROM_CHITCHAT GCODE_MACROS CUSTOM_USER_MENUS \
MULTI_NOZZLE_DUPLICATION CLASSIC_JERK LIN_ADVANCE QUICK_HOME \ MULTI_NOZZLE_DUPLICATION CLASSIC_JERK LIN_ADVANCE EXTRA_LIN_ADVANCE_K QUICK_HOME \
LCD_SET_PROGRESS_MANUALLY PRINT_PROGRESS_SHOW_DECIMALS SHOW_REMAINING_TIME \ LCD_SET_PROGRESS_MANUALLY PRINT_PROGRESS_SHOW_DECIMALS SHOW_REMAINING_TIME \
BABYSTEPPING BABYSTEP_XY NANODLP_Z_SYNC I2C_POSITION_ENCODERS M114_DETAIL BABYSTEPPING BABYSTEP_XY NANODLP_Z_SYNC I2C_POSITION_ENCODERS M114_DETAIL
exec_test $1 $2 "Azteeg X3 Pro | EXTRUDERS 5 | RRDFGSC | UBL | LIN_ADVANCE ..." exec_test $1 $2 "Azteeg X3 Pro | EXTRUDERS 5 | RRDFGSC | UBL | LIN_ADVANCE ..."

Loading…
Cancel
Save