|
@ -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
|
|
|