Use temp_info_t for temp_redundant (#21715)

Fixes #21712

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
ellensp
2021-04-27 16:36:39 +12:00
committed by GitHub
parent 43fc1bd21c
commit 5f9aac2027
2 changed files with 41 additions and 38 deletions

View File

@@ -321,8 +321,10 @@ class Temperature {
public:
#if HAS_HOTEND
#define HOTEND_TEMPS (HOTENDS + ENABLED(TEMP_SENSOR_1_AS_REDUNDANT))
static hotend_info_t temp_hotend[HOTEND_TEMPS];
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
static temp_info_t temp_redundant;
#endif
static hotend_info_t temp_hotend[HOTENDS];
static const celsius_t hotend_maxtemp[HOTENDS];
static inline celsius_t hotend_max_target(const uint8_t e) { return hotend_maxtemp[e] - (HOTEND_OVERSHOOT); }
#endif
@@ -423,11 +425,6 @@ class Temperature {
static hotend_watch_t watch_hotend[HOTENDS];
#endif
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
static uint16_t redundant_temperature_raw;
static celsius_t redundant_temperature;
#endif
#if ENABLED(PID_EXTRUSION_SCALING)
static int32_t last_e_position, lpq[LPQ_MAX_LEN];
static lpq_ptr_t lpq_ptr;
@@ -501,7 +498,7 @@ class Temperature {
static user_thermistor_t user_thermistor[USER_THERMISTORS];
static void log_user_thermistor(const uint8_t t_index, const bool eprom=false);
static void reset_user_thermistors();
static celsius_float_t user_thermistor_to_deg_c(const uint8_t t_index, const int raw);
static celsius_float_t user_thermistor_to_deg_c(const uint8_t t_index, const int16_t raw);
static inline bool set_pull_up_res(int8_t t_index, float value) {
//if (!WITHIN(t_index, 0, USER_THERMISTORS - 1)) return false;
if (!WITHIN(value, 1, 1000000)) return false;
@@ -529,19 +526,19 @@ class Temperature {
#endif
#if HAS_HOTEND
static celsius_float_t analog_to_celsius_hotend(const int raw, const uint8_t e);
static celsius_float_t analog_to_celsius_hotend(const int16_t raw, const uint8_t e);
#endif
#if HAS_HEATED_BED
static celsius_float_t analog_to_celsius_bed(const int raw);
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 int raw);
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 int raw);
static celsius_float_t analog_to_celsius_chamber(const int16_t raw);
#endif
#if HAS_TEMP_COOLER
static celsius_float_t analog_to_celsius_cooler(const int raw);
static celsius_float_t analog_to_celsius_cooler(const int16_t raw);
#endif
#if HAS_FAN
@@ -631,6 +628,10 @@ class Temperature {
return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].celsius);
}
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
static inline celsius_float_t degHotendRedundant() { return temp_redundant.celsius; }
#endif
static inline celsius_t wholeDegHotend(const uint8_t E_NAME) {
return TERN0(HAS_HOTEND, static_cast<celsius_t>(temp_hotend[HOTEND_INDEX].celsius + 0.5f));
}
@@ -639,6 +640,9 @@ class Temperature {
static inline int16_t rawHotendTemp(const uint8_t E_NAME) {
return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].raw);
}
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
static inline int16_t rawHotendTempRedundant() { return temp_redundant.raw; }
#endif
#endif
static inline celsius_t degTargetHotend(const uint8_t E_NAME) {