🐛 Redundant Temp Sensor followup (#22173)

This commit is contained in:
Katelyn Schiesser 2021-06-19 11:44:28 -07:00 committed by Scott Lahteine
parent 927a1a1738
commit 4f8191b481
2 changed files with 103 additions and 82 deletions

View File

@ -526,7 +526,17 @@
#undef ANY_TEMP_SENSOR_IS
// Usurp a sensor to do redundant readings
#if TEMP_SENSOR_REDUNDANT && !PIN_EXISTS(TEMP_REDUNDANT)
#if TEMP_SENSOR_REDUNDANT
#ifndef TEMP_SENSOR_REDUNDANT_SOURCE
#define TEMP_SENSOR_REDUNDANT_SOURCE 1
#endif
#ifndef TEMP_SENSOR_REDUNDANT_TARGET
#define TEMP_SENSOR_REDUNDANT_TARGET 0
#endif
#if !PIN_EXISTS(TEMP_REDUNDANT)
#ifndef TEMP_SENSOR_REDUNDANT_MAX_DIFF
#define TEMP_SENSOR_REDUNDANT_MAX_DIFF 10
#endif
#if TEMP_SENSOR_REDUNDANT_SOURCE == -5
#if !PIN_EXISTS(TEMP_COOLER)
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to COOLER requires TEMP_COOLER_PIN."
@ -600,9 +610,6 @@
#define TEMP_REDUNDANT_PIN TEMP_7_PIN
#endif
#endif
#ifndef TEMP_SENSOR_REDUNDANT_MAX_DIFF
#define TEMP_SENSOR_REDUNDANT_MAX_DIFF 10
#endif
#endif

View File

@ -2090,16 +2090,30 @@ void Temperature::init() {
#endif
#if HAS_MAX31865_TEMP
TERN_(TEMP_SENSOR_IS_MAX(0, MAX31865), max31865_0.begin(MAX31865_2WIRE)); // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE
TERN_(TEMP_SENSOR_IS_MAX(1, MAX31865), max31865_1.begin(MAX31865_2WIRE));
#if TEMP_SENSOR_IS_MAX(0, MAX31865)
max31865_0.begin(MAX31865_2WIRE); // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE
#endif
#if TEMP_SENSOR_IS_MAX(1, MAX31865)
max31865_1.begin(MAX31865_2WIRE);
#endif
#endif
#if HAS_MAX31855_TEMP
TERN_(TEMP_SENSOR_IS_MAX(0, MAX31855), max31855_0.begin());
TERN_(TEMP_SENSOR_IS_MAX(1, MAX31855), max31855_1.begin());
#if TEMP_SENSOR_IS_MAX(0, MAX31855)
max31855_0.begin(MAX31855);
#endif
#if TEMP_SENSOR_IS_MAX(1, MAX31855)
max31855_1.begin(MAX31855);
#endif
#endif
#if HAS_MAX6675_TEMP
TERN_(TEMP_SENSOR_IS_MAX(0, MAX6675), max6675_0.begin());
TERN_(TEMP_SENSOR_IS_MAX(1, MAX6675), max6675_1.begin());
#if TEMP_SENSOR_IS_MAX(0, MAX6675)
max6675_0.begin(MAX6675);
#endif
#if TEMP_SENSOR_IS_MAX(1, MAX6675)
max6675_1.begin(MAX6675);
#endif
#endif
#if MB(RUMBA)