Browse Source

Fix thermistor table warning

pull/1/head
Scott Lahteine 5 years ago
parent
commit
605ec0a478
  1. 4
      Marlin/src/module/temperature.cpp
  2. 21
      Marlin/src/module/thermistor/thermistors.h

4
Marlin/src/module/temperature.cpp

@ -1431,7 +1431,7 @@ float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) {
#if ENABLED(BED_USER_THERMISTOR)
return user_thermistor_to_deg_c(CTI_BED, raw);
#elif ENABLED(HEATER_BED_USES_THERMISTOR)
SCAN_THERMISTOR_TABLE(BEDTEMPTABLE, BEDTEMPTABLE_LEN);
SCAN_THERMISTOR_TABLE(BED_TEMPTABLE, BED_TEMPTABLE_LEN);
#elif ENABLED(HEATER_BED_USES_AD595)
return TEMP_AD595(raw);
#elif ENABLED(HEATER_BED_USES_AD8495)
@ -1449,7 +1449,7 @@ float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) {
#if ENABLED(CHAMBER_USER_THERMISTOR)
return user_thermistor_to_deg_c(CTI_CHAMBER, raw);
#elif ENABLED(HEATER_CHAMBER_USES_THERMISTOR)
SCAN_THERMISTOR_TABLE(CHAMBERTEMPTABLE, CHAMBERTEMPTABLE_LEN);
SCAN_THERMISTOR_TABLE(CHAMBER_TEMPTABLE, CHAMBER_TEMPTABLE_LEN);
#elif ENABLED(HEATER_CHAMBER_USES_AD595)
return TEMP_AD595(raw);
#elif ENABLED(HEATER_CHAMBER_USES_AD8495)

21
Marlin/src/module/thermistor/thermistors.h

@ -137,6 +137,9 @@
#if ANY_THERMISTOR_IS(999) // User-defined table 2
#include "thermistor_999.h"
#endif
#if ANY_THERMISTOR_IS(1000) // Custom
const short temptable_1000[][2] PROGMEM = { { 0, 0 } };
#endif
#define _TT_NAME(_N) temptable_ ## _N
#define TT_NAME(_N) _TT_NAME(_N)
@ -202,25 +205,29 @@
#endif
#ifdef THERMISTORBED
#define BEDTEMPTABLE TT_NAME(THERMISTORBED)
#define BEDTEMPTABLE_LEN COUNT(BEDTEMPTABLE)
#define BED_TEMPTABLE TT_NAME(THERMISTORBED)
#define BED_TEMPTABLE_LEN COUNT(BED_TEMPTABLE)
#elif defined(HEATER_BED_USES_THERMISTOR)
#error "No bed thermistor table specified"
#else
#define BEDTEMPTABLE_LEN 0
#define BED_TEMPTABLE_LEN 0
#endif
#ifdef THERMISTORCHAMBER
#define CHAMBERTEMPTABLE TT_NAME(THERMISTORCHAMBER)
#define CHAMBERTEMPTABLE_LEN COUNT(CHAMBERTEMPTABLE)
#define CHAMBER_TEMPTABLE TT_NAME(THERMISTORCHAMBER)
#define CHAMBER_TEMPTABLE_LEN COUNT(CHAMBER_TEMPTABLE)
#elif defined(HEATER_CHAMBER_USES_THERMISTOR)
#error "No chamber thermistor table specified"
#else
#define CHAMBERTEMPTABLE_LEN 0
#define CHAMBER_TEMPTABLE_LEN 0
#endif
// The SCAN_THERMISTOR_TABLE macro needs alteration?
static_assert(HEATER_0_TEMPTABLE_LEN < 256 && HEATER_1_TEMPTABLE_LEN < 256 && HEATER_2_TEMPTABLE_LEN < 256 && HEATER_3_TEMPTABLE_LEN < 256 && HEATER_4_TEMPTABLE_LEN < 256 && BEDTEMPTABLE_LEN < 256 && CHAMBERTEMPTABLE_LEN < 256,
static_assert(
HEATER_0_TEMPTABLE_LEN < 256 && HEATER_1_TEMPTABLE_LEN < 256
&& HEATER_2_TEMPTABLE_LEN < 256 && HEATER_3_TEMPTABLE_LEN < 256
&& HEATER_4_TEMPTABLE_LEN < 256 && HEATER_5_TEMPTABLE_LEN < 256
&& BED_TEMPTABLE_LEN < 256 && CHAMBER_TEMPTABLE_LEN < 256,
"Temperature conversion tables over 255 entries need special consideration."
);

Loading…
Cancel
Save