From 70f03ad852ae0453afdd532e96775aecf51c6319 Mon Sep 17 00:00:00 2001 From: zerkix <97692157+zerkix@users.noreply.github.com> Date: Mon, 17 Jan 2022 07:05:31 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Finish=20and=20organize=20temp?= =?UTF-8?q?=20sensors=20(#23519)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/HAL/ESP32/HAL.cpp | 2 + Marlin/src/HAL/SAMD51/HAL.cpp | 42 ++-- Marlin/src/HAL/STM32F1/HAL.cpp | 233 +++++------------- Marlin/src/core/macros.h | 2 + Marlin/src/inc/Conditionals_adv.h | 6 +- Marlin/src/inc/Conditionals_post.h | 14 +- .../lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp | 12 +- Marlin/src/module/temperature.cpp | 8 +- Marlin/src/module/temperature.h | 22 +- Marlin/src/module/thermistor/thermistors.h | 16 +- Marlin/src/pins/pinsDebug_list.h | 16 +- 11 files changed, 144 insertions(+), 229 deletions(-) diff --git a/Marlin/src/HAL/ESP32/HAL.cpp b/Marlin/src/HAL/ESP32/HAL.cpp index 810e386894..499582b8c1 100644 --- a/Marlin/src/HAL/ESP32/HAL.cpp +++ b/Marlin/src/HAL/ESP32/HAL.cpp @@ -211,7 +211,9 @@ void HAL_adc_init() { TERN_(HAS_TEMP_ADC_7, adc3_set_attenuation(get_channel(TEMP_7_PIN), ADC_ATTEN_11db)); TERN_(HAS_HEATED_BED, adc1_set_attenuation(get_channel(TEMP_BED_PIN), ADC_ATTEN_11db)); TERN_(HAS_TEMP_CHAMBER, adc1_set_attenuation(get_channel(TEMP_CHAMBER_PIN), ADC_ATTEN_11db)); + TERN_(HAS_TEMP_PROBE, adc1_set_attenuation(get_channel(TEMP_PROBE_PIN), ADC_ATTEN_11db)); TERN_(HAS_TEMP_COOLER, adc1_set_attenuation(get_channel(TEMP_COOLER_PIN), ADC_ATTEN_11db)); + TERN_(HAS_TEMP_BOARD, adc1_set_attenuation(get_channel(TEMP_BOARD_PIN), ADC_ATTEN_11db)); TERN_(FILAMENT_WIDTH_SENSOR, adc1_set_attenuation(get_channel(FILWIDTH_PIN), ADC_ATTEN_11db)); // Note that adc2 is shared with the WiFi module, which has higher priority, so the conversion may fail. diff --git a/Marlin/src/HAL/SAMD51/HAL.cpp b/Marlin/src/HAL/SAMD51/HAL.cpp index 8baad31bc7..a5febad83b 100644 --- a/Marlin/src/HAL/SAMD51/HAL.cpp +++ b/Marlin/src/HAL/SAMD51/HAL.cpp @@ -54,20 +54,22 @@ #define GET_TEMP_5_ADC() TERN(HAS_TEMP_ADC_5, PIN_TO_ADC(TEMP_5_PIN), -1) #define GET_TEMP_6_ADC() TERN(HAS_TEMP_ADC_6, PIN_TO_ADC(TEMP_6_PIN), -1) #define GET_TEMP_7_ADC() TERN(HAS_TEMP_ADC_7, PIN_TO_ADC(TEMP_7_PIN), -1) -#define GET_PROBE_ADC() TERN(HAS_TEMP_PROBE, PIN_TO_ADC(TEMP_PROBE_PIN), -1) #define GET_BED_ADC() TERN(HAS_TEMP_ADC_BED, PIN_TO_ADC(TEMP_BED_PIN), -1) #define GET_CHAMBER_ADC() TERN(HAS_TEMP_ADC_CHAMBER, PIN_TO_ADC(TEMP_CHAMBER_PIN), -1) +#define GET_PROBE_ADC() TERN(HAS_TEMP_ADC_PROBE, PIN_TO_ADC(TEMP_PROBE_PIN), -1) #define GET_COOLER_ADC() TERN(HAS_TEMP_ADC_COOLER, PIN_TO_ADC(TEMP_COOLER_PIN), -1) +#define GET_BOARD_ADC() TERN(HAS_TEMP_ADC_BOARD, PIN_TO_ADC(TEMP_BOARD_PIN), -1) #define GET_FILAMENT_WIDTH_ADC() TERN(FILAMENT_WIDTH_SENSOR, PIN_TO_ADC(FILWIDTH_PIN), -1) #define GET_BUTTONS_ADC() TERN(HAS_ADC_BUTTONS, PIN_TO_ADC(ADC_KEYPAD_PIN), -1) #define IS_ADC_REQUIRED(n) ( \ GET_TEMP_0_ADC() == n || GET_TEMP_1_ADC() == n || GET_TEMP_2_ADC() == n || GET_TEMP_3_ADC() == n \ || GET_TEMP_4_ADC() == n || GET_TEMP_5_ADC() == n || GET_TEMP_6_ADC() == n || GET_TEMP_7_ADC() == n \ - || GET_PROBE_ADC() == n \ || GET_BED_ADC() == n \ || GET_CHAMBER_ADC() == n \ + || GET_PROBE_ADC() == n \ || GET_COOLER_ADC() == n \ + || GET_BOARD_ADC() == n \ || GET_FILAMENT_WIDTH_ADC() == n \ || GET_BUTTONS_ADC() == n \ ) @@ -137,18 +139,21 @@ uint16_t HAL_adc_result; #if GET_TEMP_7_ADC() == 0 TEMP_7_PIN, #endif - #if GET_PROBE_ADC() == 0 - TEMP_PROBE_PIN, - #endif #if GET_BED_ADC() == 0 TEMP_BED_PIN, #endif #if GET_CHAMBER_ADC() == 0 TEMP_CHAMBER_PIN, #endif + #if GET_PROBE_ADC() == 0 + TEMP_PROBE_PIN, + #endif #if GET_COOLER_ADC() == 0 TEMP_COOLER_PIN, #endif + #if GET_BOARD_ADC() == 0 + TEMP_BOARD_PIN, + #endif #if GET_FILAMENT_WIDTH_ADC() == 0 FILWIDTH_PIN, #endif @@ -180,18 +185,21 @@ uint16_t HAL_adc_result; #if GET_TEMP_7_ADC() == 1 TEMP_7_PIN, #endif - #if GET_PROBE_ADC() == 1 - TEMP_PROBE_PIN, - #endif #if GET_BED_ADC() == 1 TEMP_BED_PIN, #endif #if GET_CHAMBER_ADC() == 1 TEMP_CHAMBER_PIN, #endif + #if GET_PROBE_ADC() == 1 + TEMP_PROBE_PIN, + #endif #if GET_COOLER_ADC() == 1 TEMP_COOLER_PIN, #endif + #if GET_BOARD_ADC() == 1 + TEMP_BOARD_PIN, + #endif #if GET_FILAMENT_WIDTH_ADC() == 1 FILWIDTH_PIN, #endif @@ -231,18 +239,21 @@ uint16_t HAL_adc_result; #if GET_TEMP_7_ADC() == 0 { PIN_TO_INPUTCTRL(TEMP_7_PIN) }, #endif - #if GET_PROBE_ADC() == 0 - { PIN_TO_INPUTCTRL(TEMP_PROBE_PIN) }, - #endif #if GET_BED_ADC() == 0 { PIN_TO_INPUTCTRL(TEMP_BED_PIN) }, #endif #if GET_CHAMBER_ADC() == 0 { PIN_TO_INPUTCTRL(TEMP_CHAMBER_PIN) }, #endif + #if GET_PROBE_ADC() == 0 + { PIN_TO_INPUTCTRL(TEMP_PROBE_PIN) }, + #endif #if GET_COOLER_ADC() == 0 { PIN_TO_INPUTCTRL(TEMP_COOLER_PIN) }, #endif + #if GET_BOARD_ADC() == 0 + { PIN_TO_INPUTCTRL(TEMP_BOARD_PIN) }, + #endif #if GET_FILAMENT_WIDTH_ADC() == 0 { PIN_TO_INPUTCTRL(FILWIDTH_PIN) }, #endif @@ -283,18 +294,21 @@ uint16_t HAL_adc_result; #if GET_TEMP_7_ADC() == 1 { PIN_TO_INPUTCTRL(TEMP_7_PIN) }, #endif - #if GET_PROBE_ADC() == 1 - { PIN_TO_INPUTCTRL(TEMP_PROBE_PIN) }, - #endif #if GET_BED_ADC() == 1 { PIN_TO_INPUTCTRL(TEMP_BED_PIN) }, #endif #if GET_CHAMBER_ADC() == 1 { PIN_TO_INPUTCTRL(TEMP_CHAMBER_PIN) }, #endif + #if GET_PROBE_ADC() == 1 + { PIN_TO_INPUTCTRL(TEMP_PROBE_PIN) }, + #endif #if GET_COOLER_ADC() == 1 { PIN_TO_INPUTCTRL(TEMP_COOLER_PIN) }, #endif + #if GET_BOARD_ADC() == 1 + { PIN_TO_INPUTCTRL(TEMP_BOARD_PIN) }, + #endif #if GET_FILAMENT_WIDTH_ADC() == 1 { PIN_TO_INPUTCTRL(FILWIDTH_PIN) }, #endif diff --git a/Marlin/src/HAL/STM32F1/HAL.cpp b/Marlin/src/HAL/STM32F1/HAL.cpp index f29b305361..a0486da5b0 100644 --- a/Marlin/src/HAL/STM32F1/HAL.cpp +++ b/Marlin/src/HAL/STM32F1/HAL.cpp @@ -120,123 +120,49 @@ uint16_t HAL_adc_result; STM32ADC adc(ADC1); const uint8_t adc_pins[] = { - #if HAS_TEMP_ADC_0 - TEMP_0_PIN, - #endif - #if HAS_TEMP_ADC_PROBE - TEMP_PROBE_PIN, - #endif - #if HAS_HEATED_BED - TEMP_BED_PIN, - #endif - #if HAS_TEMP_CHAMBER - TEMP_CHAMBER_PIN, - #endif - #if HAS_TEMP_COOLER - TEMP_COOLER_PIN, - #endif - #if HAS_TEMP_ADC_1 - TEMP_1_PIN, - #endif - #if HAS_TEMP_ADC_2 - TEMP_2_PIN, - #endif - #if HAS_TEMP_ADC_3 - TEMP_3_PIN, - #endif - #if HAS_TEMP_ADC_4 - TEMP_4_PIN, - #endif - #if HAS_TEMP_ADC_5 - TEMP_5_PIN, - #endif - #if HAS_TEMP_ADC_6 - TEMP_6_PIN, - #endif - #if HAS_TEMP_ADC_7 - TEMP_7_PIN, - #endif - #if ENABLED(FILAMENT_WIDTH_SENSOR) - FILWIDTH_PIN, - #endif - #if HAS_ADC_BUTTONS - ADC_KEYPAD_PIN, - #endif - #if HAS_JOY_ADC_X - JOY_X_PIN, - #endif - #if HAS_JOY_ADC_Y - JOY_Y_PIN, - #endif - #if HAS_JOY_ADC_Z - JOY_Z_PIN, - #endif - #if ENABLED(POWER_MONITOR_CURRENT) - POWER_MONITOR_CURRENT_PIN, - #endif - #if ENABLED(POWER_MONITOR_VOLTAGE) - POWER_MONITOR_VOLTAGE_PIN, - #endif + OPTITEM(HAS_TEMP_ADC_0, TEMP_0_PIN) + OPTITEM(HAS_TEMP_ADC_1, TEMP_1_PIN) + OPTITEM(HAS_TEMP_ADC_2, TEMP_2_PIN) + OPTITEM(HAS_TEMP_ADC_3, TEMP_3_PIN) + OPTITEM(HAS_TEMP_ADC_4, TEMP_4_PIN) + OPTITEM(HAS_TEMP_ADC_5, TEMP_5_PIN) + OPTITEM(HAS_TEMP_ADC_6, TEMP_6_PIN) + OPTITEM(HAS_TEMP_ADC_7, TEMP_7_PIN) + OPTITEM(HAS_HEATED_BED, TEMP_BED_PIN) + OPTITEM(HAS_TEMP_CHAMBER, TEMP_CHAMBER_PIN) + OPTITEM(HAS_TEMP_ADC_PROBE, TEMP_PROBE_PIN) + OPTITEM(HAS_TEMP_COOLER, TEMP_COOLER_PIN) + OPTITEM(HAS_TEMP_BOARD, TEMP_BOARD_PIN) + OPTITEM(FILAMENT_WIDTH_SENSOR, FILWIDTH_PIN) + OPTITEM(HAS_ADC_BUTTONS, ADC_KEYPAD_PIN) + OPTITEM(HAS_JOY_ADC_X, JOY_X_PIN) + OPTITEM(HAS_JOY_ADC_Y, JOY_Y_PIN) + OPTITEM(HAS_JOY_ADC_Z, JOY_Z_PIN) + OPTITEM(POWER_MONITOR_CURRENT, POWER_MONITOR_CURRENT_PIN) + OPTITEM(POWER_MONITOR_VOLTAGE, POWER_MONITOR_VOLTAGE_PIN) }; enum TempPinIndex : char { - #if HAS_TEMP_ADC_0 - TEMP_0, - #endif - #if HAS_TEMP_ADC_PROBE - TEMP_PROBE, - #endif - #if HAS_HEATED_BED - TEMP_BED, - #endif - #if HAS_TEMP_CHAMBER - TEMP_CHAMBER, - #endif - #if HAS_TEMP_COOLER - TEMP_COOLER_PIN, - #endif - #if HAS_TEMP_ADC_1 - TEMP_1, - #endif - #if HAS_TEMP_ADC_2 - TEMP_2, - #endif - #if HAS_TEMP_ADC_3 - TEMP_3, - #endif - #if HAS_TEMP_ADC_4 - TEMP_4, - #endif - #if HAS_TEMP_ADC_5 - TEMP_5, - #endif - #if HAS_TEMP_ADC_6 - TEMP_6, - #endif - #if HAS_TEMP_ADC_7 - TEMP_7, - #endif - #if ENABLED(FILAMENT_WIDTH_SENSOR) - FILWIDTH, - #endif - #if HAS_ADC_BUTTONS - ADC_KEY, - #endif - #if HAS_JOY_ADC_X - JOY_X, - #endif - #if HAS_JOY_ADC_Y - JOY_Y, - #endif - #if HAS_JOY_ADC_Z - JOY_Z, - #endif - #if ENABLED(POWER_MONITOR_CURRENT) - POWERMON_CURRENT, - #endif - #if ENABLED(POWER_MONITOR_VOLTAGE) - POWERMON_VOLTS, - #endif + OPTITEM(HAS_TEMP_ADC_0, TEMP_0) + OPTITEM(HAS_TEMP_ADC_1, TEMP_1) + OPTITEM(HAS_TEMP_ADC_2, TEMP_2) + OPTITEM(HAS_TEMP_ADC_3, TEMP_3) + OPTITEM(HAS_TEMP_ADC_4, TEMP_4) + OPTITEM(HAS_TEMP_ADC_5, TEMP_5) + OPTITEM(HAS_TEMP_ADC_6, TEMP_6) + OPTITEM(HAS_TEMP_ADC_7, TEMP_7) + OPTITEM(HAS_HEATED_BED, TEMP_BED) + OPTITEM(HAS_TEMP_CHAMBER, TEMP_CHAMBER) + OPTITEM(HAS_TEMP_ADC_PROBE, TEMP_PROBE) + OPTITEM(HAS_TEMP_COOLER, TEMP_COOLER) + OPTITEM(HAS_TEMP_BOARD, TEMP_BOARD) + OPTITEM(FILAMENT_WIDTH_SENSOR, FILWIDTH) + OPTITEM(HAS_ADC_BUTTONS, ADC_KEY) + OPTITEM(HAS_JOY_ADC_X, JOY_X) + OPTITEM(HAS_JOY_ADC_Y, JOY_Y) + OPTITEM(HAS_JOY_ADC_Z, JOY_Z) + OPTITEM(POWER_MONITOR_CURRENT, POWERMON_CURRENT) + OPTITEM(POWER_MONITOR_VOLTAGE, POWERMON_VOLTS) ADC_PIN_COUNT }; @@ -375,67 +301,32 @@ void HAL_adc_init() { } void HAL_adc_start_conversion(const uint8_t adc_pin) { + #define __TCASE(N,I) case N: pin_index = I; break; + #define _TCASE(C,N,I) TERN_(C, __TCASE(N, I)) //TEMP_PINS pin_index; TempPinIndex pin_index; switch (adc_pin) { default: return; - #if HAS_TEMP_ADC_0 - case TEMP_0_PIN: pin_index = TEMP_0; break; - #endif - #if HAS_TEMP_ADC_PROBE - case TEMP_PROBE_PIN: pin_index = TEMP_PROBE; break; - #endif - #if HAS_HEATED_BED - case TEMP_BED_PIN: pin_index = TEMP_BED; break; - #endif - #if HAS_TEMP_CHAMBER - case TEMP_CHAMBER_PIN: pin_index = TEMP_CHAMBER; break; - #endif - #if HAS_TEMP_COOLER - case TEMP_COOLER_PIN: pin_index = TEMP_COOLER; break; - #endif - #if HAS_TEMP_ADC_1 - case TEMP_1_PIN: pin_index = TEMP_1; break; - #endif - #if HAS_TEMP_ADC_2 - case TEMP_2_PIN: pin_index = TEMP_2; break; - #endif - #if HAS_TEMP_ADC_3 - case TEMP_3_PIN: pin_index = TEMP_3; break; - #endif - #if HAS_TEMP_ADC_4 - case TEMP_4_PIN: pin_index = TEMP_4; break; - #endif - #if HAS_TEMP_ADC_5 - case TEMP_5_PIN: pin_index = TEMP_5; break; - #endif - #if HAS_TEMP_ADC_6 - case TEMP_6_PIN: pin_index = TEMP_6; break; - #endif - #if HAS_TEMP_ADC_7 - case TEMP_7_PIN: pin_index = TEMP_7; break; - #endif - #if HAS_JOY_ADC_X - case JOY_X_PIN: pin_index = JOY_X; break; - #endif - #if HAS_JOY_ADC_Y - case JOY_Y_PIN: pin_index = JOY_Y; break; - #endif - #if HAS_JOY_ADC_Z - case JOY_Z_PIN: pin_index = JOY_Z; break; - #endif - #if ENABLED(FILAMENT_WIDTH_SENSOR) - case FILWIDTH_PIN: pin_index = FILWIDTH; break; - #endif - #if HAS_ADC_BUTTONS - case ADC_KEYPAD_PIN: pin_index = ADC_KEY; break; - #endif - #if ENABLED(POWER_MONITOR_CURRENT) - case POWER_MONITOR_CURRENT_PIN: pin_index = POWERMON_CURRENT; break; - #endif - #if ENABLED(POWER_MONITOR_VOLTAGE) - case POWER_MONITOR_VOLTAGE_PIN: pin_index = POWERMON_VOLTS; break; - #endif + _TCASE(HAS_TEMP_ADC_0, TEMP_0_PIN, TEMP_0) + _TCASE(HAS_TEMP_ADC_1, TEMP_1_PIN, TEMP_1) + _TCASE(HAS_TEMP_ADC_2, TEMP_2_PIN, TEMP_2) + _TCASE(HAS_TEMP_ADC_3, TEMP_3_PIN, TEMP_3) + _TCASE(HAS_TEMP_ADC_4, TEMP_4_PIN, TEMP_4) + _TCASE(HAS_TEMP_ADC_5, TEMP_5_PIN, TEMP_5) + _TCASE(HAS_TEMP_ADC_6, TEMP_6_PIN, TEMP_6) + _TCASE(HAS_TEMP_ADC_7, TEMP_7_PIN, TEMP_7) + _TCASE(HAS_HEATED_BED, TEMP_BED_PIN, TEMP_BED) + _TCASE(HAS_TEMP_CHAMBER, TEMP_CHAMBER_PIN, TEMP_CHAMBER) + _TCASE(HAS_TEMP_ADC_PROBE, TEMP_PROBE_PIN, TEMP_PROBE) + _TCASE(HAS_TEMP_COOLER, TEMP_COOLER_PIN, TEMP_COOLER) + _TCASE(HAS_TEMP_BOARD, TEMP_BOARD_PIN, TEMP_BOARD) + _TCASE(HAS_JOY_ADC_X, JOY_X_PIN, JOY_X) + _TCASE(HAS_JOY_ADC_Y, JOY_Y_PIN, JOY_Y) + _TCASE(HAS_JOY_ADC_Z, JOY_Z_PIN, JOY_Z) + _TCASE(FILAMENT_WIDTH_SENSOR, FILWIDTH_PIN, FILWIDTH) + _TCASE(HAS_ADC_BUTTONS, ADC_KEYPAD_PIN, ADC_KEY) + _TCASE(POWER_MONITOR_CURRENT, POWER_MONITOR_CURRENT_PIN, POWERMON_CURRENT) + _TCASE(POWER_MONITOR_VOLTAGE, POWER_MONITOR_VOLTAGE_PIN, POWERMON_VOLTS) } HAL_adc_result = HAL_adc_results[(int)pin_index] >> (12 - HAL_ADC_RESOLUTION); // shift out unused bits } diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index 34fc3bc410..31808586cf 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -235,6 +235,8 @@ #define __TERN(T,V...) ___TERN(_CAT(_NO,T),V) // Prepend '_NO' to get '_NOT_0' or '_NOT_1' #define ___TERN(P,V...) THIRD(P,V) // If first argument has a comma, A. Else B. +#define _OPTITEM(A...) A, +#define OPTITEM(O,A...) TERN_(O,DEFER4(_OPTITEM)(A)) #define _OPTARG(A...) , A #define OPTARG(O,A...) TERN_(O,DEFER4(_OPTARG)(A)) #define _OPTCODE(A) A; diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index f2a316d833..9c3fe6bfd3 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -118,9 +118,9 @@ // Temperature sensor IDs #define HID_REDUNDANT -6 -#define HID_COOLER -5 -#define HID_PROBE -4 -#define HID_BOARD -3 +#define HID_BOARD -5 +#define HID_COOLER -4 +#define HID_PROBE -3 #define HID_CHAMBER -2 #define HID_BED -1 #define HID_E0 0 diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 3a2a6f2711..5d3ac7a690 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -507,7 +507,13 @@ #ifndef TEMP_SENSOR_REDUNDANT_MAX_DIFF #define TEMP_SENSOR_REDUNDANT_MAX_DIFF 10 #endif - #if REDUNDANT_TEMP_MATCH(SOURCE, COOLER) + #if REDUNDANT_TEMP_MATCH(SOURCE, BOARD) + #if !PIN_EXISTS(TEMP_BOARD) + #error "TEMP_SENSOR_REDUNDANT_SOURCE set to BOARD requires TEMP_BOARD_PIN." + #else + #define TEMP_REDUNDANT_PIN TEMP_BOARD_PIN + #endif + #elif REDUNDANT_TEMP_MATCH(SOURCE, COOLER) #if !PIN_EXISTS(TEMP_COOLER) #error "TEMP_SENSOR_REDUNDANT_SOURCE set to COOLER requires TEMP_COOLER_PIN." #else @@ -2446,12 +2452,12 @@ #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 HAS_TEMP(PROBE) + #define HAS_TEMP_PROBE 1 +#endif #if HAS_TEMP(COOLER) #define HAS_TEMP_COOLER 1 #endif diff --git a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp index f3f361f84e..4c850183da 100644 --- a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp +++ b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp @@ -222,12 +222,12 @@ const uint16_t VPList_SDPrintTune[] PROGMEM = { }; const uint16_t VPList_StepPerMM[] PROGMEM = { - VP_X_STEP_PER_MM - , VP_Y_STEP_PER_MM - , VP_Z_STEP_PER_MM - OPTARG(HAS_HOTEND, VP_E0_STEP_PER_MM) - OPTARG(HAS_MULTI_HOTEND, VP_E1_STEP_PER_MM) - , 0x0000 + VP_X_STEP_PER_MM, + VP_Y_STEP_PER_MM, + VP_Z_STEP_PER_MM, + OPTITEM(HAS_HOTEND, VP_E0_STEP_PER_MM) + OPTITEM(HAS_MULTI_HOTEND, VP_E1_STEP_PER_MM) + 0x0000 }; const uint16_t VPList_PIDE0[] PROGMEM = { diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 07f72b570a..c9107a9b1c 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -2361,12 +2361,12 @@ void Temperature::init() { #if HAS_TEMP_ADC_CHAMBER HAL_ANALOG_SELECT(TEMP_CHAMBER_PIN); #endif - #if HAS_TEMP_ADC_COOLER - HAL_ANALOG_SELECT(TEMP_COOLER_PIN); - #endif #if HAS_TEMP_ADC_PROBE HAL_ANALOG_SELECT(TEMP_PROBE_PIN); #endif + #if HAS_TEMP_ADC_COOLER + HAL_ANALOG_SELECT(TEMP_COOLER_PIN); + #endif #if HAS_TEMP_ADC_BOARD HAL_ANALOG_SELECT(TEMP_BOARD_PIN); #endif @@ -2948,8 +2948,8 @@ void Temperature::update_raw_temperatures() { 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_TEMP_ADC_BOARD, temp_board.update()); TERN_(HAS_TEMP_ADC_COOLER, temp_cooler.update()); + TERN_(HAS_TEMP_ADC_BOARD, temp_board.update()); TERN_(HAS_JOY_ADC_X, joystick.x.update()); TERN_(HAS_JOY_ADC_Y, joystick.y.update()); diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 5affcf740d..ade1d480b2 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -231,9 +231,6 @@ struct PIDHeaterInfo : public HeaterInfo { typedef heater_info_t bed_info_t; #endif #endif -#if HAS_TEMP_PROBE - typedef temp_info_t probe_info_t; -#endif #if HAS_HEATED_CHAMBER #if ENABLED(PIDTEMPCHAMBER) typedef struct PIDHeaterInfo chamber_info_t; @@ -243,12 +240,15 @@ struct PIDHeaterInfo : public HeaterInfo { #elif HAS_TEMP_CHAMBER typedef temp_info_t chamber_info_t; #endif -#if HAS_TEMP_BOARD - typedef temp_info_t board_info_t; +#if HAS_TEMP_PROBE + typedef temp_info_t probe_info_t; #endif #if EITHER(HAS_COOLER, HAS_TEMP_COOLER) typedef heater_info_t cooler_info_t; #endif +#if HAS_TEMP_BOARD + typedef temp_info_t board_info_t; +#endif // Heater watch handling template @@ -318,12 +318,12 @@ typedef struct { int16_t raw_min, raw_max; celsius_t mintemp, maxtemp; } temp_ra #if TEMP_SENSOR_BED_IS_CUSTOM CTI_BED, #endif - #if TEMP_SENSOR_PROBE_IS_CUSTOM - CTI_PROBE, - #endif #if TEMP_SENSOR_CHAMBER_IS_CUSTOM CTI_CHAMBER, #endif + #if TEMP_SENSOR_PROBE_IS_CUSTOM + CTI_PROBE, + #endif #if TEMP_SENSOR_COOLER_IS_CUSTOM CTI_COOLER, #endif @@ -599,12 +599,12 @@ class Temperature { #if HAS_HEATED_BED static celsius_float_t analog_to_celsius_bed(const int16_t raw); #endif - #if HAS_TEMP_PROBE - static celsius_float_t analog_to_celsius_probe(const int16_t raw); - #endif #if HAS_TEMP_CHAMBER static celsius_float_t analog_to_celsius_chamber(const int16_t raw); #endif + #if HAS_TEMP_PROBE + static celsius_float_t analog_to_celsius_probe(const int16_t raw); + #endif #if HAS_TEMP_COOLER static celsius_float_t analog_to_celsius_cooler(const int16_t raw); #endif diff --git a/Marlin/src/module/thermistor/thermistors.h b/Marlin/src/module/thermistor/thermistors.h index 85f4449636..002beea5b5 100644 --- a/Marlin/src/module/thermistor/thermistors.h +++ b/Marlin/src/module/thermistor/thermistors.h @@ -283,13 +283,6 @@ typedef struct { int16_t value; celsius_t celsius; } temp_entry_t; #define TEMPTABLE_CHAMBER_LEN 0 #endif -#if TEMP_SENSOR_COOLER > 0 - #define TEMPTABLE_COOLER TT_NAME(TEMP_SENSOR_COOLER) - #define TEMPTABLE_COOLER_LEN COUNT(TEMPTABLE_COOLER) -#else - #define TEMPTABLE_COOLER_LEN 0 -#endif - #if TEMP_SENSOR_PROBE > 0 #define TEMPTABLE_PROBE TT_NAME(TEMP_SENSOR_PROBE) #define TEMPTABLE_PROBE_LEN COUNT(TEMPTABLE_PROBE) @@ -297,6 +290,13 @@ typedef struct { int16_t value; celsius_t celsius; } temp_entry_t; #define TEMPTABLE_PROBE_LEN 0 #endif +#if TEMP_SENSOR_COOLER > 0 + #define TEMPTABLE_COOLER TT_NAME(TEMP_SENSOR_COOLER) + #define TEMPTABLE_COOLER_LEN COUNT(TEMPTABLE_COOLER) +#else + #define TEMPTABLE_COOLER_LEN 0 +#endif + #if TEMP_SENSOR_BOARD > 0 #define TEMPTABLE_BOARD TT_NAME(TEMP_SENSOR_BOARD) #define TEMPTABLE_BOARD_LEN COUNT(TEMPTABLE_BOARD) @@ -316,8 +316,8 @@ static_assert(255 > TEMPTABLE_0_LEN || 255 > TEMPTABLE_1_LEN || 255 > TEMPTABLE_ || 255 > TEMPTABLE_4_LEN || 255 > TEMPTABLE_5_LEN || 255 > TEMPTABLE_6_LEN || 255 > TEMPTABLE_7_LEN || 255 > TEMPTABLE_BED_LEN || 255 > TEMPTABLE_CHAMBER_LEN - || 255 > TEMPTABLE_COOLER_LEN || 255 > TEMPTABLE_PROBE_LEN + || 255 > TEMPTABLE_COOLER_LEN || 255 > TEMPTABLE_BOARD_LEN || 255 > TEMPTABLE_REDUNDANT_LEN , "Temperature conversion tables over 255 entries need special consideration." diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index 599ce319af..2328a826ef 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -141,24 +141,24 @@ REPORT_NAME_ANALOG(__LINE__, TEMP_BED_PIN) #endif #endif -#if PIN_EXISTS(TEMP_BOARD) - #if ANALOG_OK(TEMP_BOARD_PIN) - REPORT_NAME_ANALOG(__LINE__, TEMP_BOARD_PIN) - #endif -#endif #if PIN_EXISTS(TEMP_CHAMBER) #if ANALOG_OK(TEMP_CHAMBER_PIN) REPORT_NAME_ANALOG(__LINE__, TEMP_CHAMBER_PIN) #endif #endif +#if PIN_EXISTS(TEMP_PROBE) + #if ANALOG_OK(TEMP_PROBE_PIN) + REPORT_NAME_ANALOG(__LINE__, TEMP_PROBE_PIN) + #endif +#endif #if PIN_EXISTS(TEMP_COOLER) #if ANALOG_OK(TEMP_COOLER_PIN) REPORT_NAME_ANALOG(__LINE__, TEMP_COOLER_PIN) #endif #endif -#if PIN_EXISTS(TEMP_PROBE) - #if ANALOG_OK(TEMP_PROBE_PIN) - REPORT_NAME_ANALOG(__LINE__, TEMP_PROBE_PIN) +#if PIN_EXISTS(TEMP_BOARD) + #if ANALOG_OK(TEMP_BOARD_PIN) + REPORT_NAME_ANALOG(__LINE__, TEMP_BOARD_PIN) #endif #endif #if PIN_EXISTS(ADC_KEYPAD)