diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 4f4787855..35fd92e10 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1774,12 +1774,19 @@ #define HAS_TEMP_ADC_CHAMBER 1 #endif -#if HAS_HOTEND && ANY(HAS_TEMP_ADC_0, HEATER_0_USES_MAX6675, HEATER_0_DUMMY_THERMISTOR) +#define HAS_TEMP(N) ANY(HAS_TEMP_ADC_##N, HEATER_##N##_USES_MAX6675, HEATER_##N##_DUMMY_THERMISTOR) +#if HAS_HOTEND && HAS_TEMP(0) #define HAS_TEMP_HOTEND 1 #endif -#define HAS_TEMP_BED HAS_TEMP_ADC_BED -#define HAS_TEMP_PROBE HAS_TEMP_ADC_PROBE -#define HAS_TEMP_CHAMBER HAS_TEMP_ADC_CHAMBER +#if HAS_TEMP(BED) + #define HAS_TEMP_BED 1 +#endif +#if HAS_TEMP(PROBE) + #define HAS_TEMP_PROBE 1 +#endif +#if HAS_TEMP(CHAMBER) + #define HAS_TEMP_CHAMBER 1 +#endif #if ENABLED(JOYSTICK) #if PIN_EXISTS(JOY_X) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index d9ce6e151..d704ebc85 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1839,13 +1839,13 @@ void Temperature::init() { #if HAS_JOY_ADC_EN SET_INPUT_PULLUP(JOY_EN_PIN); #endif - #if HAS_HEATED_BED + #if HAS_TEMP_ADC_BED HAL_ANALOG_SELECT(TEMP_BED_PIN); #endif - #if HAS_TEMP_CHAMBER + #if HAS_TEMP_ADC_CHAMBER HAL_ANALOG_SELECT(TEMP_CHAMBER_PIN); #endif - #if HAS_TEMP_PROBE + #if HAS_TEMP_ADC_PROBE HAL_ANALOG_SELECT(TEMP_PROBE_PIN); #endif #if ENABLED(FILAMENT_WIDTH_SENSOR) @@ -2355,9 +2355,9 @@ void Temperature::update_raw_temperatures() { TERN_(HAS_TEMP_ADC_5, temp_hotend[5].update()); TERN_(HAS_TEMP_ADC_6, temp_hotend[6].update()); TERN_(HAS_TEMP_ADC_7, temp_hotend[7].update()); - TERN_(HAS_HEATED_BED, temp_bed.update()); - TERN_(HAS_TEMP_CHAMBER, temp_chamber.update()); - TERN_(HAS_TEMP_PROBE, temp_probe.update()); + TERN_(HAS_TEMP_ADC_BED, temp_bed.update()); + TERN_(HAS_TEMP_ADC_CHAMBER, temp_chamber.update()); + TERN_(HAS_TEMP_ADC_PROBE, temp_probe.update()); TERN_(HAS_JOY_ADC_X, joystick.x.update()); TERN_(HAS_JOY_ADC_Y, joystick.y.update()); @@ -2822,17 +2822,17 @@ void Temperature::tick() { case MeasureTemp_0: ACCUMULATE_ADC(temp_hotend[0]); break; #endif - #if HAS_HEATED_BED + #if HAS_TEMP_ADC_BED case PrepareTemp_BED: HAL_START_ADC(TEMP_BED_PIN); break; case MeasureTemp_BED: ACCUMULATE_ADC(temp_bed); break; #endif - #if HAS_TEMP_CHAMBER + #if HAS_TEMP_ADC_CHAMBER case PrepareTemp_CHAMBER: HAL_START_ADC(TEMP_CHAMBER_PIN); break; case MeasureTemp_CHAMBER: ACCUMULATE_ADC(temp_chamber); break; #endif - #if HAS_TEMP_PROBE + #if HAS_TEMP_ADC_PROBE case PrepareTemp_PROBE: HAL_START_ADC(TEMP_PROBE_PIN); break; case MeasureTemp_PROBE: ACCUMULATE_ADC(temp_probe); break; #endif diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index edaa1c538..33f38c303 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -89,13 +89,13 @@ enum ADCSensorState : char { #if HAS_TEMP_ADC_0 PrepareTemp_0, MeasureTemp_0, #endif - #if HAS_HEATED_BED + #if HAS_TEMP_ADC_BED PrepareTemp_BED, MeasureTemp_BED, #endif - #if HAS_TEMP_CHAMBER + #if HAS_TEMP_ADC_CHAMBER PrepareTemp_CHAMBER, MeasureTemp_CHAMBER, #endif - #if HAS_TEMP_PROBE + #if HAS_TEMP_ADC_PROBE PrepareTemp_PROBE, MeasureTemp_PROBE, #endif #if HAS_TEMP_ADC_1