From 7b2fadd5988d1280890b4823ed71f4c058124c6b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 22 Jun 2016 17:35:59 -0700 Subject: [PATCH] Apply some fixes from Andreas Derived from https://github.com/AnHardt/Marlin/commit/6e8ede8c694fa4d9e3c769840b09d56 7f8d8e0dd --- Marlin/Marlin_main.cpp | 8 +++++--- Marlin/temperature.cpp | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 6379865c5..0e42a4bad 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -4286,7 +4286,7 @@ inline void gcode_M42() { randomSeed(millis()); - double mean, sigma, sample_set[n_samples]; + double mean = 0, sigma = 0, sample_set[n_samples]; for (uint8_t n = 0; n < n_samples; n++) { if (n_legs) { int dir = (random(0, 10) > 5.0) ? -1 : 1; // clockwise or counter clockwise @@ -4410,8 +4410,10 @@ inline void gcode_M42() { // Raise before the next loop for the legs, // or do the final raise after the last probe - if (n_legs || last_probe) { - do_probe_raise(last_probe ? Z_RAISE_AFTER_PROBING : z_between); + if (last_probe) + do_probe_raise(Z_RAISE_AFTER_PROBING); + else if (n_legs) { + do_probe_raise(z_between); if (!last_probe) delay(500); } diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index cb10f9d25..4a19968d0 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -462,7 +462,7 @@ int Temperature::getHeaterPower(int heater) { EXTRUDER_3_AUTO_FAN_PIN == EXTRUDER_2_AUTO_FAN_PIN ? 2 : 3 }; uint8_t fanState = 0; - for (int f = 0; f <= HOTENDS; f++) { + for (int f = 0; f < HOTENDS; f++) { if (current_temperature[f] > EXTRUDER_AUTO_FAN_TEMPERATURE) SBI(fanState, fanBit[f]); }