Fix M605 bugs

Fixes #14191
This commit is contained in:
Scott Lahteine 2019-06-12 20:01:08 -05:00
parent f7792c0192
commit bc2ff9b41f

View file

@ -158,11 +158,12 @@
* A value of 0 disables duplication. * A value of 0 disables duplication.
*/ */
void GcodeSuite::M605() { void GcodeSuite::M605() {
bool ena = false;
if (parser.seen("EPS")) { if (parser.seen("EPS")) {
planner.synchronize(); planner.synchronize();
if (parser.seenval('P')) duplication_e_mask = parser.value_int(); // Set the mask directly if (parser.seenval('P')) duplication_e_mask = parser.value_int(); // Set the mask directly
else if (parser.seenval('E')) duplication_e_mask = pow(2, e + 1) - 1; // Set the mask by E index else if (parser.seenval('E')) duplication_e_mask = pow(2, parser.value_int() + 1) - 1; // Set the mask by E index
const bool ena = (2 == parser.intval('S', extruder_duplication_enabled ? 2 : 0)); ena = (2 == parser.intval('S', extruder_duplication_enabled ? 2 : 0));
extruder_duplication_enabled = ena && (duplication_e_mask >= 3); extruder_duplication_enabled = ena && (duplication_e_mask >= 3);
} }
SERIAL_ECHO_START(); SERIAL_ECHO_START();