Add HAS_FAN and others

2.0.x
Scott Lahteine 5 years ago
parent 3d45a4bd23
commit 8b3c7dda75

@ -402,7 +402,7 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float
// Wait for buffered blocks to complete // Wait for buffered blocks to complete
planner.synchronize(); planner.synchronize();
#if ENABLED(ADVANCED_PAUSE_FANS_PAUSE) && FAN_COUNT > 0 #if ENABLED(ADVANCED_PAUSE_FANS_PAUSE) && HAS_FAN
thermalManager.set_fans_paused(true); thermalManager.set_fans_paused(true);
#endif #endif
@ -621,7 +621,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
if (did_pause_print) { card.startFileprint(); --did_pause_print; } if (did_pause_print) { card.startFileprint(); --did_pause_print; }
#endif #endif
#if ENABLED(ADVANCED_PAUSE_FANS_PAUSE) && FAN_COUNT > 0 #if ENABLED(ADVANCED_PAUSE_FANS_PAUSE) && HAS_FAN
thermalManager.set_fans_paused(false); thermalManager.set_fans_paused(false);
#endif #endif

@ -195,7 +195,7 @@ void PrintJobRecovery::save(const bool force/*=false*/) {
TERN_(HAS_HEATED_BED, info.target_temperature_bed = thermalManager.temp_bed.target); TERN_(HAS_HEATED_BED, info.target_temperature_bed = thermalManager.temp_bed.target);
#if FAN_COUNT #if HAS_FAN
COPY(info.fan_speed, thermalManager.fan_speed); COPY(info.fan_speed, thermalManager.fan_speed);
#endif #endif
@ -508,7 +508,7 @@ void PrintJobRecovery::resume() {
DEBUG_ECHOLNPAIR("target_temperature_bed: ", info.target_temperature_bed); DEBUG_ECHOLNPAIR("target_temperature_bed: ", info.target_temperature_bed);
#endif #endif
#if FAN_COUNT #if HAS_FAN
DEBUG_ECHOPGM("fan_speed: "); DEBUG_ECHOPGM("fan_speed: ");
FANS_LOOP(i) { FANS_LOOP(i) {
DEBUG_ECHO(int(info.fan_speed[i])); DEBUG_ECHO(int(info.fan_speed[i]));

@ -76,7 +76,7 @@ typedef struct {
int16_t target_temperature_bed; int16_t target_temperature_bed;
#endif #endif
#if FAN_COUNT #if HAS_FAN
uint8_t fan_speed[FAN_COUNT]; uint8_t fan_speed[FAN_COUNT];
#endif #endif

@ -65,7 +65,7 @@ class ProbeTempComp {
static constexpr xy_pos_t measure_point = PTC_PROBE_POS; // Coordinates to probe static constexpr xy_pos_t measure_point = PTC_PROBE_POS; // Coordinates to probe
//measure_point = { 12.0f, 7.3f }; // Coordinates for the MK52 magnetic heatbed //measure_point = { 12.0f, 7.3f }; // Coordinates for the MK52 magnetic heatbed
static constexpr int probe_calib_bed_temp = BED_MAXTEMP - 10, // Bed temperature while calibrating probe static constexpr int probe_calib_bed_temp = BED_MAX_TARGET, // Bed temperature while calibrating probe
bed_calib_probe_temp = 30; // Probe temperature while calibrating bed bed_calib_probe_temp = 30; // Probe temperature while calibrating bed
static int16_t *sensor_z_offsets[TSI_COUNT], static int16_t *sensor_z_offsets[TSI_COUNT],

@ -511,8 +511,8 @@ void GcodeSuite::G26() {
#if HAS_HEATED_BED #if HAS_HEATED_BED
if (parser.seenval('B')) { if (parser.seenval('B')) {
g26_bed_temp = parser.value_celsius(); g26_bed_temp = parser.value_celsius();
if (g26_bed_temp && !WITHIN(g26_bed_temp, 40, (BED_MAXTEMP - 10))) { if (g26_bed_temp && !WITHIN(g26_bed_temp, 40, BED_MAX_TARGET)) {
SERIAL_ECHOLNPAIR("?Specified bed temperature not plausible (40-", int(BED_MAXTEMP - 10), "C)."); SERIAL_ECHOLNPAIR("?Specified bed temperature not plausible (40-", int(BED_MAX_TARGET), "C).");
return; return;
} }
} }

@ -201,7 +201,7 @@ void GcodeSuite::G76() {
report_temps(next_temp_report); report_temps(next_temp_report);
const float measured_z = g76_probe(TSI_BED, target_bed, noz_pos_xyz); const float measured_z = g76_probe(TSI_BED, target_bed, noz_pos_xyz);
if (isnan(measured_z) || target_bed > BED_MAXTEMP - 10) break; if (isnan(measured_z) || target_bed > BED_MAX_TARGET) break;
} }
SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index()); SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());

@ -115,7 +115,7 @@ void GcodeSuite::M217() {
if (parser.seenval('P')) { const int16_t v = parser.value_linear_units(); toolchange_settings.prime_speed = constrain(v, 10, 5400); } if (parser.seenval('P')) { const int16_t v = parser.value_linear_units(); toolchange_settings.prime_speed = constrain(v, 10, 5400); }
if (parser.seenval('R')) { const int16_t v = parser.value_linear_units(); toolchange_settings.retract_speed = constrain(v, 10, 5400); } if (parser.seenval('R')) { const int16_t v = parser.value_linear_units(); toolchange_settings.retract_speed = constrain(v, 10, 5400); }
if (parser.seenval('U')) { const int16_t v = parser.value_linear_units(); toolchange_settings.unretract_speed = constrain(v, 10, 5400); } if (parser.seenval('U')) { const int16_t v = parser.value_linear_units(); toolchange_settings.unretract_speed = constrain(v, 10, 5400); }
#if TOOLCHANGE_FS_FAN >= 0 && FAN_COUNT > 0 #if TOOLCHANGE_FS_FAN >= 0 && HAS_FAN
if (parser.seenval('F')) { const int16_t v = parser.value_linear_units(); toolchange_settings.fan_speed = constrain(v, 0, 255); } if (parser.seenval('F')) { const int16_t v = parser.value_linear_units(); toolchange_settings.fan_speed = constrain(v, 0, 255); }
if (parser.seenval('G')) { const int16_t v = parser.value_linear_units(); toolchange_settings.fan_time = constrain(v, 1, 30); } if (parser.seenval('G')) { const int16_t v = parser.value_linear_units(); toolchange_settings.fan_time = constrain(v, 1, 30); }
#endif #endif

@ -24,7 +24,7 @@
#include "../../MarlinCore.h" // for pin_is_protected #include "../../MarlinCore.h" // for pin_is_protected
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if FAN_COUNT > 0 #if HAS_FAN
#include "../../module/temperature.h" #include "../../module/temperature.h"
#endif #endif
@ -64,7 +64,7 @@ void GcodeSuite::M42() {
if (!parser.seenval('S')) return; if (!parser.seenval('S')) return;
const byte pin_status = parser.value_byte(); const byte pin_status = parser.value_byte();
#if FAN_COUNT > 0 #if HAS_FAN
switch (pin) { switch (pin) {
#if HAS_FAN0 #if HAS_FAN0
case FAN0_PIN: thermalManager.fan_speed[0] = pin_status; return; case FAN0_PIN: thermalManager.fan_speed[0] = pin_status; return;

@ -92,7 +92,7 @@ void GcodeSuite::M81() {
print_job_timer.stop(); print_job_timer.stop();
planner.finish_and_disable(); planner.finish_and_disable();
#if FAN_COUNT > 0 #if HAS_FAN
thermalManager.zero_fan_speeds(); thermalManager.zero_fan_speeds();
#if ENABLED(PROBING_FANS_OFF) #if ENABLED(PROBING_FANS_OFF)
thermalManager.fans_paused = false; thermalManager.fans_paused = false;

@ -467,7 +467,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 105: M105(); return; // M105: Report Temperatures (and say "ok") case 105: M105(); return; // M105: Report Temperatures (and say "ok")
#if FAN_COUNT > 0 #if HAS_FAN
case 106: M106(); break; // M106: Fan On case 106: M106(); break; // M106: Fan On
case 107: M107(); break; // M107: Fan Off case 107: M107(); break; // M107: Fan Off
#endif #endif

@ -554,7 +554,7 @@ private:
static void M105(); static void M105();
#if FAN_COUNT > 0 #if HAS_FAN
static void M106(); static void M106();
static void M107(); static void M107();
#endif #endif

@ -52,7 +52,7 @@ void GcodeSuite::M145() {
#if TEMP_SENSOR_BED != 0 #if TEMP_SENSOR_BED != 0
if (parser.seenval('B')) { if (parser.seenval('B')) {
v = parser.value_int(); v = parser.value_int();
ui.preheat_bed_temp[material] = constrain(v, BED_MINTEMP, BED_MAXTEMP - 10); ui.preheat_bed_temp[material] = constrain(v, BED_MINTEMP, BED_MAX_TARGET);
} }
#endif #endif
} }

@ -22,7 +22,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if FAN_COUNT > 0 #if HAS_FAN
#include "../gcode.h" #include "../gcode.h"
#include "../../module/motion.h" #include "../../module/motion.h"
@ -74,4 +74,4 @@ void GcodeSuite::M107() {
thermalManager.set_fan_speed(p, 0); thermalManager.set_fan_speed(p, 0);
} }
#endif // FAN_COUNT > 0 #endif // HAS_FAN

@ -408,6 +408,8 @@
*/ */
#if EXTRUDERS == 0 #if EXTRUDERS == 0
#undef EXTRUDERS
#define EXTRUDERS 0
#undef DISTINCT_E_FACTORS #undef DISTINCT_E_FACTORS
#undef SINGLENOZZLE #undef SINGLENOZZLE
#undef SWITCHING_EXTRUDER #undef SWITCHING_EXTRUDER

@ -1707,6 +1707,7 @@
// Shorthand for common combinations // Shorthand for common combinations
#if HAS_TEMP_BED && HAS_HEATER_BED #if HAS_TEMP_BED && HAS_HEATER_BED
#define HAS_HEATED_BED 1 #define HAS_HEATED_BED 1
#define BED_MAX_TARGET (BED_MAXTEMP - 10)
#endif #endif
#if HAS_HEATED_BED || HAS_TEMP_CHAMBER #if HAS_HEATED_BED || HAS_TEMP_CHAMBER
#define BED_OR_CHAMBER 1 #define BED_OR_CHAMBER 1
@ -2084,6 +2085,7 @@
#endif #endif
#if FAN_COUNT > 0 #if FAN_COUNT > 0
#define HAS_FAN 1
#define WRITE_FAN(n, v) WRITE(FAN##n##_PIN, (v) ^ FAN_INVERTING) #define WRITE_FAN(n, v) WRITE(FAN##n##_PIN, (v) ^ FAN_INVERTING)
#endif #endif

@ -262,7 +262,7 @@
#error "LCD_PIN_RESET is now LCD_RESET_PIN. Please update your pins definitions." #error "LCD_PIN_RESET is now LCD_RESET_PIN. Please update your pins definitions."
#elif defined(EXTRUDER_0_AUTO_FAN_PIN) || defined(EXTRUDER_1_AUTO_FAN_PIN) || defined(EXTRUDER_2_AUTO_FAN_PIN) || defined(EXTRUDER_3_AUTO_FAN_PIN) #elif defined(EXTRUDER_0_AUTO_FAN_PIN) || defined(EXTRUDER_1_AUTO_FAN_PIN) || defined(EXTRUDER_2_AUTO_FAN_PIN) || defined(EXTRUDER_3_AUTO_FAN_PIN)
#error "EXTRUDER_[0123]_AUTO_FAN_PIN is now E[0123]_AUTO_FAN_PIN. Please update your Configuration_adv.h." #error "EXTRUDER_[0123]_AUTO_FAN_PIN is now E[0123]_AUTO_FAN_PIN. Please update your Configuration_adv.h."
#elif defined(PID_FAN_SCALING) && FAN_COUNT <= 0 #elif defined(PID_FAN_SCALING) && !HAS_FAN
#error "PID_FAN_SCALING needs at least one fan enabled." #error "PID_FAN_SCALING needs at least one fan enabled."
#elif defined(min_software_endstops) || defined(max_software_endstops) #elif defined(min_software_endstops) || defined(max_software_endstops)
#error "(min|max)_software_endstops are now (MIN|MAX)_SOFTWARE_ENDSTOPS. Please update your configuration." #error "(min|max)_software_endstops are now (MIN|MAX)_SOFTWARE_ENDSTOPS. Please update your configuration."

@ -1072,7 +1072,7 @@ void MarlinUI::draw_status_screen() {
if (TERN0(HAS_HEATED_BED, thermalManager.degTargetBed() > 0)) leds |= LED_A; if (TERN0(HAS_HEATED_BED, thermalManager.degTargetBed() > 0)) leds |= LED_A;
if (TERN0(HAS_HOTEND, thermalManager.degTargetHotend(0) > 0)) leds |= LED_B; if (TERN0(HAS_HOTEND, thermalManager.degTargetHotend(0) > 0)) leds |= LED_B;
#if FAN_COUNT > 0 #if HAS_FAN
if ( TERN0(HAS_FAN0, thermalManager.fan_speed[0]) if ( TERN0(HAS_FAN0, thermalManager.fan_speed[0])
|| TERN0(HAS_FAN1, thermalManager.fan_speed[1]) || TERN0(HAS_FAN1, thermalManager.fan_speed[1])
|| TERN0(HAS_FAN2, thermalManager.fan_speed[2]) || TERN0(HAS_FAN2, thermalManager.fan_speed[2])
@ -1082,7 +1082,7 @@ void MarlinUI::draw_status_screen() {
|| TERN0(HAS_FAN6, thermalManager.fan_speed[6]) || TERN0(HAS_FAN6, thermalManager.fan_speed[6])
|| TERN0(HAS_FAN7, thermalManager.fan_speed[7]) || TERN0(HAS_FAN7, thermalManager.fan_speed[7])
) leds |= LED_C; ) leds |= LED_C;
#endif // FAN_COUNT > 0 #endif // HAS_FAN
if (TERN0(HAS_MULTI_HOTEND, thermalManager.degTargetHotend(1) > 0)) leds |= LED_C; if (TERN0(HAS_MULTI_HOTEND, thermalManager.degTargetHotend(1) > 0)) leds |= LED_C;

@ -277,7 +277,7 @@ void DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable
#endif #endif
// Send fan status value to the display. // Send fan status value to the display.
#if FAN_COUNT > 0 #if HAS_FAN
void DGUSScreenVariableHandler::DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var) { void DGUSScreenVariableHandler::DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var) {
if (var.memadr) { if (var.memadr) {
DEBUG_ECHOPAIR(" DGUSLCD_SendFanStatusToDisplay ", var.VP); DEBUG_ECHOPAIR(" DGUSLCD_SendFanStatusToDisplay ", var.VP);
@ -872,7 +872,7 @@ void DGUSScreenVariableHandler::HandleProbeOffsetZChanged(DGUS_VP_Variable &var,
} }
#endif #endif
#if FAN_COUNT #if HAS_FAN
void DGUSScreenVariableHandler::HandleFanControl(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenVariableHandler::HandleFanControl(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleFanControl"); DEBUG_ECHOLNPGM("HandleFanControl");
*(uint8_t*)var.memadr = *(uint8_t*)var.memadr > 0 ? 0 : 255; *(uint8_t*)var.memadr = *(uint8_t*)var.memadr > 0 ? 0 : 255;

@ -151,7 +151,7 @@ public:
// Hook for live z adjust action // Hook for live z adjust action
static void HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr); static void HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr);
#endif #endif
#if FAN_COUNT > 0 #if HAS_FAN
// Hook for fan control // Hook for fan control
static void HandleFanControl(DGUS_VP_Variable &var, void *val_ptr); static void HandleFanControl(DGUS_VP_Variable &var, void *val_ptr);
#endif #endif
@ -221,7 +221,7 @@ public:
static void DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var); static void DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var);
static void DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var); static void DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var);
#endif #endif
#if FAN_COUNT > 0 #if HAS_FAN
static void DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var); static void DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var);
#endif #endif
static void DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var); static void DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var);

@ -56,7 +56,7 @@ const uint16_t VPList_Main[] PROGMEM = {
#if HAS_HEATED_BED #if HAS_HEATED_BED
VP_T_Bed_Is, VP_T_Bed_Set, VP_BED_STATUS, VP_T_Bed_Is, VP_T_Bed_Set, VP_BED_STATUS,
#endif #endif
#if FAN_COUNT > 0 #if HAS_FAN
VP_Fan0_Percentage, VP_FAN0_STATUS, VP_Fan0_Percentage, VP_FAN0_STATUS,
#endif #endif
VP_XPos, VP_YPos, VP_ZPos, VP_XPos, VP_YPos, VP_ZPos,
@ -92,7 +92,7 @@ const uint16_t VPList_Status[] PROGMEM = {
#if HAS_HEATED_BED #if HAS_HEATED_BED
VP_T_Bed_Is, VP_T_Bed_Set, VP_T_Bed_Is, VP_T_Bed_Set,
#endif #endif
#if FAN_COUNT > 0 #if HAS_FAN
VP_Fan0_Percentage, VP_Fan0_Percentage,
#endif #endif
VP_XPos, VP_YPos, VP_ZPos, VP_XPos, VP_YPos, VP_ZPos,
@ -192,7 +192,7 @@ const uint16_t VPList_SD_PrintManipulation[] PROGMEM = {
#if HAS_HEATED_BED #if HAS_HEATED_BED
VP_T_Bed_Is, VP_T_Bed_Set, VP_T_Bed_Is, VP_T_Bed_Set,
#endif #endif
#if FAN_COUNT > 0 #if HAS_FAN
VP_Fan0_Percentage, VP_Fan0_Percentage,
#if FAN_COUNT > 1 #if FAN_COUNT > 1
VP_Fan1_Percentage, VP_Fan1_Percentage,
@ -410,7 +410,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
#endif #endif
// Fan Data // Fan Data
#if FAN_COUNT #if HAS_FAN
#define FAN_VPHELPER(N) \ #define FAN_VPHELPER(N) \
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], DGUSScreenVariableHandler::DGUSLCD_PercentageToUint8, &DGUSScreenVariableHandler::DGUSLCD_SendPercentageToDisplay), \ VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], DGUSScreenVariableHandler::DGUSLCD_PercentageToUint8, &DGUSScreenVariableHandler::DGUSLCD_SendPercentageToDisplay), \
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], &DGUSScreenVariableHandler::HandleFanControl, nullptr), \ VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], &DGUSScreenVariableHandler::HandleFanControl, nullptr), \

@ -56,7 +56,7 @@ const uint16_t VPList_Main[] PROGMEM = {
#if HAS_HEATED_BED #if HAS_HEATED_BED
VP_T_Bed_Is, VP_T_Bed_Set, VP_BED_STATUS, VP_T_Bed_Is, VP_T_Bed_Set, VP_BED_STATUS,
#endif #endif
#if FAN_COUNT > 0 #if HAS_FAN
VP_Fan0_Percentage, VP_FAN0_STATUS, VP_Fan0_Percentage, VP_FAN0_STATUS,
#endif #endif
VP_XPos, VP_YPos, VP_ZPos, VP_XPos, VP_YPos, VP_ZPos,
@ -92,7 +92,7 @@ const uint16_t VPList_Status[] PROGMEM = {
#if HAS_HEATED_BED #if HAS_HEATED_BED
VP_T_Bed_Is, VP_T_Bed_Set, VP_T_Bed_Is, VP_T_Bed_Set,
#endif #endif
#if FAN_COUNT > 0 #if HAS_FAN
VP_Fan0_Percentage, VP_Fan0_Percentage,
#endif #endif
VP_XPos, VP_YPos, VP_ZPos, VP_XPos, VP_YPos, VP_ZPos,
@ -191,7 +191,7 @@ const uint16_t VPList_SD_PrintManipulation[] PROGMEM = {
#if HAS_HEATED_BED #if HAS_HEATED_BED
VP_T_Bed_Is, VP_T_Bed_Set, VP_T_Bed_Is, VP_T_Bed_Set,
#endif #endif
#if FAN_COUNT > 0 #if HAS_FAN
VP_Fan0_Percentage, VP_Fan0_Percentage,
#if FAN_COUNT > 1 #if FAN_COUNT > 1
VP_Fan1_Percentage, VP_Fan1_Percentage,
@ -212,7 +212,7 @@ const uint16_t VPList_SDPrintTune[] PROGMEM = {
VP_T_Bed_Is, VP_T_Bed_Set, VP_T_Bed_Is, VP_T_Bed_Set,
#endif #endif
VP_Feedrate_Percentage, VP_Feedrate_Percentage,
#if FAN_COUNT > 0 #if HAS_FAN
VP_Fan0_Percentage, VP_Fan0_Percentage,
#endif #endif
VP_Flowrate_E0, VP_Flowrate_E0,
@ -409,7 +409,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
#endif #endif
// Fan Data // Fan Data
#if FAN_COUNT #if HAS_FAN
#define FAN_VPHELPER(N) \ #define FAN_VPHELPER(N) \
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], DGUSScreenVariableHandler::DGUSLCD_PercentageToUint8, &DGUSScreenVariableHandler::DGUSLCD_SendPercentageToDisplay), \ VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], DGUSScreenVariableHandler::DGUSLCD_PercentageToUint8, &DGUSScreenVariableHandler::DGUSLCD_SendPercentageToDisplay), \
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], &DGUSScreenVariableHandler::HandleFanControl, nullptr), \ VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], &DGUSScreenVariableHandler::HandleFanControl, nullptr), \

@ -73,7 +73,7 @@ const uint16_t VPList_Status[] PROGMEM = {
#if HAS_HEATED_BED #if HAS_HEATED_BED
VP_T_Bed_Is, VP_T_Bed_Set, VP_T_Bed_Is, VP_T_Bed_Set,
#endif #endif
#if FAN_COUNT > 0 #if HAS_FAN
VP_Fan0_Percentage, VP_Fan0_Percentage,
#endif #endif
VP_XPos, VP_YPos, VP_ZPos, VP_XPos, VP_YPos, VP_ZPos,
@ -233,7 +233,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
#endif #endif
// Fan Data // Fan Data
#if FAN_COUNT #if HAS_FAN
#define FAN_VPHELPER(N) \ #define FAN_VPHELPER(N) \
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], DGUSScreenVariableHandler::DGUSLCD_PercentageToUint8, &DGUSScreenVariableHandler::DGUSLCD_SendPercentageToDisplay), \ VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], DGUSScreenVariableHandler::DGUSLCD_PercentageToUint8, &DGUSScreenVariableHandler::DGUSLCD_SendPercentageToDisplay), \
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], &DGUSScreenVariableHandler::HandleFanControl, nullptr), \ VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], &DGUSScreenVariableHandler::HandleFanControl, nullptr), \

@ -60,7 +60,7 @@ void TemperatureScreen::onRedraw(draw_mode_t what) {
#if HAS_HEATED_CHAMBER #if HAS_HEATED_CHAMBER
w.adjuster( 22, GET_TEXT_F(MSG_CHAMBER), getTargetTemp_celsius(CHAMBER)); w.adjuster( 22, GET_TEXT_F(MSG_CHAMBER), getTargetTemp_celsius(CHAMBER));
#endif #endif
#if FAN_COUNT > 0 #if HAS_FAN
w.color(fan_speed).units(GET_TEXT_F(MSG_UNITS_PERCENT)); w.color(fan_speed).units(GET_TEXT_F(MSG_UNITS_PERCENT));
w.adjuster( 10, GET_TEXT_F(MSG_FAN_SPEED), getTargetFan_percent(FAN0)); w.adjuster( 10, GET_TEXT_F(MSG_FAN_SPEED), getTargetFan_percent(FAN0));
#endif #endif
@ -90,7 +90,7 @@ bool TemperatureScreen::onTouchHeld(uint8_t tag) {
case 8: UI_DECREMENT(TargetTemp_celsius, E3); break; case 8: UI_DECREMENT(TargetTemp_celsius, E3); break;
case 9: UI_INCREMENT(TargetTemp_celsius, E3); break; case 9: UI_INCREMENT(TargetTemp_celsius, E3); break;
#endif #endif
#if FAN_COUNT > 0 #if HAS_FAN
case 10: UI_DECREMENT(TargetFan_percent, FAN0); break; case 10: UI_DECREMENT(TargetFan_percent, FAN0); break;
case 11: UI_INCREMENT(TargetFan_percent, FAN0); break; case 11: UI_INCREMENT(TargetFan_percent, FAN0); break;
#endif #endif
@ -99,7 +99,7 @@ bool TemperatureScreen::onTouchHeld(uint8_t tag) {
REPEAT(HOTENDS, _HOTEND_OFF); REPEAT(HOTENDS, _HOTEND_OFF);
TERN_(HAS_HEATED_BED, setTargetTemp_celsius(0,BED)); TERN_(HAS_HEATED_BED, setTargetTemp_celsius(0,BED));
TERN_(HAS_HEATED_CHAMBER, setTargetTemp_celsius(0,CHAMBER)); TERN_(HAS_HEATED_CHAMBER, setTargetTemp_celsius(0,CHAMBER));
#if FAN_COUNT > 0 #if HAS_FAN
setTargetFan_percent(0,FAN0); setTargetFan_percent(0,FAN0);
#endif #endif
break; break;

@ -293,7 +293,7 @@ namespace ExtUI {
} }
float getTargetFan_percent(const fan_t fan) { float getTargetFan_percent(const fan_t fan) {
#if FAN_COUNT > 0 #if HAS_FAN
return thermalManager.fanPercent(thermalManager.fan_speed[fan - FAN0]); return thermalManager.fanPercent(thermalManager.fan_speed[fan - FAN0]);
#else #else
UNUSED(fan); UNUSED(fan);
@ -302,7 +302,7 @@ namespace ExtUI {
} }
float getActualFan_percent(const fan_t fan) { float getActualFan_percent(const fan_t fan) {
#if FAN_COUNT > 0 #if HAS_FAN
return thermalManager.fanPercent(thermalManager.scaledFanSpeed(fan - FAN0)); return thermalManager.fanPercent(thermalManager.scaledFanSpeed(fan - FAN0));
#else #else
UNUSED(fan); UNUSED(fan);
@ -940,7 +940,7 @@ namespace ExtUI {
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
if (heater == BED) if (heater == BED)
thermalManager.setTargetBed(LROUND(constrain(value, 0, BED_MAXTEMP - 10))); thermalManager.setTargetBed(LROUND(constrain(value, 0, BED_MAX_TARGET)));
else else
#endif #endif
{ {
@ -963,7 +963,7 @@ namespace ExtUI {
} }
void setTargetFan_percent(const float value, const fan_t fan) { void setTargetFan_percent(const float value, const fan_t fan) {
#if FAN_COUNT > 0 #if HAS_FAN
if (fan < FAN_COUNT) if (fan < FAN_COUNT)
thermalManager.set_fan_speed(fan - FAN0, map(constrain(value, 0, 100), 0, 100, 0, 255)); thermalManager.set_fan_speed(fan - FAN0, map(constrain(value, 0, 100), 0, 100, 0, 255));
#else #else

@ -522,7 +522,7 @@ void menu_move();
#endif #endif
// First Fan Speed title in "Tune" and "Control>Temperature" menus // First Fan Speed title in "Tune" and "Control>Temperature" menus
#if FAN_COUNT > 0 && HAS_FAN0 #if HAS_FAN && HAS_FAN0
#if FAN_COUNT > 1 #if FAN_COUNT > 1
#define FAN_SPEED_1_SUFFIX " 1" #define FAN_SPEED_1_SUFFIX " 1"
#else #else

@ -334,7 +334,7 @@ void menu_advanced_settings();
EDIT_ITEM(int3, MSG_NOZZLE, &ui.preheat_hotend_temp[material], MINTEMP_ALL, MAXTEMP_ALL - 15); EDIT_ITEM(int3, MSG_NOZZLE, &ui.preheat_hotend_temp[material], MINTEMP_ALL, MAXTEMP_ALL - 15);
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
EDIT_ITEM(int3, MSG_BED, &ui.preheat_bed_temp[material], BED_MINTEMP, BED_MAXTEMP - 10); EDIT_ITEM(int3, MSG_BED, &ui.preheat_bed_temp[material], BED_MINTEMP, BED_MAX_TARGET);
#endif #endif
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
ACTION_ITEM(MSG_STORE_EEPROM, lcd_store_settings); ACTION_ITEM(MSG_STORE_EEPROM, lcd_store_settings);

@ -47,47 +47,38 @@ uint8_t MarlinUI::preheat_fan_speed[2];
// "Temperature" submenu items // "Temperature" submenu items
// //
void Temperature::lcd_preheat(const int16_t e, const int8_t indh, const int8_t indb) { void Temperature::lcd_preheat(const int16_t e, const int8_t indh, const int8_t indb) {
#if HAS_HOTEND #if HAS_HOTEND
if (indh >= 0 && ui.preheat_hotend_temp[indh] > 0) if (indh >= 0 && ui.preheat_hotend_temp[indh] > 0)
setTargetHotend(_MIN(heater_maxtemp[e] - 15, ui.preheat_hotend_temp[indh]), e); setTargetHotend(_MIN(heater_maxtemp[e] - 15, ui.preheat_hotend_temp[indh]), e);
#else #else
UNUSED(e);
UNUSED(temph); UNUSED(temph);
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
if (indb >= 0 && ui.preheat_bed_temp[indb] >= 0) setTargetBed(ui.preheat_bed_temp[indb]); if (indb >= 0 && ui.preheat_bed_temp[indb] > 0) setTargetBed(ui.preheat_bed_temp[indb]);
#else #else
UNUSED(indb); UNUSED(indb);
#endif #endif
#if HAS_FAN #if HAS_FAN
set_fan_speed(( set_fan_speed((
#if FAN_COUNT > 1 #if FAN_COUNT > 1
active_extruder < FAN_COUNT ? active_extruder : 0 active_extruder < FAN_COUNT ? active_extruder :
#else
0
#endif #endif
), fan); 0), ui.preheat_fan_speed[m]
#else );
UNUSED(fan);
#endif #endif
ui.return_to_status(); ui.return_to_status();
} }
#if HAS_TEMP_HOTEND #if HAS_TEMP_HOTEND
inline void _preheat_end(const uint8_t m, const uint8_t e) { inline void _preheat_end(const uint8_t m, const uint8_t e) { thermalManager.lcd_preheat(e, m, -1); }
thermalManager.lcd_preheat(e, m, -1);
}
#if HAS_HEATED_BED #if HAS_HEATED_BED
inline void _preheat_both(const uint8_t m, const uint8_t e) { inline void _preheat_both(const uint8_t m, const uint8_t e) { thermalManager.lcd_preheat(e, m, m); }
thermalManager.lcd_preheat(e, m, m);
}
#endif #endif
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
inline void _preheat_bed(const uint8_t m) { inline void _preheat_bed(const uint8_t m) { thermalManager.lcd_preheat(-1, -1, m); }
thermalManager.lcd_preheat(-1, -1, m);
}
#endif #endif
#if HAS_TEMP_HOTEND || HAS_HEATED_BED #if HAS_TEMP_HOTEND || HAS_HEATED_BED
@ -186,7 +177,7 @@ void menu_temperature() {
// Bed: // Bed:
// //
#if HAS_HEATED_BED #if HAS_HEATED_BED
EDIT_ITEM_FAST(int3, MSG_BED, &thermalManager.temp_bed.target, 0, BED_MAXTEMP - 10, thermalManager.start_watching_bed); EDIT_ITEM_FAST(int3, MSG_BED, &thermalManager.temp_bed.target, 0, BED_MAX_TARGET, thermalManager.start_watching_bed);
#endif #endif
// //
@ -199,7 +190,7 @@ void menu_temperature() {
// //
// Fan Speed: // Fan Speed:
// //
#if FAN_COUNT > 0 #if HAS_FAN
auto on_fan_update = []{ auto on_fan_update = []{
thermalManager.set_fan_speed(MenuItemBase::itemIndex, editable.uint8); thermalManager.set_fan_speed(MenuItemBase::itemIndex, editable.uint8);
@ -266,7 +257,7 @@ void menu_temperature() {
singlenozzle_item(1); singlenozzle_item(1);
#endif #endif
#endif // FAN_COUNT > 0 #endif // HAS_FAN
#if HAS_TEMP_HOTEND #if HAS_TEMP_HOTEND

@ -132,13 +132,13 @@ void menu_tune() {
// Bed: // Bed:
// //
#if HAS_HEATED_BED #if HAS_HEATED_BED
EDIT_ITEM_FAST(int3, MSG_BED, &thermalManager.temp_bed.target, 0, BED_MAXTEMP - 10, thermalManager.start_watching_bed); EDIT_ITEM_FAST(int3, MSG_BED, &thermalManager.temp_bed.target, 0, BED_MAX_TARGET, thermalManager.start_watching_bed);
#endif #endif
// //
// Fan Speed: // Fan Speed:
// //
#if FAN_COUNT > 0 #if HAS_FAN
auto on_fan_update = []{ auto on_fan_update = []{
thermalManager.set_fan_speed(MenuItemBase::itemIndex, editable.uint8); thermalManager.set_fan_speed(MenuItemBase::itemIndex, editable.uint8);
@ -205,7 +205,7 @@ void menu_tune() {
singlenozzle_item(1); singlenozzle_item(1);
#endif #endif
#endif // FAN_COUNT > 0 #endif // HAS_FAN
// //
// Flow: // Flow:

@ -128,9 +128,9 @@ void _lcd_ubl_build_custom_mesh() {
void _lcd_ubl_custom_mesh() { void _lcd_ubl_custom_mesh() {
START_MENU(); START_MENU();
BACK_ITEM(MSG_UBL_BUILD_MESH_MENU); BACK_ITEM(MSG_UBL_BUILD_MESH_MENU);
EDIT_ITEM(int3, MSG_UBL_HOTEND_TEMP_CUSTOM, &custom_hotend_temp, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP - 10)); EDIT_ITEM(int3, MSG_UBL_HOTEND_TEMP_CUSTOM, &custom_hotend_temp, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP - 15));
#if HAS_HEATED_BED #if HAS_HEATED_BED
EDIT_ITEM(int3, MSG_UBL_BED_TEMP_CUSTOM, &custom_bed_temp, BED_MINTEMP, (BED_MAXTEMP - 10)); EDIT_ITEM(int3, MSG_UBL_BED_TEMP_CUSTOM, &custom_bed_temp, BED_MINTEMP, BED_MAX_TARGET);
#endif #endif
ACTION_ITEM(MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_build_custom_mesh); ACTION_ITEM(MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_build_custom_mesh);
END_MENU(); END_MENU();

@ -1264,7 +1264,7 @@ void Planner::check_axes_activity() {
xyze_bool_t axis_active = { false }; xyze_bool_t axis_active = { false };
#endif #endif
#if FAN_COUNT > 0 #if HAS_FAN
uint8_t tail_fan_speed[FAN_COUNT]; uint8_t tail_fan_speed[FAN_COUNT];
#endif #endif
@ -1279,11 +1279,11 @@ void Planner::check_axes_activity() {
if (has_blocks_queued()) { if (has_blocks_queued()) {
#if FAN_COUNT > 0 || ENABLED(BARICUDA) #if HAS_FAN || ENABLED(BARICUDA)
block_t *block = &block_buffer[block_buffer_tail]; block_t *block = &block_buffer[block_buffer_tail];
#endif #endif
#if FAN_COUNT > 0 #if HAS_FAN
FANS_LOOP(i) FANS_LOOP(i)
tail_fan_speed[i] = thermalManager.scaledFanSpeed(i, block->fan_speed[i]); tail_fan_speed[i] = thermalManager.scaledFanSpeed(i, block->fan_speed[i]);
#endif #endif
@ -1304,7 +1304,7 @@ void Planner::check_axes_activity() {
TERN_(HAS_CUTTER, cutter.refresh()); TERN_(HAS_CUTTER, cutter.refresh());
#if FAN_COUNT > 0 #if HAS_FAN
FANS_LOOP(i) FANS_LOOP(i)
tail_fan_speed[i] = thermalManager.scaledFanSpeed(i); tail_fan_speed[i] = thermalManager.scaledFanSpeed(i);
#endif #endif
@ -1326,7 +1326,7 @@ void Planner::check_axes_activity() {
// //
// Update Fan speeds // Update Fan speeds
// //
#if FAN_COUNT > 0 #if HAS_FAN
#if FAN_KICKSTART_TIME > 0 #if FAN_KICKSTART_TIME > 0
static millis_t fan_kick_end[FAN_COUNT] = { 0 }; static millis_t fan_kick_end[FAN_COUNT] = { 0 };
@ -1366,7 +1366,7 @@ void Planner::check_axes_activity() {
TERN_(HAS_FAN5, FAN_SET(5)); TERN_(HAS_FAN5, FAN_SET(5));
TERN_(HAS_FAN6, FAN_SET(6)); TERN_(HAS_FAN6, FAN_SET(6));
TERN_(HAS_FAN7, FAN_SET(7)); TERN_(HAS_FAN7, FAN_SET(7));
#endif // FAN_COUNT > 0 #endif // HAS_FAN
TERN_(AUTOTEMP, getHighESpeed()); TERN_(AUTOTEMP, getHighESpeed());
@ -1906,7 +1906,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
TERN_(HAS_CUTTER, block->cutter_power = cutter.power); TERN_(HAS_CUTTER, block->cutter_power = cutter.power);
#if FAN_COUNT > 0 #if HAS_FAN
FANS_LOOP(i) block->fan_speed[i] = thermalManager.fan_speed[i]; FANS_LOOP(i) block->fan_speed[i] = thermalManager.fan_speed[i];
#endif #endif

@ -175,7 +175,7 @@ typedef struct block_t {
cutter_power_t cutter_power; // Power level for Spindle, Laser, etc. cutter_power_t cutter_power; // Power level for Spindle, Laser, etc.
#endif #endif
#if FAN_COUNT > 0 #if HAS_FAN
uint8_t fan_speed[FAN_COUNT]; uint8_t fan_speed[FAN_COUNT];
#endif #endif

@ -152,7 +152,7 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
uint8_t Temperature::chamberfan_speed; // = 0 uint8_t Temperature::chamberfan_speed; // = 0
#endif #endif
#if FAN_COUNT > 0 #if HAS_FAN
uint8_t Temperature::fan_speed[FAN_COUNT]; // = { 0 } uint8_t Temperature::fan_speed[FAN_COUNT]; // = { 0 }
@ -219,7 +219,7 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
#endif #endif
#endif // FAN_COUNT > 0 #endif // HAS_FAN
#if WATCH_HOTENDS #if WATCH_HOTENDS
hotend_watch_t Temperature::watch_hotend[HOTENDS]; // = { { 0 } } hotend_watch_t Temperature::watch_hotend[HOTENDS]; // = { { 0 } }
@ -400,7 +400,7 @@ volatile bool Temperature::raw_temps_ready = false;
TERN_(HAS_AUTO_FAN, next_auto_fan_check_ms = next_temp_ms + 2500UL); TERN_(HAS_AUTO_FAN, next_auto_fan_check_ms = next_temp_ms + 2500UL);
if (target > GHV(BED_MAXTEMP - 10, temp_range[heater].maxtemp - 15)) { if (target > GHV(BED_MAX_TARGET, temp_range[heater].maxtemp - 15)) {
SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH));
return; return;

@ -477,7 +477,7 @@ class Temperature {
static float analog_to_celsius_chamber(const int raw); static float analog_to_celsius_chamber(const int raw);
#endif #endif
#if FAN_COUNT > 0 #if HAS_FAN
static uint8_t fan_speed[FAN_COUNT]; static uint8_t fan_speed[FAN_COUNT];
#define FANS_LOOP(I) LOOP_L_N(I, FAN_COUNT) #define FANS_LOOP(I) LOOP_L_N(I, FAN_COUNT)
@ -517,10 +517,10 @@ class Temperature {
void set_fans_paused(const bool p); void set_fans_paused(const bool p);
#endif #endif
#endif // FAN_COUNT > 0 #endif // HAS_FAN
static inline void zero_fan_speeds() { static inline void zero_fan_speeds() {
#if FAN_COUNT > 0 #if HAS_FAN
FANS_LOOP(i) set_fan_speed(i, 0); FANS_LOOP(i) set_fan_speed(i, 0);
#endif #endif
} }
@ -634,7 +634,7 @@ class Temperature {
TERN_(AUTO_POWER_CONTROL, powerManager.power_on()); TERN_(AUTO_POWER_CONTROL, powerManager.power_on());
temp_bed.target = temp_bed.target =
#ifdef BED_MAXTEMP #ifdef BED_MAXTEMP
_MIN(celsius, BED_MAXTEMP - 10) _MIN(celsius, BED_MAX_TARGET)
#else #else
celsius celsius
#endif #endif

@ -49,7 +49,7 @@
#if ENABLED(SINGLENOZZLE) #if ENABLED(SINGLENOZZLE)
uint16_t singlenozzle_temp[EXTRUDERS]; uint16_t singlenozzle_temp[EXTRUDERS];
#if FAN_COUNT > 0 #if HAS_FAN
uint8_t singlenozzle_fan_speed[EXTRUDERS]; uint8_t singlenozzle_fan_speed[EXTRUDERS];
#endif #endif
#endif #endif
@ -819,7 +819,7 @@ void tool_change_prime() {
#endif #endif
// Cool down with fan // Cool down with fan
#if TOOLCHANGE_FS_FAN >= 0 && FAN_COUNT > 0 #if TOOLCHANGE_FS_FAN >= 0 && HAS_FAN
const int16_t fansp = thermalManager.fan_speed[TOOLCHANGE_FS_FAN]; const int16_t fansp = thermalManager.fan_speed[TOOLCHANGE_FS_FAN];
thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed; thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed;
safe_delay(toolchange_settings.fan_time * 1000); safe_delay(toolchange_settings.fan_time * 1000);
@ -1060,7 +1060,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
if (should_move) { if (should_move) {
#if ENABLED(SINGLENOZZLE) #if ENABLED(SINGLENOZZLE)
#if FAN_COUNT > 0 #if HAS_FAN
singlenozzle_fan_speed[old_tool] = thermalManager.fan_speed[0]; singlenozzle_fan_speed[old_tool] = thermalManager.fan_speed[0];
thermalManager.fan_speed[0] = singlenozzle_fan_speed[new_tool]; thermalManager.fan_speed[0] = singlenozzle_fan_speed[new_tool];
#endif #endif
@ -1098,7 +1098,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
#endif #endif
// Cool down with fan // Cool down with fan
#if TOOLCHANGE_FS_FAN >= 0 && FAN_COUNT > 0 #if TOOLCHANGE_FS_FAN >= 0 && HAS_FAN
const int16_t fansp = thermalManager.fan_speed[TOOLCHANGE_FS_FAN]; const int16_t fansp = thermalManager.fan_speed[TOOLCHANGE_FS_FAN];
thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed; thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed;
safe_delay(toolchange_settings.fan_time * 1000); safe_delay(toolchange_settings.fan_time * 1000);

@ -110,7 +110,7 @@
#if ENABLED(SINGLENOZZLE) #if ENABLED(SINGLENOZZLE)
extern uint16_t singlenozzle_temp[EXTRUDERS]; extern uint16_t singlenozzle_temp[EXTRUDERS];
#if FAN_COUNT > 0 #if HAS_FAN
extern uint8_t singlenozzle_fan_speed[EXTRUDERS]; extern uint8_t singlenozzle_fan_speed[EXTRUDERS];
#endif #endif
#endif #endif

Loading…
Cancel
Save