Browse Source

Long thermistor tables need special consideration

Scott Lahteine 7 years ago
parent
commit
853a9056ac
2 changed files with 13 additions and 8 deletions
  1. 2
    2
      Marlin/src/module/temperature.cpp
  2. 11
    6
      Marlin/src/module/thermistor/thermistors.h

+ 2
- 2
Marlin/src/module/temperature.cpp View File

54
 #if HOTEND_USES_THERMISTOR
54
 #if HOTEND_USES_THERMISTOR
55
   #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
55
   #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
56
     static void* heater_ttbl_map[2] = { (void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE };
56
     static void* heater_ttbl_map[2] = { (void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE };
57
-    static uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN };
57
+    static constexpr uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN };
58
   #else
58
   #else
59
     static void* heater_ttbl_map[HOTENDS] = ARRAY_BY_HOTENDS((void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE, (void*)HEATER_2_TEMPTABLE, (void*)HEATER_3_TEMPTABLE, (void*)HEATER_4_TEMPTABLE);
59
     static void* heater_ttbl_map[HOTENDS] = ARRAY_BY_HOTENDS((void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE, (void*)HEATER_2_TEMPTABLE, (void*)HEATER_3_TEMPTABLE, (void*)HEATER_4_TEMPTABLE);
60
-    static uint8_t heater_ttbllen_map[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN, HEATER_2_TEMPTABLE_LEN, HEATER_3_TEMPTABLE_LEN, HEATER_4_TEMPTABLE_LEN);
60
+    static constexpr uint8_t heater_ttbllen_map[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN, HEATER_2_TEMPTABLE_LEN, HEATER_3_TEMPTABLE_LEN, HEATER_4_TEMPTABLE_LEN);
61
   #endif
61
   #endif
62
 #endif
62
 #endif
63
 
63
 

+ 11
- 6
Marlin/src/module/thermistor/thermistors.h View File

184
 #ifdef THERMISTORBED
184
 #ifdef THERMISTORBED
185
   #define BEDTEMPTABLE TT_NAME(THERMISTORBED)
185
   #define BEDTEMPTABLE TT_NAME(THERMISTORBED)
186
   #define BEDTEMPTABLE_LEN COUNT(BEDTEMPTABLE)
186
   #define BEDTEMPTABLE_LEN COUNT(BEDTEMPTABLE)
187
+#elif defined(HEATER_BED_USES_THERMISTOR)
188
+  #error "No bed thermistor table specified"
187
 #else
189
 #else
188
-  #ifdef HEATER_BED_USES_THERMISTOR
189
-    #error "No bed thermistor table specified"
190
-  #endif
190
+  #define BEDTEMPTABLE_LEN 0
191
 #endif
191
 #endif
192
 
192
 
193
 #ifdef THERMISTORCHAMBER
193
 #ifdef THERMISTORCHAMBER
194
   #define CHAMBERTEMPTABLE TT_NAME(THERMISTORCHAMBER)
194
   #define CHAMBERTEMPTABLE TT_NAME(THERMISTORCHAMBER)
195
   #define CHAMBERTEMPTABLE_LEN COUNT(CHAMBERTEMPTABLE)
195
   #define CHAMBERTEMPTABLE_LEN COUNT(CHAMBERTEMPTABLE)
196
+#elif defined(HEATER_CHAMBER_USES_THERMISTOR)
197
+  #error "No chamber thermistor table specified"
196
 #else
198
 #else
197
-  #ifdef HEATER_CHAMBER_USES_THERMISTOR
198
-    #error "No chamber thermistor table specified"
199
-  #endif
199
+  #define CHAMBERTEMPTABLE_LEN 0
200
 #endif
200
 #endif
201
 
201
 
202
+// The SCAN_THERMISTOR_TABLE macro needs alteration?
203
+static_assert(HEATER_0_TEMPTABLE_LEN < 128 && HEATER_1_TEMPTABLE_LEN < 128 && HEATER_2_TEMPTABLE_LEN < 128 && HEATER_3_TEMPTABLE_LEN < 128 && HEATER_4_TEMPTABLE_LEN < 128 && BEDTEMPTABLE_LEN < 128 && CHAMBERTEMPTABLE_LEN < 128,
204
+  "Temperature conversion tables over 127 entries need special consideration."
205
+);
206
+
202
 // Set the high and low raw values for the heaters
207
 // Set the high and low raw values for the heaters
203
 // For thermistors the highest temperature results in the lowest ADC value
208
 // For thermistors the highest temperature results in the lowest ADC value
204
 // For thermocouples the highest temperature results in the highest ADC value
209
 // For thermocouples the highest temperature results in the highest ADC value

Loading…
Cancel
Save