From 01c646a892c9cd36baf577ca9be344e3490a7727 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 27 Apr 2020 22:35:25 -0500 Subject: [PATCH] Apply more HAS_HOTEND --- Marlin/src/feature/power.cpp | 2 +- Marlin/src/gcode/gcode.cpp | 2 +- Marlin/src/gcode/gcode.h | 2 +- Marlin/src/gcode/lcd/M145.cpp | 2 +- Marlin/src/inc/Conditionals_post.h | 2 +- Marlin/src/lcd/dogm/dogm_Statusscreen.h | 2 +- Marlin/src/lcd/extui/ui_api.cpp | 76 +++++++---------------- Marlin/src/module/configuration_store.cpp | 8 +-- Marlin/src/module/temperature.cpp | 4 +- 9 files changed, 34 insertions(+), 66 deletions(-) diff --git a/Marlin/src/feature/power.cpp b/Marlin/src/feature/power.cpp index add3e1d8a..71c0f1fac 100644 --- a/Marlin/src/feature/power.cpp +++ b/Marlin/src/feature/power.cpp @@ -74,7 +74,7 @@ bool Power::is_power_needed() { HOTEND_LOOP() if (thermalManager.degTargetHotend(e) > 0) return true; if (TERN0(HAS_HEATED_BED, thermalManager.degTargetBed() > 0)) return true; - #if HOTENDS && AUTO_POWER_E_TEMP + #if HAS_HOTEND && AUTO_POWER_E_TEMP HOTEND_LOOP() if (thermalManager.degHotend(e) >= AUTO_POWER_E_TEMP) return true; #endif diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index a6f54ee02..de6fe29e6 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -544,7 +544,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 120: M120(); break; // M120: Enable endstops case 121: M121(); break; // M121: Disable endstops - #if HOTENDS && HAS_LCD_MENU + #if HAS_HOTEND && HAS_LCD_MENU case 145: M145(); break; // M145: Set material heatup parameters #endif diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 6a4a7af98..37521e876 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -602,7 +602,7 @@ private: static void M191(); #endif - #if HOTENDS && HAS_LCD_MENU + #if HAS_HOTEND && HAS_LCD_MENU static void M145(); #endif diff --git a/Marlin/src/gcode/lcd/M145.cpp b/Marlin/src/gcode/lcd/M145.cpp index feac437c6..15ff54173 100644 --- a/Marlin/src/gcode/lcd/M145.cpp +++ b/Marlin/src/gcode/lcd/M145.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if HOTENDS && HAS_LCD_MENU +#if HAS_HOTEND && HAS_LCD_MENU #include "../gcode.h" #include "../../lcd/ultralcd.h" diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 5635453b6..5d5d4321a 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1653,7 +1653,7 @@ #define HAS_TEMP_ADC_CHAMBER 1 #endif -#if HOTENDS && EITHER(HAS_TEMP_ADC_0, HEATER_0_USES_MAX6675) +#if HAS_HOTEND && EITHER(HAS_TEMP_ADC_0, HEATER_0_USES_MAX6675) #define HAS_TEMP_HOTEND 1 #endif #define HAS_TEMP_BED HAS_TEMP_ADC_BED diff --git a/Marlin/src/lcd/dogm/dogm_Statusscreen.h b/Marlin/src/lcd/dogm/dogm_Statusscreen.h index 6583a767d..1095a97c0 100644 --- a/Marlin/src/lcd/dogm/dogm_Statusscreen.h +++ b/Marlin/src/lcd/dogm/dogm_Statusscreen.h @@ -1749,7 +1749,7 @@ #if HAS_FAN0 && STATUS_FAN_WIDTH && HOTENDS <= 4 && defined(STATUS_FAN_FRAMES) #define DO_DRAW_FAN 1 #endif -#if HOTENDS && ENABLED(STATUS_HOTEND_ANIM) +#if BOTH(HAS_HOTEND, STATUS_HOTEND_ANIM) #define ANIM_HOTEND 1 #endif #if BOTH(DO_DRAW_BED, STATUS_BED_ANIM) diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index ab5aa887e..a9536c68c 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -169,7 +169,7 @@ namespace ExtUI { } void enableHeater(const extruder_t extruder) { - #if HOTENDS && HEATER_IDLE_HANDLER + #if HAS_HOTEND && HEATER_IDLE_HANDLER thermalManager.reset_hotend_idle_timer(extruder - E0); #else UNUSED(extruder); @@ -234,7 +234,7 @@ namespace ExtUI { bool isHeaterIdle(const extruder_t extruder) { return false - #if HOTENDS && HEATER_IDLE_HANDLER + #if HAS_HOTEND && HEATER_IDLE_HANDLER || thermalManager.hotend_idle[extruder - E0].timed_out #else ; UNUSED(extruder) @@ -746,13 +746,13 @@ namespace ExtUI { #endif float getZOffset_mm() { - #if HAS_BED_PROBE - return probe.offset.z; - #elif ENABLED(BABYSTEP_DISPLAY_TOTAL) - return (planner.steps_to_mm[Z_AXIS] * babystep.axis_total[BS_AXIS_IND(Z_AXIS)]); - #else - return 0.0; - #endif + return (0.0f + #if HAS_BED_PROBE + + probe.offset.z + #elif ENABLED(BABYSTEP_DISPLAY_TOTAL) + + planner.steps_to_mm[Z_AXIS] * babystep.axis_total[BS_AXIS_IND(Z_AXIS)] + #endif + ); } void setZOffset_mm(const float value) { @@ -857,17 +857,9 @@ namespace ExtUI { float getFeedrate_percent() { return feedrate_percentage; } #if ENABLED(PIDTEMP) - float getPIDValues_Kp(const extruder_t tool) { - return PID_PARAM(Kp, tool); - } - - float getPIDValues_Ki(const extruder_t tool) { - return unscalePID_i(PID_PARAM(Ki, tool)); - } - - float getPIDValues_Kd(const extruder_t tool) { - return unscalePID_d(PID_PARAM(Kd, tool)); - } + float getPIDValues_Kp(const extruder_t tool) { return PID_PARAM(Kp, tool); } + float getPIDValues_Ki(const extruder_t tool) { return unscalePID_i(PID_PARAM(Ki, tool)); } + float getPIDValues_Kd(const extruder_t tool) { return unscalePID_d(PID_PARAM(Kd, tool)); } void setPIDValues(const float p, const float i, const float d, extruder_t tool) { thermalManager.temp_hotend[tool].pid.Kp = p; @@ -876,23 +868,15 @@ namespace ExtUI { thermalManager.updatePID(); } - void startPIDTune(const float temp, extruder_t tool){ + void startPIDTune(const float temp, extruder_t tool) { thermalManager.PID_autotune(temp, (heater_ind_t)tool, 8, true); } #endif #if ENABLED(PIDTEMPBED) - float getBedPIDValues_Kp() { - return thermalManager.temp_bed.pid.Kp; - } - - float getBedPIDValues_Ki() { - return unscalePID_i(thermalManager.temp_bed.pid.Ki); - } - - float getBedPIDValues_Kd() { - return unscalePID_d(thermalManager.temp_bed.pid.Kd); - } + float getBedPIDValues_Kp() { return thermalManager.temp_bed.pid.Kp; } + float getBedPIDValues_Ki() { return unscalePID_i(thermalManager.temp_bed.pid.Ki); } + float getBedPIDValues_Kd() { return unscalePID_d(thermalManager.temp_bed.pid.Kd); } void setBedPIDValues(const float p, const float i, const float d) { thermalManager.temp_bed.pid.Kp = p; @@ -906,20 +890,12 @@ namespace ExtUI { } #endif - void injectCommands_P(PGM_P const gcode) { - queue.inject_P(gcode); - } + void injectCommands_P(PGM_P const gcode) { queue.inject_P(gcode); } bool commandsInQueue() { return (planner.movesplanned() || queue.has_commands_queued()); } - bool isAxisPositionKnown(const axis_t axis) { - return TEST(axis_known_position, axis); - } - - bool isAxisPositionKnown(const extruder_t) { - return TEST(axis_known_position, E_AXIS); - } - + bool isAxisPositionKnown(const axis_t axis) { return TEST(axis_known_position, axis); } + bool isAxisPositionKnown(const extruder_t) { return TEST(axis_known_position, E_AXIS); } bool isPositionKnown() { return all_axes_known(); } bool isMachineHomed() { return all_axes_homed(); } @@ -1008,17 +984,9 @@ namespace ExtUI { return IFSD(IS_SD_INSERTED() && card.isMounted(), false); } - void pausePrint() { - ui.pause_print(); - } - - void resumePrint() { - ui.resume_print(); - } - - void stopPrint() { - ui.abort_print(); - } + void pausePrint() { ui.pause_print(); } + void resumePrint() { ui.resume_print(); } + void stopPrint() { ui.abort_print(); } void onUserConfirmRequired_P(PGM_P const pstr) { char msg[strlen_P(pstr) + 1]; diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index ea324731c..1582cf706 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -799,7 +799,7 @@ void MarlinSettings::postprocess() { { _FIELD_TEST(ui_preheat_hotend_temp); - #if HOTENDS && HAS_LCD_MENU + #if HAS_HOTEND && HAS_LCD_MENU const int16_t (&ui_preheat_hotend_temp)[2] = ui.preheat_hotend_temp, (&ui_preheat_bed_temp)[2] = ui.preheat_bed_temp; const uint8_t (&ui_preheat_fan_speed)[2] = ui.preheat_fan_speed; @@ -1649,7 +1649,7 @@ void MarlinSettings::postprocess() { { _FIELD_TEST(ui_preheat_hotend_temp); - #if HOTENDS && HAS_LCD_MENU + #if HAS_HOTEND && HAS_LCD_MENU int16_t (&ui_preheat_hotend_temp)[2] = ui.preheat_hotend_temp, (&ui_preheat_bed_temp)[2] = ui.preheat_bed_temp; uint8_t (&ui_preheat_fan_speed)[2] = ui.preheat_fan_speed; @@ -2557,7 +2557,7 @@ void MarlinSettings::reset() { // Preheat parameters // - #if HOTENDS && HAS_LCD_MENU + #if HAS_HOTEND && HAS_LCD_MENU ui.preheat_hotend_temp[0] = PREHEAT_1_TEMP_HOTEND; ui.preheat_hotend_temp[1] = PREHEAT_2_TEMP_HOTEND; ui.preheat_bed_temp[0] = PREHEAT_1_TEMP_BED; @@ -3077,7 +3077,7 @@ void MarlinSettings::reset() { #endif // [XYZ]_DUAL_ENDSTOPS - #if HOTENDS && HAS_LCD_MENU + #if HAS_HOTEND && HAS_LCD_MENU CONFIG_ECHO_HEADING("Material heatup parameters:"); LOOP_L_N(i, COUNT(ui.preheat_hotend_temp)) { diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index d27a012e4..e55dcb074 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -2386,7 +2386,7 @@ void Temperature::tick() { #if DISABLED(SLOW_PWM_HEATERS) - #if HOTENDS || HAS_HEATED_BED || HAS_HEATED_CHAMBER + #if HAS_HOTEND || HAS_HEATED_BED || HAS_HEATED_CHAMBER constexpr uint8_t pwm_mask = #if ENABLED(SOFT_PWM_DITHER) _BV(SOFT_PWM_SCALE) - 1 @@ -2931,7 +2931,7 @@ void Temperature::tick() { #endif // AUTO_REPORT_TEMPERATURES - #if HOTENDS && HAS_DISPLAY + #if HAS_HOTEND && HAS_DISPLAY void Temperature::set_heating_message(const uint8_t e) { const bool heating = isHeatingHotend(e); ui.status_printf_P(0,