diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 994bb2397..fbc3ae3f1 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -284,8 +284,10 @@ #define HEATER_0_USES_THERMISTOR #endif - #if TEMP_SENSOR_1 <= -2 - #error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_1" + #if TEMP_SENSOR_1 == -3 + #error "MAX31855 Thermocouples not supported for TEMP_SENSOR_1" + #elif TEMP_SENSOR_1 == -2 + #error "MAX6675 Thermocouples not supported for TEMP_SENSOR_1" #elif TEMP_SENSOR_1 == -1 #define HEATER_1_USES_AD595 #elif TEMP_SENSOR_1 == 0 @@ -296,8 +298,10 @@ #define HEATER_1_USES_THERMISTOR #endif - #if TEMP_SENSOR_2 <= -2 - #error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_2" + #if TEMP_SENSOR_2 == -3 + #error "MAX31855 Thermocouples not supported for TEMP_SENSOR_2" + #elif TEMP_SENSOR_2 == -2 + #error "MAX6675 Thermocouples not supported for TEMP_SENSOR_2" #elif TEMP_SENSOR_2 == -1 #define HEATER_2_USES_AD595 #elif TEMP_SENSOR_2 == 0 @@ -308,8 +312,10 @@ #define HEATER_2_USES_THERMISTOR #endif - #if TEMP_SENSOR_3 <= -2 - #error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_3" + #if TEMP_SENSOR_3 == -3 + #error "MAX31855 Thermocouples not supported for TEMP_SENSOR_3" + #elif TEMP_SENSOR_3 == -2 + #error "MAX6675 Thermocouples not supported for TEMP_SENSOR_3" #elif TEMP_SENSOR_3 == -1 #define HEATER_3_USES_AD595 #elif TEMP_SENSOR_3 == 0 @@ -320,8 +326,10 @@ #define HEATER_3_USES_THERMISTOR #endif - #if TEMP_SENSOR_4 <= -2 - #error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_4" + #if TEMP_SENSOR_4 == -3 + #error "MAX31855 Thermocouples not supported for TEMP_SENSOR_4" + #elif TEMP_SENSOR_4 == -2 + #error "MAX6675 Thermocouples not supported for TEMP_SENSOR_4" #elif TEMP_SENSOR_4 == -1 #define HEATER_4_USES_AD595 #elif TEMP_SENSOR_4 == 0 @@ -332,8 +340,10 @@ #define HEATER_4_USES_THERMISTOR #endif - #if TEMP_SENSOR_BED <= -2 - #error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_BED" + #if TEMP_SENSOR_BED == -3 + #error "MAX31855 Thermocouples not supported for TEMP_SENSOR_BED" + #elif TEMP_SENSOR_BED == -2 + #error "MAX6675 Thermocouples not supported for TEMP_SENSOR_BED" #elif TEMP_SENSOR_BED == -1 #define BED_USES_AD595 #elif TEMP_SENSOR_BED == 0 @@ -344,8 +354,10 @@ #define BED_USES_THERMISTOR #endif - #if TEMP_SENSOR_CHAMBER <= -2 - #error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_CHAMBER" + #if TEMP_SENSOR_CHAMBER == -3 + #error "MAX31855 Thermocouples not supported for TEMP_SENSOR_CHAMBER" + #elif TEMP_SENSOR_CHAMBER == -2 + #error "MAX6675 Thermocouples not supported for TEMP_SENSOR_CHAMBER" #elif TEMP_SENSOR_CHAMBER == -1 #define CHAMBER_USES_AD595 #elif TEMP_SENSOR_CHAMBER > 0 @@ -662,12 +674,13 @@ #endif // Endstops and bed probe - #define HAS_X_MIN (PIN_EXISTS(X_MIN) && !IS_X2_ENDSTOP(X,MIN) && !IS_Y2_ENDSTOP(X,MIN) && !IS_Z2_OR_PROBE(X,MIN)) - #define HAS_X_MAX (PIN_EXISTS(X_MAX) && !IS_X2_ENDSTOP(X,MAX) && !IS_Y2_ENDSTOP(X,MAX) && !IS_Z2_OR_PROBE(X,MAX)) - #define HAS_Y_MIN (PIN_EXISTS(Y_MIN) && !IS_X2_ENDSTOP(Y,MIN) && !IS_Y2_ENDSTOP(Y,MIN) && !IS_Z2_OR_PROBE(Y,MIN)) - #define HAS_Y_MAX (PIN_EXISTS(Y_MAX) && !IS_X2_ENDSTOP(Y,MAX) && !IS_Y2_ENDSTOP(Y,MAX) && !IS_Z2_OR_PROBE(Y,MAX)) - #define HAS_Z_MIN (PIN_EXISTS(Z_MIN) && !IS_X2_ENDSTOP(Z,MIN) && !IS_Y2_ENDSTOP(Z,MIN) && !IS_Z2_OR_PROBE(Z,MIN)) - #define HAS_Z_MAX (PIN_EXISTS(Z_MAX) && !IS_X2_ENDSTOP(Z,MAX) && !IS_Y2_ENDSTOP(Z,MAX) && !IS_Z2_OR_PROBE(Z,MAX)) + #define HAS_STOP_TEST(A,M) (PIN_EXISTS(A##_##M) && !IS_X2_ENDSTOP(A,M) && !IS_Y2_ENDSTOP(A,M) && !IS_Z2_OR_PROBE(A,M)) + #define HAS_X_MIN HAS_STOP_TEST(X,MIN) + #define HAS_X_MAX HAS_STOP_TEST(X,MAX) + #define HAS_Y_MIN HAS_STOP_TEST(Y,MIN) + #define HAS_Y_MAX HAS_STOP_TEST(Y,MAX) + #define HAS_Z_MIN HAS_STOP_TEST(Z,MIN) + #define HAS_Z_MAX HAS_STOP_TEST(Z,MAX) #define HAS_X2_MIN (PIN_EXISTS(X2_MIN)) #define HAS_X2_MAX (PIN_EXISTS(X2_MAX)) #define HAS_Y2_MIN (PIN_EXISTS(Y2_MIN)) @@ -676,15 +689,19 @@ #define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX)) #define HAS_Z_MIN_PROBE_PIN (PIN_EXISTS(Z_MIN_PROBE)) - // Thermistors - #define HAS_TEMP_0 (PIN_EXISTS(TEMP_0) && TEMP_SENSOR_0 != 0 && TEMP_SENSOR_0 > -2) - #define HAS_TEMP_1 (PIN_EXISTS(TEMP_1) && TEMP_SENSOR_1 != 0 && TEMP_SENSOR_1 > -2) - #define HAS_TEMP_2 (PIN_EXISTS(TEMP_2) && TEMP_SENSOR_2 != 0 && TEMP_SENSOR_2 > -2) - #define HAS_TEMP_3 (PIN_EXISTS(TEMP_3) && TEMP_SENSOR_3 != 0 && TEMP_SENSOR_3 > -2) - #define HAS_TEMP_4 (PIN_EXISTS(TEMP_4) && TEMP_SENSOR_4 != 0 && TEMP_SENSOR_4 > -2) - #define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675)) - #define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0 && TEMP_SENSOR_BED > -2) - #define HAS_TEMP_CHAMBER (PIN_EXISTS(TEMP_CHAMBER) && TEMP_SENSOR_CHAMBER != 0 && TEMP_SENSOR_CHAMBER > -2) + // ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface) + #define HAS_ADC_TEST(P) (PIN_EXISTS(TEMP_##P) && TEMP_SENSOR_##P != 0 && TEMP_SENSOR_##P > -2) + #define HAS_TEMP_ADC_0 (HAS_ADC_TEST(0) && DISABLED(HEATER_0_USES_MAX6675)) + #define HAS_TEMP_ADC_1 HAS_ADC_TEST(1) + #define HAS_TEMP_ADC_2 HAS_ADC_TEST(2) + #define HAS_TEMP_ADC_3 HAS_ADC_TEST(3) + #define HAS_TEMP_ADC_4 HAS_ADC_TEST(4) + #define HAS_TEMP_ADC_BED HAS_ADC_TEST(BED) + #define HAS_TEMP_ADC_CHAMBER HAS_ADC_TEST(CHAMBER) + + #define HAS_TEMP_HOTEND (HAS_TEMP_ADC_0 || ENABLED(HEATER_0_USES_MAX6675)) + #define HAS_TEMP_BED HAS_TEMP_ADC_BED + #define HAS_TEMP_CHAMBER HAS_TEMP_ADC_CHAMBER // Heaters #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0)) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 6aa385266..cc30e9514 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -933,27 +933,25 @@ float Temperature::analog2temp(const int raw, const uint8_t e) { if (e == 0) return 0.25 * raw; #endif + // Thermistor with conversion table? if (heater_ttbl_map[e] != NULL) { float celsius = 0; uint8_t i; short(*tt)[][2] = (short(*)[][2])(heater_ttbl_map[e]); - - for (i = 1; i < heater_ttbllen_map[e]; i++) { - if (PGM_RD_W((*tt)[i][0]) > raw) { - celsius = PGM_RD_W((*tt)[i - 1][1]) + - (raw - PGM_RD_W((*tt)[i - 1][0])) * - (float)(PGM_RD_W((*tt)[i][1]) - PGM_RD_W((*tt)[i - 1][1])) / - (float)(PGM_RD_W((*tt)[i][0]) - PGM_RD_W((*tt)[i - 1][0])); - break; + for (uint8_t i = 1; i < heater_ttbllen_map[e]; i++) { + const short entry10 = PGM_RD_W((*tt)[i][0]); + if (entry10 > raw) { + const short entry00 = PGM_RD_W((*tt)[i - 1][0]), + entry01 = PGM_RD_W((*tt)[i - 1][1]), + entry11 = PGM_RD_W((*tt)[i][1]); + return entry01 + (raw - entry00) * float(entry11 - entry01) / float(entry10 - entry00); } } - - // Overflow: Set to last value in the table - if (i == heater_ttbllen_map[e]) celsius = PGM_RD_W((*tt)[i - 1][1]); - - return celsius; + return PGM_RD_W((*tt)[heater_ttbllen_map[e] - 1][1]); // Overflow: Return last value in the table } - return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN)) + TEMP_SENSOR_AD595_OFFSET; + + // Thermocouple with amplifier ADC interface + return raw * 5.0 * 100.0 / 1024.0 / (OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET; } #if HAS_HEATED_BED @@ -961,32 +959,23 @@ float Temperature::analog2temp(const int raw, const uint8_t e) { // For bed temperature measurement. float Temperature::analog2tempBed(const int raw) { #if ENABLED(BED_USES_THERMISTOR) - float celsius = 0; - byte i; - for (i = 1; i < BEDTEMPTABLE_LEN; i++) { - if (PGM_RD_W(BEDTEMPTABLE[i][0]) > raw) { - celsius = PGM_RD_W(BEDTEMPTABLE[i - 1][1]) + - (raw - PGM_RD_W(BEDTEMPTABLE[i - 1][0])) * - (float)(PGM_RD_W(BEDTEMPTABLE[i][1]) - PGM_RD_W(BEDTEMPTABLE[i - 1][1])) / - (float)(PGM_RD_W(BEDTEMPTABLE[i][0]) - PGM_RD_W(BEDTEMPTABLE[i - 1][0])); - break; + // Thermistor with conversion table + for (uint8_t i = 1; i < BEDTEMPTABLE_LEN; i++) { + const short entry10 = PGM_RD_W(BEDTEMPTABLE[i][0]); + if (entry10 > raw) { + const short entry00 = PGM_RD_W(BEDTEMPTABLE[i - 1][0]), + entry01 = PGM_RD_W(BEDTEMPTABLE[i - 1][1]), + entry11 = PGM_RD_W(BEDTEMPTABLE[i][1]); + return entry01 + (raw - entry00) * float(entry11 - entry01) / float(entry10 - entry00); } } - - // Overflow: Set to last value in the table - if (i == BEDTEMPTABLE_LEN) celsius = PGM_RD_W(BEDTEMPTABLE[i - 1][1]); - - return celsius; - - #elif defined(BED_USES_AD595) - - return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN)) + TEMP_SENSOR_AD595_OFFSET; + return PGM_RD_W(BEDTEMPTABLE[BEDTEMPTABLE_LEN - 1][1]); // Overflow: Return last value in the table #else - UNUSED(raw); - return 0; + // Thermocouple with amplifier ADC interface + return raw * 5.0 * 100.0 / 1024.0 / (OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET; #endif } @@ -997,32 +986,23 @@ float Temperature::analog2temp(const int raw, const uint8_t e) { // For chamber temperature measurement. float Temperature::analog2tempChamber(const int raw) { #if ENABLED(CHAMBER_USES_THERMISTOR) - float celsius = 0; - byte i; - for (i = 1; i < CHAMBERTEMPTABLE_LEN; i++) { - if (PGM_RD_W(CHAMBERTEMPTABLE[i][0]) > raw) { - celsius = PGM_RD_W(CHAMBERTEMPTABLE[i - 1][1]) + - (raw - PGM_RD_W(CHAMBERTEMPTABLE[i - 1][0])) * - (float)(PGM_RD_W(CHAMBERTEMPTABLE[i][1]) - PGM_RD_W(CHAMBERTEMPTABLE[i - 1][1])) / - (float)(PGM_RD_W(CHAMBERTEMPTABLE[i][0]) - PGM_RD_W(CHAMBERTEMPTABLE[i - 1][0])); - break; + // Thermistor with conversion table + for (uint8_t i = 1; i < CHAMBERTEMPTABLE_LEN; i++) { + const short entry10 = PGM_RD_W(CHAMBERTEMPTABLE[i][0]); + if (entry10 > raw) { + const short entry00 = PGM_RD_W(CHAMBERTEMPTABLE[i - 1][0]), + entry01 = PGM_RD_W(CHAMBERTEMPTABLE[i - 1][1]), + entry11 = PGM_RD_W(CHAMBERTEMPTABLE[i][1]); + return entry01 + (raw - entry00) * float(entry11 - entry01) / float(entry10 - entry00); } } - - // Overflow: Set to last value in the table - if (i == CHAMBERTEMPTABLE_LEN) celsius = PGM_RD_W(CHAMBERTEMPTABLE[i - 1][1]); - - return celsius; - - #elif defined(CHAMBER_USES_AD595) - - return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN)) + TEMP_SENSOR_AD595_OFFSET; + return PGM_RD_W(CHAMBERTEMPTABLE[CHAMBERTEMPTABLE_LEN - 1][1]); // Overflow: Return last value in the table #else - UNUSED(raw); - return 0; + // Thermocouple with amplifier ADC interface + return raw * 5.0 * 100.0 / 1024.0 / (OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET; #endif } @@ -1181,19 +1161,19 @@ void Temperature::init() { #ifdef DIDR2 DIDR2 = 0; #endif - #if HAS_TEMP_0 + #if HAS_TEMP_ADC_0 ANALOG_SELECT(TEMP_0_PIN); #endif - #if HAS_TEMP_1 + #if HAS_TEMP_ADC_1 ANALOG_SELECT(TEMP_1_PIN); #endif - #if HAS_TEMP_2 + #if HAS_TEMP_ADC_2 ANALOG_SELECT(TEMP_2_PIN); #endif - #if HAS_TEMP_3 + #if HAS_TEMP_ADC_3 ANALOG_SELECT(TEMP_3_PIN); #endif - #if HAS_TEMP_4 + #if HAS_TEMP_ADC_4 ANALOG_SELECT(TEMP_4_PIN); #endif #if HAS_HEATED_BED @@ -1659,20 +1639,20 @@ void Temperature::disable_all_heaters() { * Get raw temperatures */ void Temperature::set_current_temp_raw() { - #if HAS_TEMP_0 && DISABLED(HEATER_0_USES_MAX6675) + #if HAS_TEMP_ADC_0 && DISABLED(HEATER_0_USES_MAX6675) current_temperature_raw[0] = raw_temp_value[0]; #endif - #if HAS_TEMP_1 + #if HAS_TEMP_ADC_1 #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) redundant_temperature_raw = raw_temp_value[1]; #else current_temperature_raw[1] = raw_temp_value[1]; #endif - #if HAS_TEMP_2 + #if HAS_TEMP_ADC_2 current_temperature_raw[2] = raw_temp_value[2]; - #if HAS_TEMP_3 + #if HAS_TEMP_ADC_3 current_temperature_raw[3] = raw_temp_value[3]; - #if HAS_TEMP_4 + #if HAS_TEMP_ADC_4 current_temperature_raw[4] = raw_temp_value[4]; #endif #endif @@ -2120,7 +2100,7 @@ void Temperature::isr() { adc_sensor_state = (ADCSensorState)0; // Fall-through to start first sensor now } - #if HAS_TEMP_0 + #if HAS_TEMP_ADC_0 case PrepareTemp_0: START_ADC(TEMP_0_PIN); break; @@ -2147,7 +2127,7 @@ void Temperature::isr() { break; #endif - #if HAS_TEMP_1 + #if HAS_TEMP_ADC_1 case PrepareTemp_1: START_ADC(TEMP_1_PIN); break; @@ -2156,7 +2136,7 @@ void Temperature::isr() { break; #endif - #if HAS_TEMP_2 + #if HAS_TEMP_ADC_2 case PrepareTemp_2: START_ADC(TEMP_2_PIN); break; @@ -2165,7 +2145,7 @@ void Temperature::isr() { break; #endif - #if HAS_TEMP_3 + #if HAS_TEMP_ADC_3 case PrepareTemp_3: START_ADC(TEMP_3_PIN); break; @@ -2174,7 +2154,7 @@ void Temperature::isr() { break; #endif - #if HAS_TEMP_4 + #if HAS_TEMP_ADC_4 case PrepareTemp_4: START_ADC(TEMP_4_PIN); break; diff --git a/Marlin/temperature.h b/Marlin/temperature.h index 8d1754565..27358bac6 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -61,23 +61,23 @@ * States for ADC reading in the ISR */ enum ADCSensorState : char { - #if HAS_TEMP_0 + #if HAS_TEMP_ADC_0 PrepareTemp_0, MeasureTemp_0, #endif - #if HAS_TEMP_1 + #if HAS_TEMP_ADC_1 PrepareTemp_1, MeasureTemp_1, #endif - #if HAS_TEMP_2 + #if HAS_TEMP_ADC_2 PrepareTemp_2, MeasureTemp_2, #endif - #if HAS_TEMP_3 + #if HAS_TEMP_ADC_3 PrepareTemp_3, MeasureTemp_3, #endif - #if HAS_TEMP_4 + #if HAS_TEMP_ADC_4 PrepareTemp_4, MeasureTemp_4, #endif diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 9827b8bc9..91e4430ac 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1570,7 +1570,7 @@ void lcd_quick_feedback(const bool clear_buttons) { */ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb, const int16_t fan) { if (temph > 0) thermalManager.setTargetHotend(min(heater_maxtemp[endnum], temph), endnum); - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED if (tempb >= 0) thermalManager.setTargetBed(tempb); #else UNUSED(tempb); @@ -1587,10 +1587,10 @@ void lcd_quick_feedback(const bool clear_buttons) { lcd_return_to_status(); } - #if TEMP_SENSOR_0 != 0 + #if HAS_TEMP_HOTEND void lcd_preheat_m1_e0_only() { _lcd_preheat(0, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); } void lcd_preheat_m2_e0_only() { _lcd_preheat(0, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); } - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED void lcd_preheat_m1_e0() { _lcd_preheat(0, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } void lcd_preheat_m2_e0() { _lcd_preheat(0, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } #endif @@ -1599,28 +1599,28 @@ void lcd_quick_feedback(const bool clear_buttons) { #if HOTENDS > 1 void lcd_preheat_m1_e1_only() { _lcd_preheat(1, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); } void lcd_preheat_m2_e1_only() { _lcd_preheat(1, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); } - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED void lcd_preheat_m1_e1() { _lcd_preheat(1, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } void lcd_preheat_m2_e1() { _lcd_preheat(1, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } #endif #if HOTENDS > 2 void lcd_preheat_m1_e2_only() { _lcd_preheat(2, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); } void lcd_preheat_m2_e2_only() { _lcd_preheat(2, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); } - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED void lcd_preheat_m1_e2() { _lcd_preheat(2, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } void lcd_preheat_m2_e2() { _lcd_preheat(2, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } #endif #if HOTENDS > 3 void lcd_preheat_m1_e3_only() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); } void lcd_preheat_m2_e3_only() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); } - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED void lcd_preheat_m1_e3() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } void lcd_preheat_m2_e3() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } #endif #if HOTENDS > 4 void lcd_preheat_m1_e4_only() { _lcd_preheat(4, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); } void lcd_preheat_m2_e4_only() { _lcd_preheat(4, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); } - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED void lcd_preheat_m1_e4() { _lcd_preheat(4, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } void lcd_preheat_m2_e4() { _lcd_preheat(4, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } #endif @@ -1641,7 +1641,7 @@ void lcd_quick_feedback(const bool clear_buttons) { #endif // HOTENDS > 3 #endif // HOTENDS > 2 #endif // HOTENDS > 1 - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED lcd_preheat_m1_e0(); #else lcd_preheat_m1_e0_only(); @@ -1660,7 +1660,7 @@ void lcd_quick_feedback(const bool clear_buttons) { #endif // HOTENDS > 3 #endif // HOTENDS > 2 #endif // HOTENDS > 1 - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED lcd_preheat_m2_e0(); #else lcd_preheat_m2_e0_only(); @@ -1669,25 +1669,25 @@ void lcd_quick_feedback(const bool clear_buttons) { #endif // HOTENDS > 1 - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED void lcd_preheat_m1_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } void lcd_preheat_m2_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } #endif - #if TEMP_SENSOR_0 != 0 && (TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_4 != 0 || TEMP_SENSOR_BED != 0) + #if HAS_TEMP_HOTEND && (TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_4 != 0 || HAS_HEATED_BED) void lcd_preheat_m1_menu() { START_MENU(); MENU_BACK(MSG_PREPARE); #if HOTENDS == 1 - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0); MENU_ITEM(function, MSG_PREHEAT_1_END, lcd_preheat_m1_e0_only); #else MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0_only); #endif #else - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H1, lcd_preheat_m1_e0); MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E1, lcd_preheat_m1_e0_only); MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_m1_e1); @@ -1697,21 +1697,21 @@ void lcd_quick_feedback(const bool clear_buttons) { MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_m1_e1_only); #endif #if HOTENDS > 2 - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_m1_e2); MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E3, lcd_preheat_m1_e2_only); #else MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_m1_e2_only); #endif #if HOTENDS > 3 - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_m1_e3); MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E4, lcd_preheat_m1_e3_only); #else MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_m1_e3_only); #endif #if HOTENDS > 4 - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H5, lcd_preheat_m1_e4); MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E5, lcd_preheat_m1_e4_only); #else @@ -1722,7 +1722,7 @@ void lcd_quick_feedback(const bool clear_buttons) { #endif // HOTENDS > 2 MENU_ITEM(function, MSG_PREHEAT_1_ALL, lcd_preheat_m1_all); #endif // HOTENDS > 1 - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED MENU_ITEM(function, MSG_PREHEAT_1_BEDONLY, lcd_preheat_m1_bedonly); #endif END_MENU(); @@ -1732,14 +1732,14 @@ void lcd_quick_feedback(const bool clear_buttons) { START_MENU(); MENU_BACK(MSG_PREPARE); #if HOTENDS == 1 - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0); MENU_ITEM(function, MSG_PREHEAT_2_END, lcd_preheat_m2_e0_only); #else MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0_only); #endif #else - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H1, lcd_preheat_m2_e0); MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E1, lcd_preheat_m2_e0_only); MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_m2_e1); @@ -1749,21 +1749,21 @@ void lcd_quick_feedback(const bool clear_buttons) { MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_m2_e1_only); #endif #if HOTENDS > 2 - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_m2_e2); MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E3, lcd_preheat_m2_e2_only); #else MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_m2_e2_only); #endif #if HOTENDS > 3 - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_m2_e3); MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E4, lcd_preheat_m2_e3_only); #else MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_m2_e3_only); #endif #if HOTENDS > 4 - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H5, lcd_preheat_m2_e4); MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E5, lcd_preheat_m2_e4_only); #else @@ -1774,7 +1774,7 @@ void lcd_quick_feedback(const bool clear_buttons) { #endif // HOTENDS > 2 MENU_ITEM(function, MSG_PREHEAT_2_ALL, lcd_preheat_m2_all); #endif // HOTENDS > 1 - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED MENU_ITEM(function, MSG_PREHEAT_2_BEDONLY, lcd_preheat_m2_bedonly); #endif END_MENU(); @@ -2770,7 +2770,7 @@ void lcd_quick_feedback(const bool clear_buttons) { } #endif // ADVANCED_PAUSE_FEATURE - #if TEMP_SENSOR_0 != 0 + #if HAS_TEMP_HOTEND // // Cooldown @@ -2785,7 +2785,7 @@ void lcd_quick_feedback(const bool clear_buttons) { // // Preheat for Material 1 and 2 // - #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_4 != 0 || TEMP_SENSOR_BED != 0 + #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_4 != 0 || HAS_HEATED_BED MENU_ITEM(submenu, MSG_PREHEAT_1, lcd_preheat_m1_menu); MENU_ITEM(submenu, MSG_PREHEAT_2, lcd_preheat_m2_menu); #else @@ -2793,7 +2793,7 @@ void lcd_quick_feedback(const bool clear_buttons) { MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0_only); #endif - #endif // TEMP_SENSOR_0 != 0 + #endif // HAS_TEMP_HOTEND // // BLTouch Self-Test and Reset @@ -3528,7 +3528,7 @@ void lcd_quick_feedback(const bool clear_buttons) { // // Autotemp, Min, Max, Fact // - #if ENABLED(AUTOTEMP) && (TEMP_SENSOR_0 != 0) + #if ENABLED(AUTOTEMP) && (HAS_TEMP_HOTEND) MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &planner.autotemp_enabled); MENU_ITEM_EDIT(float3, MSG_MIN, &planner.autotemp_min, 0, HEATER_0_MAXTEMP - 15); MENU_ITEM_EDIT(float3, MSG_MAX, &planner.autotemp_max, 0, HEATER_0_MAXTEMP - 15); @@ -3623,10 +3623,10 @@ void lcd_quick_feedback(const bool clear_buttons) { START_MENU(); MENU_BACK(MSG_TEMPERATURE); MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &lcd_preheat_fan_speed[material], 0, 255); - #if TEMP_SENSOR_0 != 0 + #if HAS_TEMP_HOTEND MENU_ITEM_EDIT(int3, MSG_NOZZLE, &lcd_preheat_hotend_temp[material], MINTEMP_ALL, MAXTEMP_ALL - 15); #endif - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED MENU_ITEM_EDIT(int3, MSG_BED, &lcd_preheat_bed_temp[material], BED_MINTEMP, BED_MAXTEMP - 15); #endif #if ENABLED(EEPROM_SETTINGS) @@ -4144,7 +4144,7 @@ void lcd_quick_feedback(const bool clear_buttons) { STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_4_MAXTEMP), false); #endif - #if TEMP_SENSOR_BED != 0 + #if HAS_HEATED_BED #undef THERMISTOR_ID #define THERMISTOR_ID TEMP_SENSOR_BED #include "thermistornames.h"