mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-27 22:08:02 +00:00
Merge pull request #5228 from thinkyhead/rc_keep_last_mix
Fix DIRECT_MIXING_IN_G1 to preserve the previous mix
This commit is contained in:
commit
5d23e52d75
@ -2672,17 +2672,27 @@ static void homeaxis(AxisEnum axis) {
|
|||||||
|
|
||||||
#if ENABLED(DIRECT_MIXING_IN_G1)
|
#if ENABLED(DIRECT_MIXING_IN_G1)
|
||||||
// Get mixing parameters from the GCode
|
// Get mixing parameters from the GCode
|
||||||
// Factors that are left out are set to 0
|
|
||||||
// The total "must" be 1.0 (but it will be normalized)
|
// The total "must" be 1.0 (but it will be normalized)
|
||||||
|
// If no mix factors are given, the old mix is preserved
|
||||||
void gcode_get_mix() {
|
void gcode_get_mix() {
|
||||||
const char* mixing_codes = "ABCDHI";
|
const char* mixing_codes = "ABCDHI";
|
||||||
for (int i = 0; i < MIXING_STEPPERS; i++) {
|
byte mix_bits = 0;
|
||||||
float v = code_seen(mixing_codes[i]) ? code_value_float() : 0.0;
|
for (uint8_t i = 0; i < MIXING_STEPPERS; i++) {
|
||||||
|
if (code_seen(mixing_codes[i])) {
|
||||||
|
SBI(mix_bits, i);
|
||||||
|
float v = code_value_float();
|
||||||
NOLESS(v, 0.0);
|
NOLESS(v, 0.0);
|
||||||
mixing_factor[i] = RECIPROCAL(v);
|
mixing_factor[i] = RECIPROCAL(v);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// If any mixing factors were included, clear the rest
|
||||||
|
// If none were included, preserve the last mix
|
||||||
|
if (mix_bits) {
|
||||||
|
for (uint8_t i = 0; i < MIXING_STEPPERS; i++)
|
||||||
|
if (!TEST(mix_bits, i)) mixing_factor[i] = 0.0;
|
||||||
normalize_mix();
|
normalize_mix();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user