|
@ -7602,39 +7602,22 @@ inline void gcode_M503() { |
|
|
inline void gcode_M905() { |
|
|
inline void gcode_M905() { |
|
|
stepper.synchronize(); |
|
|
stepper.synchronize(); |
|
|
|
|
|
|
|
|
float newD = -1; |
|
|
const float newK = code_seen('K') ? code_value_float() : -1, |
|
|
float newW = -1; |
|
|
newD = code_seen('D') ? code_value_float() : -1, |
|
|
float newH = -1; |
|
|
newW = code_seen('W') ? code_value_float() : -1, |
|
|
|
|
|
newH = code_seen('H') ? code_value_float() : -1; |
|
|
|
|
|
|
|
|
if (code_seen('K')) { |
|
|
if (newK >= 0.0) planner.set_extruder_advance_k(newK); |
|
|
float newK = code_value_float(); |
|
|
|
|
|
if (newK >= 0.0) |
|
|
|
|
|
planner.set_extruder_advance_k(newK); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SERIAL_ECHO_START; |
|
|
SERIAL_ECHO_START; |
|
|
SERIAL_ECHOPAIR("Advance factor: ", planner.get_extruder_advance_k()); |
|
|
SERIAL_ECHOLNPAIR("Advance factor: ", planner.get_extruder_advance_k()); |
|
|
SERIAL_EOL; |
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('D')) |
|
|
if (newD >= 0 || newW >= 0 || newH >= 0) { |
|
|
newD = code_value_float(); |
|
|
const float ratio = (!newD || !newW || !newH) ? 0 : (newW * newH) / (sq(newD * 0.5) * M_PI); |
|
|
if (code_seen('W')) |
|
|
planner.set_advance_ed_ratio(ratio); |
|
|
newW = code_value_float(); |
|
|
|
|
|
if (code_seen('H')) |
|
|
|
|
|
newH = code_value_float(); |
|
|
|
|
|
|
|
|
|
|
|
if (newD > 0 && newW > 0 && newH > 0) { |
|
|
|
|
|
float E_D_ratio = newW * newH / (sq(newD / 2) * M_PI); |
|
|
|
|
|
planner.set_E_D_ratio(E_D_ratio); |
|
|
|
|
|
SERIAL_ECHO_START; |
|
|
SERIAL_ECHO_START; |
|
|
SERIAL_ECHOPAIR("E/D ratio: ", E_D_ratio); |
|
|
SERIAL_ECHOPGM("E/D ratio: "); |
|
|
SERIAL_EOL; |
|
|
if (ratio) SERIAL_ECHOLN(ratio); else SERIAL_ECHOLNPGM("Automatic"); |
|
|
} |
|
|
|
|
|
else if (newD != -1 || newW != -1 || newH != -1) { |
|
|
|
|
|
planner.set_E_D_ratio(0); |
|
|
|
|
|
SERIAL_ECHO_START; |
|
|
|
|
|
SERIAL_ECHOPGM("E/D ratio: Automatic"); |
|
|
|
|
|
SERIAL_EOL; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|