diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index b4a37b7002..adfdfa0f99 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -3104,6 +3104,8 @@ //#define M114_REALTIME // Real current position based on forward kinematics //#define M114_LEGACY // M114 used to synchronize on every call. Enable if needed. +//#define REPORT_FAN_CHANGE // Report the new fan speed when changed by M106 (and others) + /** * Set the number of proportional font spaces required to fill up a typical character space. * This can help to better align the output of commands like `G29 O` Mesh Output. diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp index 46f48e22fa..38908b8d8c 100644 --- a/Marlin/src/lcd/menu/menu_temperature.cpp +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -161,15 +161,15 @@ void menu_temperature() { // Nozzle [1-5]: // #if HOTENDS == 1 - EDIT_ITEM_FAST(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, HEATER_0_MAXTEMP - HOTEND_OVERSHOOT, []{ thermalManager.start_watching_hotend(0); }); + EDIT_ITEM_FAST(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, HEATER_0_MAXTEMP - (HOTEND_OVERSHOOT), []{ thermalManager.start_watching_hotend(0); }); #elif HAS_MULTI_HOTEND HOTEND_LOOP() - EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_N, &thermalManager.temp_hotend[e].target, 0, thermalManager.heater_maxtemp[e] - HOTEND_OVERSHOOT, []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); }); + EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_N, &thermalManager.temp_hotend[e].target, 0, thermalManager.heater_maxtemp[e] - (HOTEND_OVERSHOOT), []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); }); #endif #if ENABLED(SINGLENOZZLE_STANDBY_TEMP) LOOP_S_L_N(e, 1, EXTRUDERS) - EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &singlenozzle_temp[e], 0, thermalManager.heater_maxtemp[0] - HOTEND_OVERSHOOT); + EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &singlenozzle_temp[e], 0, thermalManager.heater_maxtemp[0] - (HOTEND_OVERSHOOT)); #endif // diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 48cf388670..7c10beceeb 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -216,17 +216,20 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY, if (target >= FAN_COUNT) return; fan_speed[target] = speed; - report_fan_speed(target); + + TERN_(REPORT_FAN_CHANGE, report_fan_speed(target)); } - /** - * Report print fan speed for a target extruder - */ - void Temperature::report_fan_speed(const uint8_t target) { - if (target >= FAN_COUNT) return; - PORT_REDIRECT(SERIAL_BOTH); - SERIAL_ECHOLNPAIR("M106 P", target, " S", fan_speed[target]); - } + #if ENABLED(REPORT_FAN_CHANGE) + /** + * Report print fan speed for a target extruder + */ + void Temperature::report_fan_speed(const uint8_t target) { + if (target >= FAN_COUNT) return; + PORT_REDIRECT(SERIAL_BOTH); + SERIAL_ECHOLNPAIR("M106 P", target, " S", fan_speed[target]); + } + #endif #if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE) diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 2f8ddbf7be..cfd9f957c1 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -474,7 +474,10 @@ class Temperature { #define FANS_LOOP(I) LOOP_L_N(I, FAN_COUNT) static void set_fan_speed(const uint8_t target, const uint16_t speed); - static void report_fan_speed(const uint8_t target); + + #if ENABLED(REPORT_FAN_CHANGE) + static void report_fan_speed(const uint8_t target); + #endif #if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE) static bool fans_paused; @@ -487,13 +490,7 @@ class Temperature { static inline uint8_t scaledFanSpeed(const uint8_t target, const uint8_t fs) { UNUSED(target); // Potentially unused! - return (fs * uint16_t( - #if ENABLED(ADAPTIVE_FAN_SLOWING) - fan_speed_scaler[target] - #else - 128 - #endif - )) >> 7; + return (fs * uint16_t(TERN(ADAPTIVE_FAN_SLOWING, fan_speed_scaler[target], 128))) >> 7; } static inline uint8_t scaledFanSpeed(const uint8_t target) { @@ -629,7 +626,7 @@ class Temperature { static void setTargetBed(const int16_t celsius) { TERN_(AUTO_POWER_CONTROL, powerManager.power_on()); temp_bed.target = - #ifdef BED_MAXTEMP + #ifdef BED_MAX_TARGET _MIN(celsius, BED_MAX_TARGET) #else celsius @@ -790,11 +787,7 @@ class Temperature { #define HAS_MAX6675 EITHER(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675) #if HAS_MAX6675 - #if BOTH(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675) - #define COUNT_6675 2 - #else - #define COUNT_6675 1 - #endif + #define COUNT_6675 1 + BOTH(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675) #if COUNT_6675 > 1 #define READ_MAX6675(N) read_max6675(N) #else