Переглянути джерело

Enforce sensor range for temperature target (#18465)

* Mitigate stepper timeout

* Add CHAMBER PWM code

* Structured thermistor tables

* Fix reversed sensor ranges

* Prevent temps outside sensor range
Scott Lahteine 4 роки тому
джерело
коміт
c43bbcce15
Аккаунт користувача з таким Email не знайдено
56 змінених файлів з 296 додано та 168 видалено
  1. 11
    12
      Marlin/src/MarlinCore.cpp
  2. 0
    3
      Marlin/src/MarlinCore.h
  3. 1
    1
      Marlin/src/feature/bedlevel/ubl/ubl.cpp
  4. 3
    1
      Marlin/src/gcode/bedlevel/abl/G29.cpp
  5. 7
    4
      Marlin/src/gcode/calibrate/G28.cpp
  6. 1
    0
      Marlin/src/gcode/control/M17_M18_M84.cpp
  7. 0
    1
      Marlin/src/gcode/control/M85.cpp
  8. 3
    0
      Marlin/src/gcode/control/T.cpp
  9. 4
    1
      Marlin/src/gcode/gcode.cpp
  10. 8
    2
      Marlin/src/gcode/gcode.h
  11. 105
    83
      Marlin/src/module/temperature.cpp
  12. 1
    1
      Marlin/src/module/temperature.h
  13. 1
    1
      Marlin/src/module/thermistor/thermistor_1.h
  14. 1
    1
      Marlin/src/module/thermistor/thermistor_10.h
  15. 1
    1
      Marlin/src/module/thermistor/thermistor_1010.h
  16. 1
    1
      Marlin/src/module/thermistor/thermistor_1047.h
  17. 1
    1
      Marlin/src/module/thermistor/thermistor_11.h
  18. 1
    1
      Marlin/src/module/thermistor/thermistor_110.h
  19. 1
    1
      Marlin/src/module/thermistor/thermistor_12.h
  20. 1
    1
      Marlin/src/module/thermistor/thermistor_13.h
  21. 1
    1
      Marlin/src/module/thermistor/thermistor_147.h
  22. 1
    1
      Marlin/src/module/thermistor/thermistor_15.h
  23. 1
    1
      Marlin/src/module/thermistor/thermistor_18.h
  24. 1
    1
      Marlin/src/module/thermistor/thermistor_2.h
  25. 2
    2
      Marlin/src/module/thermistor/thermistor_20.h
  26. 2
    2
      Marlin/src/module/thermistor/thermistor_201.h
  27. 1
    1
      Marlin/src/module/thermistor/thermistor_202.h
  28. 2
    2
      Marlin/src/module/thermistor/thermistor_21.h
  29. 1
    1
      Marlin/src/module/thermistor/thermistor_22.h
  30. 1
    1
      Marlin/src/module/thermistor/thermistor_23.h
  31. 1
    1
      Marlin/src/module/thermistor/thermistor_3.h
  32. 1
    1
      Marlin/src/module/thermistor/thermistor_331.h
  33. 1
    1
      Marlin/src/module/thermistor/thermistor_332.h
  34. 1
    1
      Marlin/src/module/thermistor/thermistor_4.h
  35. 1
    1
      Marlin/src/module/thermistor/thermistor_5.h
  36. 1
    1
      Marlin/src/module/thermistor/thermistor_501.h
  37. 1
    1
      Marlin/src/module/thermistor/thermistor_502.h
  38. 1
    1
      Marlin/src/module/thermistor/thermistor_51.h
  39. 1
    1
      Marlin/src/module/thermistor/thermistor_512.h
  40. 1
    1
      Marlin/src/module/thermistor/thermistor_52.h
  41. 1
    1
      Marlin/src/module/thermistor/thermistor_55.h
  42. 1
    1
      Marlin/src/module/thermistor/thermistor_6.h
  43. 1
    1
      Marlin/src/module/thermistor/thermistor_60.h
  44. 1
    1
      Marlin/src/module/thermistor/thermistor_61.h
  45. 1
    1
      Marlin/src/module/thermistor/thermistor_66.h
  46. 1
    1
      Marlin/src/module/thermistor/thermistor_67.h
  47. 1
    1
      Marlin/src/module/thermistor/thermistor_7.h
  48. 1
    1
      Marlin/src/module/thermistor/thermistor_70.h
  49. 1
    1
      Marlin/src/module/thermistor/thermistor_71.h
  50. 1
    1
      Marlin/src/module/thermistor/thermistor_75.h
  51. 1
    1
      Marlin/src/module/thermistor/thermistor_8.h
  52. 1
    1
      Marlin/src/module/thermistor/thermistor_9.h
  53. 1
    1
      Marlin/src/module/thermistor/thermistor_99.h
  54. 1
    1
      Marlin/src/module/thermistor/thermistor_998.h
  55. 1
    1
      Marlin/src/module/thermistor/thermistor_999.h
  56. 106
    13
      Marlin/src/module/thermistor/thermistors.h

+ 11
- 12
Marlin/src/MarlinCore.cpp Переглянути файл

@@ -240,10 +240,6 @@ bool wait_for_heatup = true;
240 240
 
241 241
 #endif
242 242
 
243
-// Inactivity shutdown
244
-millis_t max_inactive_time, // = 0
245
-         stepper_inactive_time = SEC_TO_MS(DEFAULT_STEPPER_DEACTIVE_TIME);
246
-
247 243
 #if PIN_EXISTS(CHDK)
248 244
   extern millis_t chdk_timeout;
249 245
 #endif
@@ -469,20 +465,23 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
469 465
 
470 466
   const millis_t ms = millis();
471 467
 
472
-  if (max_inactive_time && ELAPSED(ms, gcode.previous_move_ms + max_inactive_time)) {
468
+  // Prevent steppers timing-out in the middle of M600
469
+  #define STAY_TEST (BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT) && did_pause_print)
470
+
471
+  if (STAY_TEST || ignore_stepper_queue)
472
+    gcode.reset_stepper_timeout(ms);
473
+
474
+  if (gcode.stepper_max_timed_out(ms)) {
473 475
     SERIAL_ERROR_START();
474 476
     SERIAL_ECHOLNPAIR(STR_KILL_INACTIVE_TIME, parser.command_ptr);
475 477
     kill();
476 478
   }
477 479
 
478
-  // Prevent steppers timing-out in the middle of M600
479
-  #define STAY_TEST (BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT) && did_pause_print)
480
-
481
-  if (stepper_inactive_time) {
480
+  if (gcode.stepper_inactive_time) {
482 481
     static bool already_shutdown_steppers; // = false
483 482
     if (planner.has_blocks_queued())
484
-      gcode.reset_stepper_timeout();
485
-    else if (!STAY_TEST && !ignore_stepper_queue && ELAPSED(ms, gcode.previous_move_ms + stepper_inactive_time)) {
483
+      gcode.reset_stepper_timeout(ms);
484
+    else if (!STAY_TEST && !ignore_stepper_queue && gcode.stepper_inactive_timeout()) {
486 485
       if (!already_shutdown_steppers) {
487 486
         already_shutdown_steppers = true;  // L6470 SPI will consume 99% of free time without this
488 487
         if (ENABLED(DISABLE_INACTIVE_X)) DISABLE_AXIS_X();
@@ -601,7 +600,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
601 600
         }
602 601
       #endif // !SWITCHING_EXTRUDER
603 602
 
604
-      gcode.reset_stepper_timeout();
603
+      gcode.reset_stepper_timeout(ms);
605 604
     }
606 605
   #endif // EXTRUDER_RUNOUT_PREVENT
607 606
 

+ 0
- 3
Marlin/src/MarlinCore.h Переглянути файл

@@ -87,9 +87,6 @@ extern bool wait_for_heatup;
87 87
   void wait_for_user_response(millis_t ms=0, const bool no_sleep=false);
88 88
 #endif
89 89
 
90
-// Inactivity shutdown timer
91
-extern millis_t max_inactive_time, stepper_inactive_time;
92
-
93 90
 #if ENABLED(PSU_CONTROL)
94 91
   extern bool powersupply_on;
95 92
   #define PSU_PIN_ON()  do{ OUT_WRITE(PS_ON_PIN,  PSU_ACTIVE_HIGH); powersupply_on = true; }while(0)

+ 1
- 1
Marlin/src/feature/bedlevel/ubl/ubl.cpp Переглянути файл

@@ -206,7 +206,7 @@
206 206
         if (human) SERIAL_CHAR(is_current ? ']' : ' ');
207 207
 
208 208
         SERIAL_FLUSHTX();
209
-        idle();
209
+        idle_no_sleep();
210 210
       }
211 211
       if (!lcd) SERIAL_EOL();
212 212
 

+ 3
- 1
Marlin/src/gcode/bedlevel/abl/G29.cpp Переглянути файл

@@ -164,6 +164,8 @@
164 164
  */
165 165
 G29_TYPE GcodeSuite::G29() {
166 166
 
167
+  reset_stepper_timeout();
168
+
167 169
   const bool seenQ = EITHER(DEBUG_LEVELING_FEATURE, PROBE_MANUALLY) && parser.seen('Q');
168 170
 
169 171
   // G29 Q is also available if debugging
@@ -675,7 +677,7 @@ G29_TYPE GcodeSuite::G29() {
675 677
           #endif
676 678
 
677 679
           abl_should_enable = false;
678
-          idle();
680
+          idle_no_sleep();
679 681
 
680 682
         } // inner
681 683
       } // outer

+ 7
- 4
Marlin/src/gcode/calibrate/G28.cpp Переглянути файл

@@ -203,15 +203,15 @@
203 203
  */
204 204
 void GcodeSuite::G28() {
205 205
 
206
-#if ENABLED(LASER_MOVE_G28_OFF)
207
-  cutter.set_inline_enabled(false);       // turn off laser
208
-#endif
209
-
210 206
   if (DEBUGGING(LEVELING)) {
211 207
     DEBUG_ECHOLNPGM(">>> G28");
212 208
     log_machine_info();
213 209
   }
214 210
 
211
+  #if ENABLED(LASER_MOVE_G28_OFF)
212
+    cutter.set_inline_enabled(false);       // turn off laser
213
+  #endif
214
+
215 215
   TERN_(DWIN_CREALITY_LCD, HMI_flag.home_flag = true);
216 216
 
217 217
   #if ENABLED(DUAL_X_CARRIAGE)
@@ -251,6 +251,9 @@ void GcodeSuite::G28() {
251 251
 
252 252
   TERN_(CNC_WORKSPACE_PLANES, workspace_plane = PLANE_XY);
253 253
 
254
+  // Count this command as movement / activity
255
+  reset_stepper_timeout();
256
+
254 257
   #define HAS_CURRENT_HOME(N) (defined(N##_CURRENT_HOME) && N##_CURRENT_HOME != N##_CURRENT)
255 258
   #if HAS_CURRENT_HOME(X) || HAS_CURRENT_HOME(X2) || HAS_CURRENT_HOME(Y) || HAS_CURRENT_HOME(Y2)
256 259
     #define HAS_HOMING_CURRENT 1

+ 1
- 0
Marlin/src/gcode/control/M17_M18_M84.cpp Переглянути файл

@@ -50,6 +50,7 @@ void GcodeSuite::M17() {
50 50
  */
51 51
 void GcodeSuite::M18_M84() {
52 52
   if (parser.seenval('S')) {
53
+    reset_stepper_timeout();
53 54
     stepper_inactive_time = parser.value_millis_from_seconds();
54 55
   }
55 56
   else {

+ 0
- 1
Marlin/src/gcode/control/M85.cpp Переглянути файл

@@ -21,7 +21,6 @@
21 21
  */
22 22
 
23 23
 #include "../gcode.h"
24
-#include "../../MarlinCore.h" // for max_inactive_time
25 24
 
26 25
 /**
27 26
  * M85: Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)

+ 3
- 0
Marlin/src/gcode/control/T.cpp Переглянути файл

@@ -53,6 +53,9 @@ void GcodeSuite::T(const uint8_t tool_index) {
53 53
     DEBUG_POS("BEFORE", current_position);
54 54
   }
55 55
 
56
+  // Count this command as movement / activity
57
+  reset_stepper_timeout();
58
+
56 59
   #if ENABLED(PRUSA_MMU2)
57 60
     if (parser.string_arg) {
58 61
       mmu2.tool_change(parser.string_arg);   // Special commands T?/Tx/Tc

+ 4
- 1
Marlin/src/gcode/gcode.cpp Переглянути файл

@@ -59,7 +59,10 @@ GcodeSuite gcode;
59 59
 
60 60
 #include "../MarlinCore.h" // for idle()
61 61
 
62
-millis_t GcodeSuite::previous_move_ms;
62
+// Inactivity shutdown
63
+millis_t GcodeSuite::previous_move_ms = 0,
64
+         GcodeSuite::max_inactive_time = 0,
65
+         GcodeSuite::stepper_inactive_time = SEC_TO_MS(DEFAULT_STEPPER_DEACTIVE_TIME);
63 66
 
64 67
 // Relative motion mode for each logical axis
65 68
 static constexpr xyze_bool_t ar_init = AXIS_RELATIVE_MODES;

+ 8
- 2
Marlin/src/gcode/gcode.h Переглянути файл

@@ -334,8 +334,14 @@ public:
334 334
     static bool select_coordinate_system(const int8_t _new);
335 335
   #endif
336 336
 
337
-  static millis_t previous_move_ms;
338
-  FORCE_INLINE static void reset_stepper_timeout() { previous_move_ms = millis(); }
337
+  static millis_t previous_move_ms, max_inactive_time, stepper_inactive_time;
338
+  FORCE_INLINE static void reset_stepper_timeout(const millis_t ms=millis()) { previous_move_ms = ms; }
339
+  FORCE_INLINE static bool stepper_max_timed_out(const millis_t ms=millis()) {
340
+    return max_inactive_time && ELAPSED(ms, previous_move_ms + max_inactive_time);
341
+  }
342
+  FORCE_INLINE static bool stepper_inactive_timeout(const millis_t ms=millis()) {
343
+    return ELAPSED(ms, previous_move_ms + stepper_inactive_time);
344
+  }
339 345
 
340 346
   static int8_t get_target_extruder_from_command();
341 347
   static int8_t get_target_e_stepper_from_command();

+ 105
- 83
Marlin/src/module/temperature.cpp Переглянути файл

@@ -110,12 +110,12 @@
110 110
 
111 111
 #if HOTEND_USES_THERMISTOR
112 112
   #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
113
-    static const void* heater_ttbl_map[2] = { (void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE };
113
+    static const temp_entry_t* heater_ttbl_map[2] = { HEATER_0_TEMPTABLE, HEATER_1_TEMPTABLE };
114 114
     static constexpr uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN };
115 115
   #else
116 116
     #define NEXT_TEMPTABLE(N) ,HEATER_##N##_TEMPTABLE
117 117
     #define NEXT_TEMPTABLE_LEN(N) ,HEATER_##N##_TEMPTABLE_LEN
118
-    static const void* heater_ttbl_map[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_TEMPTABLE REPEAT_S(1, HOTENDS, NEXT_TEMPTABLE));
118
+    static const temp_entry_t* heater_ttbl_map[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_TEMPTABLE REPEAT_S(1, HOTENDS, NEXT_TEMPTABLE));
119 119
     static constexpr uint8_t heater_ttbllen_map[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_TEMPTABLE_LEN REPEAT_S(1, HOTENDS, NEXT_TEMPTABLE_LEN));
120 120
   #endif
121 121
 #endif
@@ -900,11 +900,13 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
900 900
           SERIAL_ECHO_START();
901 901
           SERIAL_ECHOPAIR(STR_PID_DEBUG, ee, STR_PID_DEBUG_INPUT, temp_hotend[ee].celsius, STR_PID_DEBUG_OUTPUT, pid_output);
902 902
           #if DISABLED(PID_OPENLOOP)
903
+          {
903 904
             SERIAL_ECHOPAIR( STR_PID_DEBUG_PTERM, work_pid[ee].Kp, STR_PID_DEBUG_ITERM, work_pid[ee].Ki, STR_PID_DEBUG_DTERM, work_pid[ee].Kd
904 905
               #if ENABLED(PID_EXTRUSION_SCALING)
905 906
                 , STR_PID_DEBUG_CTERM, work_pid[ee].Kc
906 907
               #endif
907 908
             );
909
+          }
908 910
           #endif
909 911
           SERIAL_EOL();
910 912
         }
@@ -920,7 +922,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
920 922
     return pid_output;
921 923
   }
922 924
 
923
-#endif // HOTENDS
925
+#endif // HAS_HOTEND
924 926
 
925 927
 #if ENABLED(PIDTEMPBED)
926 928
 
@@ -1058,7 +1060,7 @@ void Temperature::manage_heater() {
1058 1060
 
1059 1061
     } // HOTEND_LOOP
1060 1062
 
1061
-  #endif // HOTENDS
1063
+  #endif // HAS_HOTEND
1062 1064
 
1063 1065
   #if HAS_AUTO_FAN
1064 1066
     if (ELAPSED(ms, next_auto_fan_check_ms)) { // only need to check fan state very infrequently
@@ -1208,22 +1210,22 @@ void Temperature::manage_heater() {
1208 1210
  * Bisect search for the range of the 'raw' value, then interpolate
1209 1211
  * proportionally between the under and over values.
1210 1212
  */
1211
-#define SCAN_THERMISTOR_TABLE(TBL,LEN) do{                             \
1212
-  uint8_t l = 0, r = LEN, m;                                           \
1213
-  for (;;) {                                                           \
1214
-    m = (l + r) >> 1;                                                  \
1215
-    if (!m) return short(pgm_read_word(&TBL[0][1]));                   \
1216
-    if (m == l || m == r) return short(pgm_read_word(&TBL[LEN-1][1])); \
1217
-    short v00 = pgm_read_word(&TBL[m-1][0]),                           \
1218
-          v10 = pgm_read_word(&TBL[m-0][0]);                           \
1219
-         if (raw < v00) r = m;                                         \
1220
-    else if (raw > v10) l = m;                                         \
1221
-    else {                                                             \
1222
-      const short v01 = short(pgm_read_word(&TBL[m-1][1])),            \
1223
-                  v11 = short(pgm_read_word(&TBL[m-0][1]));            \
1224
-      return v01 + (raw - v00) * float(v11 - v01) / float(v10 - v00);  \
1225
-    }                                                                  \
1226
-  }                                                                    \
1213
+#define SCAN_THERMISTOR_TABLE(TBL,LEN) do{                            \
1214
+  uint8_t l = 0, r = LEN, m;                                          \
1215
+  for (;;) {                                                          \
1216
+    m = (l + r) >> 1;                                                 \
1217
+    if (!m) return int16_t(pgm_read_word(&TBL[0].celsius));           \
1218
+    if (m == l || m == r) return int16_t(pgm_read_word(&TBL[LEN-1].celsius)); \
1219
+    int16_t v00 = pgm_read_word(&TBL[m-1].value),                     \
1220
+          v10 = pgm_read_word(&TBL[m-0].value);                       \
1221
+         if (raw < v00) r = m;                                        \
1222
+    else if (raw > v10) l = m;                                        \
1223
+    else {                                                            \
1224
+      const int16_t v01 = int16_t(pgm_read_word(&TBL[m-1].celsius)),  \
1225
+                  v11 = int16_t(pgm_read_word(&TBL[m-0].celsius));    \
1226
+      return v01 + (raw - v00) * float(v11 - v01) / float(v10 - v00); \
1227
+    }                                                                 \
1228
+  }                                                                   \
1227 1229
 }while(0)
1228 1230
 
1229 1231
 #if HAS_USER_THERMISTORS
@@ -1452,13 +1454,13 @@ void Temperature::manage_heater() {
1452 1454
 
1453 1455
     #if HOTEND_USES_THERMISTOR
1454 1456
       // Thermistor with conversion table?
1455
-      const short(*tt)[][2] = (short(*)[][2])(heater_ttbl_map[e]);
1457
+      const temp_entry_t(*tt)[] = (temp_entry_t(*)[])(heater_ttbl_map[e]);
1456 1458
       SCAN_THERMISTOR_TABLE((*tt), heater_ttbllen_map[e]);
1457 1459
     #endif
1458 1460
 
1459 1461
     return 0;
1460 1462
   }
1461
-#endif // HOTENDS
1463
+#endif // HAS_HOTEND
1462 1464
 
1463 1465
 #if HAS_HEATED_BED
1464 1466
   // Derived from RepRap FiveD extruder::getTemperature()
@@ -1790,80 +1792,91 @@ void Temperature::init() {
1790 1792
   #if HAS_HOTEND
1791 1793
 
1792 1794
     #define _TEMP_MIN_E(NR) do{ \
1793
-      temp_range[NR].mintemp = HEATER_ ##NR## _MINTEMP; \
1794
-      while (analog_to_celsius_hotend(temp_range[NR].raw_min, NR) < HEATER_ ##NR## _MINTEMP) \
1795
+      const int16_t tmin = _MAX(HEATER_ ##NR## _MINTEMP, (int16_t)pgm_read_word(&HEATER_ ##NR## _TEMPTABLE[HEATER_ ##NR## _SENSOR_MINTEMP_IND].celsius)); \
1796
+      temp_range[NR].mintemp = tmin; \
1797
+      while (analog_to_celsius_hotend(temp_range[NR].raw_min, NR) < tmin) \
1795 1798
         temp_range[NR].raw_min += TEMPDIR(NR) * (OVERSAMPLENR); \
1796 1799
     }while(0)
1797 1800
     #define _TEMP_MAX_E(NR) do{ \
1798
-      temp_range[NR].maxtemp = HEATER_ ##NR## _MAXTEMP; \
1799
-      while (analog_to_celsius_hotend(temp_range[NR].raw_max, NR) > HEATER_ ##NR## _MAXTEMP) \
1801
+      const int16_t tmax = _MIN(HEATER_ ##NR## _MAXTEMP, (int16_t)pgm_read_word(&HEATER_ ##NR## _TEMPTABLE[HEATER_ ##NR## _SENSOR_MAXTEMP_IND].celsius) - 1); \
1802
+      temp_range[NR].maxtemp = tmax; \
1803
+      while (analog_to_celsius_hotend(temp_range[NR].raw_max, NR) > tmax) \
1800 1804
         temp_range[NR].raw_max -= TEMPDIR(NR) * (OVERSAMPLENR); \
1801 1805
     }while(0)
1802 1806
 
1803
-    #ifdef HEATER_0_MINTEMP
1807
+    #if THERMISTOR_HEATER_0
1808
+      #ifdef HEATER_0_MINTEMP
1804 1809
       _TEMP_MIN_E(0);
1810
+      #endif
1811
+      #ifdef HEATER_0_MAXTEMP
1812
+        _TEMP_MAX_E(0);
1813
+      #endif
1805 1814
     #endif
1806
-    #ifdef HEATER_0_MAXTEMP
1807
-      _TEMP_MAX_E(0);
1808
-    #endif
1809
-    #if HAS_MULTI_HOTEND
1815
+
1816
+    #if HAS_MULTI_HOTEND && THERMISTOR_HEATER_1
1810 1817
       #ifdef HEATER_1_MINTEMP
1811 1818
         _TEMP_MIN_E(1);
1812 1819
       #endif
1813 1820
       #ifdef HEATER_1_MAXTEMP
1814 1821
         _TEMP_MAX_E(1);
1815 1822
       #endif
1816
-      #if HOTENDS > 2
1817
-        #ifdef HEATER_2_MINTEMP
1818
-          _TEMP_MIN_E(2);
1819
-        #endif
1820
-        #ifdef HEATER_2_MAXTEMP
1821
-          _TEMP_MAX_E(2);
1822
-        #endif
1823
-        #if HOTENDS > 3
1824
-          #ifdef HEATER_3_MINTEMP
1825
-            _TEMP_MIN_E(3);
1826
-          #endif
1827
-          #ifdef HEATER_3_MAXTEMP
1828
-            _TEMP_MAX_E(3);
1829
-          #endif
1830
-          #if HOTENDS > 4
1831
-            #ifdef HEATER_4_MINTEMP
1832
-              _TEMP_MIN_E(4);
1833
-            #endif
1834
-            #ifdef HEATER_4_MAXTEMP
1835
-              _TEMP_MAX_E(4);
1836
-            #endif
1837
-            #if HOTENDS > 5
1838
-              #ifdef HEATER_5_MINTEMP
1839
-                _TEMP_MIN_E(5);
1840
-              #endif
1841
-              #ifdef HEATER_5_MAXTEMP
1842
-                _TEMP_MAX_E(5);
1843
-              #endif
1844
-              #if HOTENDS > 6
1845
-                #ifdef HEATER_6_MINTEMP
1846
-                  _TEMP_MIN_E(6);
1847
-                #endif
1848
-                #ifdef HEATER_6_MAXTEMP
1849
-                  _TEMP_MAX_E(6);
1850
-                #endif
1851
-                #if HOTENDS > 7
1852
-                  #ifdef HEATER_7_MINTEMP
1853
-                    _TEMP_MIN_E(7);
1854
-                  #endif
1855
-                  #ifdef HEATER_7_MAXTEMP
1856
-                    _TEMP_MAX_E(7);
1857
-                  #endif
1858
-                #endif // HOTENDS > 7
1859
-              #endif // HOTENDS > 6
1860
-            #endif // HOTENDS > 5
1861
-          #endif // HOTENDS > 4
1862
-        #endif // HOTENDS > 3
1863
-      #endif // HOTENDS > 2
1864
-    #endif // HAS_MULTI_HOTEND
1865
-
1866
-  #endif // HOTENDS
1823
+    #endif
1824
+
1825
+    #if HOTENDS > 2 && THERMISTOR_HEATER_2
1826
+      #ifdef HEATER_2_MINTEMP
1827
+        _TEMP_MIN_E(2);
1828
+      #endif
1829
+      #ifdef HEATER_2_MAXTEMP
1830
+        _TEMP_MAX_E(2);
1831
+      #endif
1832
+    #endif
1833
+
1834
+    #if HOTENDS > 3 && THERMISTOR_HEATER_3
1835
+      #ifdef HEATER_3_MINTEMP
1836
+        _TEMP_MIN_E(3);
1837
+      #endif
1838
+      #ifdef HEATER_3_MAXTEMP
1839
+        _TEMP_MAX_E(3);
1840
+      #endif
1841
+    #endif
1842
+
1843
+    #if HOTENDS > 4 && THERMISTOR_HEATER_4
1844
+      #ifdef HEATER_4_MINTEMP
1845
+        _TEMP_MIN_E(4);
1846
+      #endif
1847
+      #ifdef HEATER_4_MAXTEMP
1848
+        _TEMP_MAX_E(4);
1849
+      #endif
1850
+    #endif
1851
+
1852
+    #if HOTENDS > 5 && THERMISTOR_HEATER_5
1853
+      #ifdef HEATER_5_MINTEMP
1854
+        _TEMP_MIN_E(5);
1855
+      #endif
1856
+      #ifdef HEATER_5_MAXTEMP
1857
+        _TEMP_MAX_E(5);
1858
+      #endif
1859
+    #endif
1860
+
1861
+    #if HOTENDS > 6 && THERMISTOR_HEATER_6
1862
+      #ifdef HEATER_6_MINTEMP
1863
+        _TEMP_MIN_E(6);
1864
+      #endif
1865
+      #ifdef HEATER_6_MAXTEMP
1866
+        _TEMP_MAX_E(6);
1867
+      #endif
1868
+    #endif
1869
+
1870
+    #if HOTENDS > 7 && THERMISTOR_HEATER_7
1871
+      #ifdef HEATER_7_MINTEMP
1872
+        _TEMP_MIN_E(7);
1873
+      #endif
1874
+      #ifdef HEATER_7_MAXTEMP
1875
+        _TEMP_MAX_E(7);
1876
+      #endif
1877
+    #endif
1878
+
1879
+  #endif // HAS_HOTEND
1867 1880
 
1868 1881
   #if HAS_HEATED_BED
1869 1882
     #ifdef BED_MINTEMP
@@ -2319,7 +2332,7 @@ void Temperature::readings_ready() {
2319 2332
       }
2320 2333
     }
2321 2334
 
2322
-  #endif // HOTENDS
2335
+  #endif // HAS_HOTEND
2323 2336
 
2324 2337
   #if HAS_HEATED_BED
2325 2338
     #if TEMPDIR(BED) < 0
@@ -2573,6 +2586,10 @@ void Temperature::tick() {
2573 2586
         _SLOW_PWM(BED, soft_pwm_bed, temp_bed);
2574 2587
       #endif
2575 2588
 
2589
+      #if HAS_HEATED_CHAMBER
2590
+        _SLOW_PWM(CHAMBER, soft_pwm_chamber, temp_chamber);
2591
+      #endif
2592
+
2576 2593
     } // slow_pwm_count == 0
2577 2594
 
2578 2595
     #if HAS_HOTEND
@@ -2584,6 +2601,10 @@ void Temperature::tick() {
2584 2601
       _PWM_OFF(BED, soft_pwm_bed);
2585 2602
     #endif
2586 2603
 
2604
+    #if HAS_HEATED_CHAMBER
2605
+      _PWM_OFF(CHAMBER, soft_pwm_chamber);
2606
+    #endif
2607
+
2587 2608
     #if ENABLED(FAN_SOFT_PWM)
2588 2609
       if (pwm_count_tmp >= 127) {
2589 2610
         pwm_count_tmp = 0;
@@ -2662,6 +2683,7 @@ void Temperature::tick() {
2662 2683
         HOTEND_LOOP() soft_pwm_hotend[e].dec();
2663 2684
       #endif
2664 2685
       TERN_(HAS_HEATED_BED, soft_pwm_bed.dec());
2686
+      TERN_(HAS_HEATED_CHAMBER, soft_pwm_chamber.dec());
2665 2687
     }
2666 2688
 
2667 2689
   #endif // SLOW_PWM_HEATERS

+ 1
- 1
Marlin/src/module/temperature.h Переглянути файл

@@ -608,7 +608,7 @@ class Temperature {
608 608
         return ABS(degHotend(e) - temp) < (TEMP_HYSTERESIS);
609 609
       }
610 610
 
611
-    #endif // HOTENDS
611
+    #endif // HAS_HOTEND
612 612
 
613 613
     #if HAS_HEATED_BED
614 614
 

+ 1
- 1
Marlin/src/module/thermistor/thermistor_1.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // R25 = 100 kOhm, beta25 = 4092 K, 4.7 kOhm pull-up, bed thermistor
25
-const short temptable_1[][2] PROGMEM = {
25
+const temp_entry_t temptable_1[] PROGMEM = {
26 26
   { OV(  23), 300 },
27 27
   { OV(  25), 295 },
28 28
   { OV(  27), 290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_10.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // R25 = 100 kOhm, beta25 = 3960 K, 4.7 kOhm pull-up, RS thermistor 198-961
25
-const short temptable_10[][2] PROGMEM = {
25
+const temp_entry_t temptable_10[] PROGMEM = {
26 26
   { OV(   1), 929 },
27 27
   { OV(  36), 299 },
28 28
   { OV(  71), 246 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_1010.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // Pt1000 with 1k0 pullup
25
-const short temptable_1010[][2] PROGMEM = {
25
+const temp_entry_t temptable_1010[] PROGMEM = {
26 26
   PtLine(  0, 1000, 1000),
27 27
   PtLine( 25, 1000, 1000),
28 28
   PtLine( 50, 1000, 1000),

+ 1
- 1
Marlin/src/module/thermistor/thermistor_1047.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // Pt1000 with 4k7 pullup
25
-const short temptable_1047[][2] PROGMEM = {
25
+const temp_entry_t temptable_1047[] PROGMEM = {
26 26
   // only a few values are needed as the curve is very flat
27 27
   PtLine(  0, 1000, 4700),
28 28
   PtLine( 50, 1000, 4700),

+ 1
- 1
Marlin/src/module/thermistor/thermistor_11.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // R25 = 100 kOhm, beta25 = 3950 K, 4.7 kOhm pull-up, QU-BD silicone bed QWG-104F-3950 thermistor
25
-const short temptable_11[][2] PROGMEM = {
25
+const temp_entry_t temptable_11[] PROGMEM = {
26 26
   { OV(   1), 938 },
27 27
   { OV(  31), 314 },
28 28
   { OV(  41), 290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_110.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // Pt100 with 1k0 pullup
25
-const short temptable_110[][2] PROGMEM = {
25
+const temp_entry_t temptable_110[] PROGMEM = {
26 26
   // only a few values are needed as the curve is very flat
27 27
   PtLine(  0, 100, 1000),
28 28
   PtLine( 50, 100, 1000),

+ 1
- 1
Marlin/src/module/thermistor/thermistor_12.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // R25 = 100 kOhm, beta25 = 4700 K, 4.7 kOhm pull-up, (personal calibration for Makibox hot bed)
25
-const short temptable_12[][2] PROGMEM = {
25
+const temp_entry_t temptable_12[] PROGMEM = {
26 26
   { OV(  35), 180 }, // top rating 180C
27 27
   { OV( 211), 140 },
28 28
   { OV( 233), 135 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_13.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // R25 = 100 kOhm, beta25 = 4100 K, 4.7 kOhm pull-up, Hisens thermistor
25
-const short temptable_13[][2] PROGMEM = {
25
+const temp_entry_t temptable_13[] PROGMEM = {
26 26
   { OV( 20.04), 300 },
27 27
   { OV( 23.19), 290 },
28 28
   { OV( 26.71), 280 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_147.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // Pt100 with 4k7 pullup
25
-const short temptable_147[][2] PROGMEM = {
25
+const temp_entry_t temptable_147[] PROGMEM = {
26 26
   // only a few values are needed as the curve is very flat
27 27
   PtLine(  0, 100, 4700),
28 28
   PtLine( 50, 100, 4700),

+ 1
- 1
Marlin/src/module/thermistor/thermistor_15.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
  // 100k bed thermistor in JGAurora A5. Calibrated by Sam Pinches 21st Jan 2018 using cheap k-type thermocouple inserted into heater block, using TM-902C meter.
25
-const short temptable_15[][2] PROGMEM = {
25
+const temp_entry_t temptable_15[] PROGMEM = {
26 26
   { OV(  31), 275 },
27 27
   { OV(  33), 270 },
28 28
   { OV(  35), 260 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_18.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // ATC Semitec 204GT-2 (4.7k pullup) Dagoma.Fr - MKS_Base_DKU001327 - version (measured/tested/approved)
25
-const short temptable_18[][2] PROGMEM = {
25
+const temp_entry_t temptable_18[] PROGMEM = {
26 26
   { OV(   1), 713 },
27 27
   { OV(  17), 284 },
28 28
   { OV(  20), 275 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_2.h Переглянути файл

@@ -26,7 +26,7 @@
26 26
 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
27 27
 // Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance
28 28
 //
29
-const short temptable_2[][2] PROGMEM = {
29
+const temp_entry_t temptable_2[] PROGMEM = {
30 30
   { OV(   1), 848 },
31 31
   { OV(  30), 300 }, // top rating 300C
32 32
   { OV(  34), 290 },

+ 2
- 2
Marlin/src/module/thermistor/thermistor_20.h Переглянути файл

@@ -21,10 +21,10 @@
21 21
  */
22 22
 #pragma once
23 23
 
24
-#define REVERSE_TEMP_SENSOR_RANGE
24
+#define REVERSE_TEMP_SENSOR_RANGE_20 1
25 25
 
26 26
 // Pt100 with INA826 amp on Ultimaker v2.0 electronics
27
-const short temptable_20[][2] PROGMEM = {
27
+const temp_entry_t temptable_20[] PROGMEM = {
28 28
   { OV(  0),    0 },
29 29
   { OV(227),    1 },
30 30
   { OV(236),   10 },

+ 2
- 2
Marlin/src/module/thermistor/thermistor_201.h Переглянути файл

@@ -21,10 +21,10 @@
21 21
  */
22 22
 #pragma once
23 23
 
24
-#define REVERSE_TEMP_SENSOR_RANGE
24
+#define REVERSE_TEMP_SENSOR_RANGE_201 1
25 25
 
26 26
 // Pt100 with LMV324 amp on Overlord v1.1 electronics
27
-const short temptable_201[][2] PROGMEM = {
27
+const temp_entry_t temptable_201[] PROGMEM = {
28 28
   { OV(   0),   0 },
29 29
   { OV(   8),   1 },
30 30
   { OV(  23),   6 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_202.h Переглянути файл

@@ -3,7 +3,7 @@
3 3
 // Temptable sent from dealer technologyoutlet.co.uk
4 4
 //
5 5
 
6
-const short temptable_202[][2] PROGMEM = {
6
+const temp_entry_t temptable_202[] PROGMEM = {
7 7
   { OV(   1), 864 },
8 8
   { OV(  35), 300 },
9 9
   { OV(  38), 295 },

+ 2
- 2
Marlin/src/module/thermistor/thermistor_21.h Переглянути файл

@@ -21,13 +21,13 @@
21 21
  */
22 22
 #pragma once
23 23
 
24
-#define REVERSE_TEMP_SENSOR_RANGE
24
+#define REVERSE_TEMP_SENSOR_RANGE_21 1
25 25
 
26 26
 #undef OV_SCALE
27 27
 #define OV_SCALE(N) (float((N) * 5) / 3.3f)
28 28
 
29 29
 // Pt100 with INA826 amp with 3.3v excitation based on "Pt100 with INA826 amp on Ultimaker v2.0 electronics"
30
-const short temptable_21[][2] PROGMEM = {
30
+const temp_entry_t temptable_21[] PROGMEM = {
31 31
   { OV(  0),    0 },
32 32
   { OV(227),    1 },
33 33
   { OV(236),   10 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_22.h Переглянути файл

@@ -21,7 +21,7 @@
21 21
  */
22 22
 
23 23
 // 100k hotend thermistor with 4.7k pull up to 3.3v and 220R to analog input as in GTM32 Pro vB
24
-const short temptable_22[][2] PROGMEM = {
24
+const temp_entry_t temptable_22[] PROGMEM = {
25 25
   { OV(   1), 352 },
26 26
   { OV(   6), 341 },
27 27
   { OV(  11), 330 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_23.h Переглянути файл

@@ -21,7 +21,7 @@
21 21
  */
22 22
 
23 23
 // 100k hotbed thermistor with 4.7k pull up to 3.3v and 220R to analog input as in GTM32 Pro vB
24
-const short temptable_23[][2] PROGMEM = {
24
+const temp_entry_t temptable_23[] PROGMEM = {
25 25
   { OV(   1), 938 },
26 26
   { OV(  11), 423 },
27 27
   { OV(  21), 351 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_3.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // R25 = 100 kOhm, beta25 = 4120 K, 4.7 kOhm pull-up, mendel-parts
25
-const short temptable_3[][2] PROGMEM = {
25
+const temp_entry_t temptable_3[] PROGMEM = {
26 26
   { OV(   1), 864 },
27 27
   { OV(  21), 300 },
28 28
   { OV(  25), 290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_331.h Переглянути файл

@@ -24,7 +24,7 @@
24 24
 #define OVM(V) OV((V)*(0.327/0.5))
25 25
 
26 26
 // R25 = 100 kOhm, beta25 = 4092 K, 4.7 kOhm pull-up, bed thermistor
27
-const short temptable_331[][2] PROGMEM = {
27
+const temp_entry_t temptable_331[] PROGMEM = {
28 28
   { OVM(  23), 300 },
29 29
   { OVM(  25), 295 },
30 30
   { OVM(  27), 290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_332.h Переглянути файл

@@ -24,7 +24,7 @@
24 24
 #define OVM(V) OV((V)*(0.327/0.327))
25 25
 
26 26
 // R25 = 100 kOhm, beta25 = 4092 K, 4.7 kOhm pull-up, bed thermistor
27
-const short temptable_332[][2] PROGMEM = {
27
+const temp_entry_t temptable_332[] PROGMEM = {
28 28
   { OVM( 268), 150 },
29 29
   { OVM( 293), 145 },
30 30
   { OVM( 320), 141 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_4.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // R25 = 10 kOhm, beta25 = 3950 K, 4.7 kOhm pull-up, Generic 10k thermistor
25
-const short temptable_4[][2] PROGMEM = {
25
+const temp_entry_t temptable_4[] PROGMEM = {
26 26
   { OV(   1), 430 },
27 27
   { OV(  54), 137 },
28 28
   { OV( 107), 107 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_5.h Переглянути файл

@@ -26,7 +26,7 @@
26 26
 // ATC Semitec 104GT-2/104NT-4-R025H42G (Used in ParCan)
27 27
 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
28 28
 // Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance
29
-const short temptable_5[][2] PROGMEM = {
29
+const temp_entry_t temptable_5[] PROGMEM = {
30 30
   { OV(   1), 713 },
31 31
   { OV(  17), 300 }, // top rating 300C
32 32
   { OV(  20), 290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_501.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // 100k Zonestar thermistor. Adjusted By Hally
25
-const short temptable_501[][2] PROGMEM = {
25
+const temp_entry_t temptable_501[] PROGMEM = {
26 26
    { OV(   1), 713 },
27 27
    { OV(  14), 300 }, // Top rating 300C
28 28
    { OV(  16), 290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_502.h Переглянути файл

@@ -23,7 +23,7 @@
23 23
 
24 24
 // Unknown thermistor for the Zonestar P802M hot bed. Adjusted By Nerseth
25 25
 // These were the shipped settings from Zonestar in original firmware: P802M_8_Repetier_V1.6_Zonestar.zip
26
-const short temptable_502[][2] PROGMEM = {
26
+const temp_entry_t temptable_502[] PROGMEM = {
27 27
    { OV(  56.0 / 4), 300 },
28 28
    { OV( 187.0 / 4), 250 },
29 29
    { OV( 615.0 / 4), 190 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_51.h Переглянути файл

@@ -26,7 +26,7 @@
26 26
 // Verified by linagee.
27 27
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
28 28
 // Advantage: Twice the resolution and better linearity from 150C to 200C
29
-const short temptable_51[][2] PROGMEM = {
29
+const temp_entry_t temptable_51[] PROGMEM = {
30 30
   { OV(   1), 350 },
31 31
   { OV( 190), 250 }, // top rating 250C
32 32
   { OV( 203), 245 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_512.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 
23 23
 // 100k thermistor supplied with RPW-Ultra hotend, 4.7k pullup
24 24
 
25
-const short temptable_512[][2] PROGMEM = {
25
+const temp_entry_t temptable_512[] PROGMEM = {
26 26
   { OV(26),  300 },
27 27
   { OV(28),  295 },
28 28
   { OV(30),  290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_52.h Переглянути файл

@@ -26,7 +26,7 @@
26 26
 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
27 27
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
28 28
 // Advantage: More resolution and better linearity from 150C to 200C
29
-const short temptable_52[][2] PROGMEM = {
29
+const temp_entry_t temptable_52[] PROGMEM = {
30 30
   { OV(   1), 500 },
31 31
   { OV( 125), 300 }, // top rating 300C
32 32
   { OV( 142), 290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_55.h Переглянути файл

@@ -26,7 +26,7 @@
26 26
 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
27 27
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
28 28
 // Advantage: More resolution and better linearity from 150C to 200C
29
-const short temptable_55[][2] PROGMEM = {
29
+const temp_entry_t temptable_55[] PROGMEM = {
30 30
   { OV(   1), 500 },
31 31
   { OV(  76), 300 },
32 32
   { OV(  87), 290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_6.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // R25 = 100 kOhm, beta25 = 4092 K, 8.2 kOhm pull-up, 100k Epcos (?) thermistor
25
-const short temptable_6[][2] PROGMEM = {
25
+const temp_entry_t temptable_6[] PROGMEM = {
26 26
   { OV(   1), 350 },
27 27
   { OV(  28), 250 }, // top rating 250C
28 28
   { OV(  31), 245 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_60.h Переглянути файл

@@ -31,7 +31,7 @@
31 31
 // beta: 3950
32 32
 // min adc: 1 at 0.0048828125 V
33 33
 // max adc: 1023 at 4.9951171875 V
34
-const short temptable_60[][2] PROGMEM = {
34
+const temp_entry_t temptable_60[] PROGMEM = {
35 35
   { OV(  51), 272 },
36 36
   { OV(  61), 258 },
37 37
   { OV(  71), 247 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_61.h Переглянути файл

@@ -30,7 +30,7 @@
30 30
 // Resistance Tolerance     + / -1%
31 31
 // B Value             3950K at 25/50 deg. C
32 32
 // B Value Tolerance         + / - 1%
33
-const short temptable_61[][2] PROGMEM = {
33
+const temp_entry_t temptable_61[] PROGMEM = {
34 34
   { OV(   2.00), 420 }, // Guestimate to ensure we dont lose a reading and drop temps to -50 when over
35 35
   { OV(  12.07), 350 },
36 36
   { OV(  12.79), 345 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_66.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // R25 = 2.5 MOhm, beta25 = 4500 K, 4.7 kOhm pull-up, DyzeDesign 500 °C Thermistor
25
-const short temptable_66[][2] PROGMEM = {
25
+const temp_entry_t temptable_66[] PROGMEM = {
26 26
   { OV(  17.5), 850 },
27 27
   { OV(  17.9), 500 },
28 28
   { OV(  21.7), 480 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_67.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // R25 = 500 KOhm, beta25 = 3800 K, 4.7 kOhm pull-up, SliceEngineering 450 °C Thermistor
25
-const short temptable_67[][2] PROGMEM = {
25
+const temp_entry_t temptable_67[] PROGMEM = {
26 26
   { OV(  22 ),  500 },
27 27
   { OV(  23 ),  490 },
28 28
   { OV(  25 ),  480 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_7.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // R25 = 100 kOhm, beta25 = 3974 K, 4.7 kOhm pull-up, Honeywell 135-104LAG-J01
25
-const short temptable_7[][2] PROGMEM = {
25
+const temp_entry_t temptable_7[] PROGMEM = {
26 26
   { OV(   1), 941 },
27 27
   { OV(  19), 362 },
28 28
   { OV(  37), 299 }, // top rating 300C

+ 1
- 1
Marlin/src/module/thermistor/thermistor_70.h Переглянути файл

@@ -26,7 +26,7 @@
26 26
 // ANENG AN8009 DMM with a K-type probe used for measurements.
27 27
 
28 28
 // R25 = 100 kOhm, beta25 = 4100 K, 4.7 kOhm pull-up, bqh2 stock thermistor
29
-const short temptable_70[][2] PROGMEM = {
29
+const temp_entry_t temptable_70[] PROGMEM = {
30 30
   { OV(  18), 270 },
31 31
   { OV(  27), 248 },
32 32
   { OV(  34), 234 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_71.h Переглянути файл

@@ -27,7 +27,7 @@
27 27
 // Beta = 3974
28 28
 // R1 = 0 Ohm
29 29
 // R2 = 4700 Ohm
30
-const short temptable_71[][2] PROGMEM = {
30
+const temp_entry_t temptable_71[] PROGMEM = {
31 31
   { OV(  35), 300 },
32 32
   { OV(  51), 269 },
33 33
   { OV(  59), 258 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_75.h Переглянути файл

@@ -34,7 +34,7 @@
34 34
 
35 35
 //#define HIGH_TEMP_RANGE_75
36 36
 
37
-const short temptable_75[][2] PROGMEM = { // Generic Silicon Heat Pad with NTC 100K MGB18-104F39050L32 thermistor
37
+const temp_entry_t temptable_75[] PROGMEM = { // Generic Silicon Heat Pad with NTC 100K MGB18-104F39050L32 thermistor
38 38
   { OV(111.06), 200 }, // v=0.542 r=571.747 res=0.501 degC/count
39 39
 
40 40
   #ifdef HIGH_TEMP_RANGE_75

+ 1
- 1
Marlin/src/module/thermistor/thermistor_8.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // R25 = 100 kOhm, beta25 = 3950 K, 10 kOhm pull-up, NTCS0603E3104FHT
25
-const short temptable_8[][2] PROGMEM = {
25
+const temp_entry_t temptable_8[] PROGMEM = {
26 26
   { OV(   1), 704 },
27 27
   { OV(  54), 216 },
28 28
   { OV( 107), 175 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_9.h Переглянути файл

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 // R25 = 100 kOhm, beta25 = 3960 K, 4.7 kOhm pull-up, GE Sensing AL03006-58.2K-97-G1
25
-const short temptable_9[][2] PROGMEM = {
25
+const temp_entry_t temptable_9[] PROGMEM = {
26 26
   { OV(   1), 936 },
27 27
   { OV(  36), 300 },
28 28
   { OV(  71), 246 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_99.h Переглянути файл

@@ -24,7 +24,7 @@
24 24
 
25 25
 // 100k bed thermistor with a 10K pull-up resistor - made by $ buildroot/share/scripts/createTemperatureLookupMarlin.py --rp=10000
26 26
 
27
-const short temptable_99[][2] PROGMEM = {
27
+const temp_entry_t temptable_99[] PROGMEM = {
28 28
   { OV(  5.81), 350 }, // v=0.028   r=    57.081  res=13.433 degC/count
29 29
   { OV(  6.54), 340 }, // v=0.032   r=    64.248  res=11.711 degC/count
30 30
   { OV(  7.38), 330 }, // v=0.036   r=    72.588  res=10.161 degC/count

+ 1
- 1
Marlin/src/module/thermistor/thermistor_998.h Переглянути файл

@@ -27,7 +27,7 @@
27 27
   #define DUMMY_THERMISTOR_998_VALUE 25
28 28
 #endif
29 29
 
30
-const short temptable_998[][2] PROGMEM = {
30
+const temp_entry_t temptable_998[] PROGMEM = {
31 31
   { OV(   1), DUMMY_THERMISTOR_998_VALUE },
32 32
   { OV(1023), DUMMY_THERMISTOR_998_VALUE }
33 33
 };

+ 1
- 1
Marlin/src/module/thermistor/thermistor_999.h Переглянути файл

@@ -27,7 +27,7 @@
27 27
   #define DUMMY_THERMISTOR_999_VALUE 25
28 28
 #endif
29 29
 
30
-const short temptable_999[][2] PROGMEM = {
30
+const temp_entry_t temptable_999[] PROGMEM = {
31 31
   { OV(   1), DUMMY_THERMISTOR_999_VALUE },
32 32
   { OV(1023), DUMMY_THERMISTOR_999_VALUE }
33 33
 };

+ 106
- 13
Marlin/src/module/thermistor/thermistors.h Переглянути файл

@@ -42,6 +42,8 @@
42 42
 
43 43
 #define ANY_THERMISTOR_IS(n) (THERMISTOR_HEATER_0 == n || THERMISTOR_HEATER_1 == n || THERMISTOR_HEATER_2 == n || THERMISTOR_HEATER_3 == n || THERMISTOR_HEATER_4 == n || THERMISTOR_HEATER_5 == n || THERMISTOR_HEATER_6 == n || THERMISTOR_HEATER_7 == n || THERMISTORBED == n || THERMISTORCHAMBER == n || THERMISTORPROBE == n)
44 44
 
45
+typedef struct { int16_t value, celsius; } temp_entry_t;
46
+
45 47
 // Pt1000 and Pt100 handling
46 48
 //
47 49
 // Rt=R0*(1+a*T+b*T*T) [for T>0]
@@ -185,12 +187,13 @@
185 187
   #include "thermistor_999.h"
186 188
 #endif
187 189
 #if ANY_THERMISTOR_IS(1000) // Custom
188
-  const short temptable_1000[][2] PROGMEM = { { 0, 0 } };
190
+  const temp_entry_t temptable_1000[] PROGMEM = { { 0, 0 } };
189 191
 #endif
190 192
 
191 193
 #define _TT_NAME(_N) temptable_ ## _N
192 194
 #define TT_NAME(_N) _TT_NAME(_N)
193 195
 
196
+
194 197
 #if THERMISTOR_HEATER_0
195 198
   #define HEATER_0_TEMPTABLE TT_NAME(THERMISTOR_HEATER_0)
196 199
   #define HEATER_0_TEMPTABLE_LEN COUNT(HEATER_0_TEMPTABLE)
@@ -288,9 +291,12 @@
288 291
 #else
289 292
   #define CHAMBER_TEMPTABLE_LEN 0
290 293
 #endif
294
+
291 295
 #ifdef THERMISTORPROBE
292 296
   #define PROBE_TEMPTABLE TT_NAME(THERMISTORPROBE)
293 297
   #define PROBE_TEMPTABLE_LEN COUNT(PROBE_TEMPTABLE)
298
+#elif defined(HEATER_PROBE_USES_THERMISTOR)
299
+  #error "No probe thermistor table specified"
294 300
 #else
295 301
   #define PROBE_TEMPTABLE_LEN 0
296 302
 #endif
@@ -300,7 +306,7 @@ static_assert(
300 306
      HEATER_0_TEMPTABLE_LEN < 256 && HEATER_1_TEMPTABLE_LEN < 256
301 307
   && HEATER_2_TEMPTABLE_LEN < 256 && HEATER_3_TEMPTABLE_LEN < 256
302 308
   && HEATER_4_TEMPTABLE_LEN < 256 && HEATER_5_TEMPTABLE_LEN < 256
303
-  && HEATER_6_TEMPTABLE_LEN < 258 && HEATER_7_TEMPTABLE_LEN < 258
309
+  && HEATER_6_TEMPTABLE_LEN < 256 && HEATER_7_TEMPTABLE_LEN < 256
304 310
   &&      BED_TEMPTABLE_LEN < 256 &&  CHAMBER_TEMPTABLE_LEN < 256
305 311
   &&    PROBE_TEMPTABLE_LEN < 256,
306 312
   "Temperature conversion tables over 255 entries need special consideration."
@@ -309,8 +315,85 @@ static_assert(
309 315
 // Set the high and low raw values for the heaters
310 316
 // For thermistors the highest temperature results in the lowest ADC value
311 317
 // For thermocouples the highest temperature results in the highest ADC value
318
+
319
+#define _TT_REV(N) REVERSE_TEMP_SENSOR_RANGE_##N
320
+#define TT_REV(N) _TT_REV(N)
321
+
322
+#ifdef HEATER_0_TEMPTABLE
323
+  #if TT_REV(THERMISTOR_HEATER_0)
324
+    #define HEATER_0_SENSOR_MINTEMP_IND 0
325
+    #define HEATER_0_SENSOR_MAXTEMP_IND HEATER_0_TEMPTABLE_LEN - 1
326
+  #else
327
+    #define HEATER_0_SENSOR_MINTEMP_IND HEATER_0_TEMPTABLE_LEN - 1
328
+    #define HEATER_0_SENSOR_MAXTEMP_IND 0
329
+  #endif
330
+#endif
331
+#ifdef HEATER_1_TEMPTABLE
332
+  #if TT_REV(THERMISTOR_HEATER_1)
333
+    #define HEATER_1_SENSOR_MINTEMP_IND 0
334
+    #define HEATER_1_SENSOR_MAXTEMP_IND HEATER_1_TEMPTABLE_LEN - 1
335
+  #else
336
+    #define HEATER_1_SENSOR_MINTEMP_IND HEATER_1_TEMPTABLE_LEN - 1
337
+    #define HEATER_1_SENSOR_MAXTEMP_IND 0
338
+  #endif
339
+#endif
340
+#ifdef HEATER_2_TEMPTABLE
341
+  #if TT_REV(THERMISTOR_HEATER_2)
342
+    #define HEATER_2_SENSOR_MINTEMP_IND 0
343
+    #define HEATER_2_SENSOR_MAXTEMP_IND HEATER_2_TEMPTABLE_LEN - 1
344
+  #else
345
+    #define HEATER_2_SENSOR_MINTEMP_IND HEATER_2_TEMPTABLE_LEN - 1
346
+    #define HEATER_2_SENSOR_MAXTEMP_IND 0
347
+  #endif
348
+#endif
349
+#ifdef HEATER_3_TEMPTABLE
350
+  #if TT_REV(THERMISTOR_HEATER_3)
351
+    #define HEATER_3_SENSOR_MINTEMP_IND 0
352
+    #define HEATER_3_SENSOR_MAXTEMP_IND HEATER_3_TEMPTABLE_LEN - 1
353
+  #else
354
+    #define HEATER_3_SENSOR_MINTEMP_IND HEATER_3_TEMPTABLE_LEN - 1
355
+    #define HEATER_3_SENSOR_MAXTEMP_IND 0
356
+  #endif
357
+#endif
358
+#ifdef HEATER_4_TEMPTABLE
359
+  #if TT_REV(THERMISTOR_HEATER_4)
360
+    #define HEATER_4_SENSOR_MINTEMP_IND 0
361
+    #define HEATER_4_SENSOR_MAXTEMP_IND HEATER_4_TEMPTABLE_LEN - 1
362
+  #else
363
+    #define HEATER_4_SENSOR_MINTEMP_IND HEATER_4_TEMPTABLE_LEN - 1
364
+    #define HEATER_4_SENSOR_MAXTEMP_IND 0
365
+  #endif
366
+#endif
367
+#ifdef HEATER_5_TEMPTABLE
368
+  #if TT_REV(THERMISTOR_HEATER_5)
369
+    #define HEATER_5_SENSOR_MINTEMP_IND 0
370
+    #define HEATER_5_SENSOR_MAXTEMP_IND HEATER_5_TEMPTABLE_LEN - 1
371
+  #else
372
+    #define HEATER_5_SENSOR_MINTEMP_IND HEATER_5_TEMPTABLE_LEN - 1
373
+    #define HEATER_5_SENSOR_MAXTEMP_IND 0
374
+  #endif
375
+#endif
376
+#ifdef HEATER_6_TEMPTABLE
377
+  #if TT_REV(THERMISTOR_HEATER_6)
378
+    #define HEATER_6_SENSOR_MINTEMP_IND 0
379
+    #define HEATER_6_SENSOR_MAXTEMP_IND HEATER_6_TEMPTABLE_LEN - 1
380
+  #else
381
+    #define HEATER_6_SENSOR_MINTEMP_IND HEATER_6_TEMPTABLE_LEN - 1
382
+    #define HEATER_6_SENSOR_MAXTEMP_IND 0
383
+  #endif
384
+#endif
385
+#ifdef HEATER_7_TEMPTABLE
386
+  #if TT_REV(THERMISTOR_HEATER_7)
387
+    #define HEATER_7_SENSOR_MINTEMP_IND 0
388
+    #define HEATER_7_SENSOR_MAXTEMP_IND HEATER_7_TEMPTABLE_LEN - 1
389
+  #else
390
+    #define HEATER_7_SENSOR_MINTEMP_IND HEATER_7_TEMPTABLE_LEN - 1
391
+    #define HEATER_7_SENSOR_MAXTEMP_IND 0
392
+  #endif
393
+#endif
394
+
312 395
 #ifndef HEATER_0_RAW_HI_TEMP
313
-  #if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_0_USES_THERMISTOR)
396
+  #if TT_REV(THERMISTOR_HEATER_0) || !defined(HEATER_0_USES_THERMISTOR)
314 397
     #define HEATER_0_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
315 398
     #define HEATER_0_RAW_LO_TEMP 0
316 399
   #else
@@ -319,7 +402,7 @@ static_assert(
319 402
   #endif
320 403
 #endif
321 404
 #ifndef HEATER_1_RAW_HI_TEMP
322
-  #if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_1_USES_THERMISTOR)
405
+  #if TT_REV(THERMISTOR_HEATER_1) || !defined(HEATER_1_USES_THERMISTOR)
323 406
     #define HEATER_1_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
324 407
     #define HEATER_1_RAW_LO_TEMP 0
325 408
   #else
@@ -328,7 +411,7 @@ static_assert(
328 411
   #endif
329 412
 #endif
330 413
 #ifndef HEATER_2_RAW_HI_TEMP
331
-  #if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_2_USES_THERMISTOR)
414
+  #if TT_REV(THERMISTOR_HEATER_2) || !defined(HEATER_2_USES_THERMISTOR)
332 415
     #define HEATER_2_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
333 416
     #define HEATER_2_RAW_LO_TEMP 0
334 417
   #else
@@ -337,7 +420,7 @@ static_assert(
337 420
   #endif
338 421
 #endif
339 422
 #ifndef HEATER_3_RAW_HI_TEMP
340
-  #if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_3_USES_THERMISTOR)
423
+  #if TT_REV(THERMISTOR_HEATER_3) || !defined(HEATER_3_USES_THERMISTOR)
341 424
     #define HEATER_3_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
342 425
     #define HEATER_3_RAW_LO_TEMP 0
343 426
   #else
@@ -346,7 +429,7 @@ static_assert(
346 429
   #endif
347 430
 #endif
348 431
 #ifndef HEATER_4_RAW_HI_TEMP
349
-  #if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_4_USES_THERMISTOR)
432
+  #if TT_REV(THERMISTOR_HEATER_4) || !defined(HEATER_4_USES_THERMISTOR)
350 433
     #define HEATER_4_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
351 434
     #define HEATER_4_RAW_LO_TEMP 0
352 435
   #else
@@ -355,7 +438,7 @@ static_assert(
355 438
   #endif
356 439
 #endif
357 440
 #ifndef HEATER_5_RAW_HI_TEMP
358
-  #if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_5_USES_THERMISTOR)
441
+  #if TT_REV(THERMISTOR_HEATER_5) || !defined(HEATER_5_USES_THERMISTOR)
359 442
     #define HEATER_5_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
360 443
     #define HEATER_5_RAW_LO_TEMP 0
361 444
   #else
@@ -364,7 +447,7 @@ static_assert(
364 447
   #endif
365 448
 #endif
366 449
 #ifndef HEATER_6_RAW_HI_TEMP
367
-  #if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_6_USES_THERMISTOR)
450
+  #if TT_REV(THERMISTOR_HEATER_6) || !defined(HEATER_6_USES_THERMISTOR)
368 451
     #define HEATER_6_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
369 452
     #define HEATER_6_RAW_LO_TEMP 0
370 453
   #else
@@ -373,7 +456,7 @@ static_assert(
373 456
   #endif
374 457
 #endif
375 458
 #ifndef HEATER_7_RAW_HI_TEMP
376
-  #if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_7_USES_THERMISTOR)
459
+  #if TT_REV(THERMISTOR_HEATER_7) || !defined(HEATER_7_USES_THERMISTOR)
377 460
     #define HEATER_7_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
378 461
     #define HEATER_7_RAW_LO_TEMP 0
379 462
   #else
@@ -382,7 +465,7 @@ static_assert(
382 465
   #endif
383 466
 #endif
384 467
 #ifndef HEATER_BED_RAW_HI_TEMP
385
-  #if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_BED_USES_THERMISTOR)
468
+  #if TT_REV(THERMISTORBED) || !defined(HEATER_BED_USES_THERMISTOR)
386 469
     #define HEATER_BED_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
387 470
     #define HEATER_BED_RAW_LO_TEMP 0
388 471
   #else
@@ -391,7 +474,7 @@ static_assert(
391 474
   #endif
392 475
 #endif
393 476
 #ifndef HEATER_CHAMBER_RAW_HI_TEMP
394
-  #if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_CHAMBER_USES_THERMISTOR)
477
+  #if TT_REV(THERMISTORCHAMBER) || !defined(HEATER_CHAMBER_USES_THERMISTOR)
395 478
     #define HEATER_CHAMBER_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
396 479
     #define HEATER_CHAMBER_RAW_LO_TEMP 0
397 480
   #else
@@ -399,5 +482,15 @@ static_assert(
399 482
     #define HEATER_CHAMBER_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
400 483
   #endif
401 484
 #endif
485
+#ifndef HEATER_PROBE_RAW_HI_TEMP
486
+  #if TT_REV(THERMISTORPROBE) || !defined(HEATER_PROBE_USES_THERMISTOR)
487
+    #define HEATER_PROBE_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
488
+    #define HEATER_PROBE_RAW_LO_TEMP 0
489
+  #else
490
+    #define HEATER_PROBE_RAW_HI_TEMP 0
491
+    #define HEATER_PROBE_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
492
+  #endif
493
+#endif
402 494
 
403
-#undef REVERSE_TEMP_SENSOR_RANGE
495
+#undef _TT_REV
496
+#undef TT_REV

Завантаження…
Відмінити
Зберегти