From 71396f77d3c6a65a18d4b6bf4ef29dc077d83100 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 8 May 2017 14:09:37 -0500 Subject: [PATCH] Cleanups following recent commits --- Marlin/Conditionals_post.h | 2 +- Marlin/Marlin_main.cpp | 43 +++++++++++++++--------------------- Marlin/temperature.cpp | 45 +++++++++++++++----------------------- Marlin/temperature.h | 3 +-- Marlin/ubl_G29.cpp | 2 +- Marlin/ubl_motion.cpp | 2 +- 6 files changed, 40 insertions(+), 57 deletions(-) diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 0a5e1820c6..3edc8dfe83 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -649,7 +649,7 @@ /** * Heater & Fan Pausing */ - #if ENABLED(PROBING_FANS_OFF) && FAN_COUNT == 0 + #if FAN_COUNT == 0 #undef PROBING_FANS_OFF #endif #define QUIET_PROBING (ENABLED(PROBING_HEATERS_OFF) || ENABLED(PROBING_FANS_OFF)) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index f55d62be26..482d0f257a 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2057,26 +2057,21 @@ static void clean_up_after_endstop_or_probe_move() { #endif #if ENABLED(PROBING_FANS_OFF) - void fans_pause(bool p) { - if (p == fans_paused) { // If called out of order something is wrong - SERIAL_ERROR_START; - SERIAL_ERRORPGM("Fans already "); - if (!fans_paused) SERIAL_ERRORPGM("un"); - SERIAL_ERRORLNPGM("paused!"); - return; + + void fans_pause(const bool p) { + if (p != fans_paused) { + fans_paused = p; + if (p) + for (uint8_t x = 0; x < FAN_COUNT; x++) { + paused_fanSpeeds[x] = fanSpeeds[x]; + fanSpeeds[x] = 0; + } + else + for (uint8_t x = 0; x < FAN_COUNT; x++) + fanSpeeds[x] = paused_fanSpeeds[x]; } - - if (p) - for (uint8_t x = 0;x < FAN_COUNT;x++) { - paused_fanSpeeds[x] = fanSpeeds[x]; - fanSpeeds[x] = 0; - } - else - for (uint8_t x = 0;x < FAN_COUNT;x++) - fanSpeeds[x] = paused_fanSpeeds[x]; - - fans_paused = p; } + #endif // PROBING_FANS_OFF #if HAS_BED_PROBE @@ -2091,18 +2086,16 @@ static void clean_up_after_endstop_or_probe_move() { #endif #if QUIET_PROBING - void probing_pause(bool pause) { + void probing_pause(const bool p) { #if ENABLED(PROBING_HEATERS_OFF) - thermalManager.pause(pause); + thermalManager.pause(p); #endif - #if ENABLED(PROBING_FANS_OFF) - fans_pause(pause); + fans_pause(p); #endif - - if(pause) safe_delay(25); + if (p) safe_delay(25); } - #endif + #endif // QUIET_PROBING #if ENABLED(BLTOUCH) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 074b9ce130..6021d899ad 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -1353,38 +1353,29 @@ void Temperature::disable_all_heaters() { } #if ENABLED(PROBING_HEATERS_OFF) - void Temperature::pause(bool p) { - if (p == paused) { // If called out of order something is wrong - SERIAL_ERROR_START; - SERIAL_ERRORPGM("Heaters already "); - if (!paused) SERIAL_ERRORPGM("un"); - SERIAL_ERRORLNPGM("paused!"); - return; - } - if (p) { - HOTEND_LOOP() { - paused_hotend_temp[e] = degTargetHotend(e); - setTargetHotend(0, e); + void Temperature::pause(const bool p) { + if (p != paused) { + paused = p; + if (p) { + HOTEND_LOOP() { + paused_hotend_temp[e] = degTargetHotend(e); + setTargetHotend(0, e); + } + #if HAS_TEMP_BED + paused_bed_temp = degTargetBed(); + setTargetBed(0); + #endif + } + else { + HOTEND_LOOP() setTargetHotend(paused_hotend_temp[e], e); + #if HAS_TEMP_BED + setTargetBed(paused_bed_temp); + #endif } - #if HAS_TEMP_BED - paused_bed_temp = degTargetBed(); - setTargetBed(0); - #endif } - else { - HOTEND_LOOP() setTargetHotend(paused_hotend_temp[e], e); - #if HAS_TEMP_BED - setTargetBed(paused_bed_temp); - #endif - } - - paused = p; } - bool Temperature::ispaused() { - return paused; - } #endif // PROBING_HEATERS_OFF #if ENABLED(HEATER_0_USES_MAX6675) diff --git a/Marlin/temperature.h b/Marlin/temperature.h index 073341895f..e8632311d6 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -458,8 +458,7 @@ class Temperature { #endif // BABYSTEPPING #if ENABLED(PROBING_HEATERS_OFF) - static void pause(bool p); - static bool ispaused(); + static void pause(const bool p); #endif private: diff --git a/Marlin/ubl_G29.cpp b/Marlin/ubl_G29.cpp index 247ae27d65..7a174f702d 100644 --- a/Marlin/ubl_G29.cpp +++ b/Marlin/ubl_G29.cpp @@ -1006,7 +1006,7 @@ if (!ubl.state.active) SERIAL_PROTOCOLPGM("de"); SERIAL_PROTOCOLLNPGM("activated.\n"); } - + bool g29_parameter_parsing() { bool err_flag = false; diff --git a/Marlin/ubl_motion.cpp b/Marlin/ubl_motion.cpp index a6065dab55..5fbf141abd 100644 --- a/Marlin/ubl_motion.cpp +++ b/Marlin/ubl_motion.cpp @@ -225,7 +225,7 @@ const float e_normalized_dist = e_position / on_axis_distance, z_normalized_dist = z_position / on_axis_distance; - int current_xi = cell_start_xi, + int current_xi = cell_start_xi, current_yi = cell_start_yi; const float m = dy / dx,