123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 |
- #ifndef THERMISTORTABLES_H_
- #define THERMISTORTABLES_H_
- #include "Marlin.h"
- #include "macros.h"
- #define OVERSAMPLENR 16
- #define OV(N) int16_t((N)*(OVERSAMPLENR))
- #define ANY_THERMISTOR_IS(n) (THERMISTORHEATER_0 == n || THERMISTORHEATER_1 == n || THERMISTORHEATER_2 == n || THERMISTORHEATER_3 == n || THERMISTORHEATER_4 == n || THERMISTORBED == n || THERMISTORCHAMBER == n)
- #define PtA 3.9083E-3
- #define PtB -5.775E-7
- #define PtRt(T,R0) ((R0)*(1.0+(PtA)*(T)+(PtB)*(T)*(T)))
- #define PtAdVal(T,R0,Rup) (short)(1024/(Rup/PtRt(T,R0)+1))
- #define PtLine(T,R0,Rup) { OV(PtAdVal(T,R0,Rup)), T },
- #if ANY_THERMISTOR_IS(1)
- #include "thermistortable_1.h"
- #endif
- #if ANY_THERMISTOR_IS(2)
- #include "thermistortable_2.h"
- #endif
- #if ANY_THERMISTOR_IS(3)
- #include "thermistortable_3.h"
- #endif
- #if ANY_THERMISTOR_IS(4)
- #include "thermistortable_4.h"
- #endif
- #if ANY_THERMISTOR_IS(5)
- #include "thermistortable_5.h"
- #endif
- #if ANY_THERMISTOR_IS(501)
- #include "thermistortable_501.h"
- #endif
- #if ANY_THERMISTOR_IS(6)
- #include "thermistortable_6.h"
- #endif
- #if ANY_THERMISTOR_IS(7)
- #include "thermistortable_7.h"
- #endif
- #if ANY_THERMISTOR_IS(71)
- #include "thermistortable_71.h"
- #endif
- #if ANY_THERMISTOR_IS(8)
- #include "thermistortable_8.h"
- #endif
- #if ANY_THERMISTOR_IS(9)
- #include "thermistortable_9.h"
- #endif
- #if ANY_THERMISTOR_IS(10)
- #include "thermistortable_10.h"
- #endif
- #if ANY_THERMISTOR_IS(11)
- #include "thermistortable_11.h"
- #endif
- #if ANY_THERMISTOR_IS(13)
- #include "thermistortable_13.h"
- #endif
- #if ANY_THERMISTOR_IS(15)
- #include "thermistortable_15.h"
- #endif
- #if ANY_THERMISTOR_IS(20)
- #include "thermistortable_20.h"
- #endif
- #if ANY_THERMISTOR_IS(51)
- #include "thermistortable_51.h"
- #endif
- #if ANY_THERMISTOR_IS(52)
- #include "thermistortable_52.h"
- #endif
- #if ANY_THERMISTOR_IS(55)
- #include "thermistortable_55.h"
- #endif
- #if ANY_THERMISTOR_IS(60)
- #include "thermistortable_60.h"
- #endif
- #if ANY_THERMISTOR_IS(66)
- #include "thermistortable_66.h"
- #endif
- #if ANY_THERMISTOR_IS(12)
- #include "thermistortable_12.h"
- #endif
- #if ANY_THERMISTOR_IS(70)
- #include "thermistortable_70.h"
- #endif
- #if ANY_THERMISTOR_IS(75)
- #include "thermistortable_75.h"
- #endif
- #if ANY_THERMISTOR_IS(110)
- #include "thermistortable_110.h"
- #endif
- #if ANY_THERMISTOR_IS(147)
- #include "thermistortable_147.h"
- #endif
- #if ANY_THERMISTOR_IS(1010)
- #include "thermistortable_1010.h"
- #endif
- #if ANY_THERMISTOR_IS(1047)
- #include "thermistortable_1047.h"
- #endif
- #if ANY_THERMISTOR_IS(998)
- #include "thermistortable_998.h"
- #endif
- #if ANY_THERMISTOR_IS(999)
- #include "thermistortable_999.h"
- #endif
- #define _TT_NAME(_N) temptable_ ## _N
- #define TT_NAME(_N) _TT_NAME(_N)
- #if THERMISTORHEATER_0
- #define HEATER_0_TEMPTABLE TT_NAME(THERMISTORHEATER_0)
- #define HEATER_0_TEMPTABLE_LEN COUNT(HEATER_0_TEMPTABLE)
- #elif defined(HEATER_0_USES_THERMISTOR)
- #error "No heater 0 thermistor table specified"
- #else
- #define HEATER_0_TEMPTABLE NULL
- #define HEATER_0_TEMPTABLE_LEN 0
- #endif
- #if THERMISTORHEATER_1
- #define HEATER_1_TEMPTABLE TT_NAME(THERMISTORHEATER_1)
- #define HEATER_1_TEMPTABLE_LEN COUNT(HEATER_1_TEMPTABLE)
- #elif defined(HEATER_1_USES_THERMISTOR)
- #error "No heater 1 thermistor table specified"
- #else
- #define HEATER_1_TEMPTABLE NULL
- #define HEATER_1_TEMPTABLE_LEN 0
- #endif
- #if THERMISTORHEATER_2
- #define HEATER_2_TEMPTABLE TT_NAME(THERMISTORHEATER_2)
- #define HEATER_2_TEMPTABLE_LEN COUNT(HEATER_2_TEMPTABLE)
- #elif defined(HEATER_2_USES_THERMISTOR)
- #error "No heater 2 thermistor table specified"
- #else
- #define HEATER_2_TEMPTABLE NULL
- #define HEATER_2_TEMPTABLE_LEN 0
- #endif
- #if THERMISTORHEATER_3
- #define HEATER_3_TEMPTABLE TT_NAME(THERMISTORHEATER_3)
- #define HEATER_3_TEMPTABLE_LEN COUNT(HEATER_3_TEMPTABLE)
- #elif defined(HEATER_3_USES_THERMISTOR)
- #error "No heater 3 thermistor table specified"
- #else
- #define HEATER_3_TEMPTABLE NULL
- #define HEATER_3_TEMPTABLE_LEN 0
- #endif
- #if THERMISTORHEATER_4
- #define HEATER_4_TEMPTABLE TT_NAME(THERMISTORHEATER_4)
- #define HEATER_4_TEMPTABLE_LEN COUNT(HEATER_4_TEMPTABLE)
- #elif defined(HEATER_4_USES_THERMISTOR)
- #error "No heater 4 thermistor table specified"
- #else
- #define HEATER_4_TEMPTABLE NULL
- #define HEATER_4_TEMPTABLE_LEN 0
- #endif
- #ifdef THERMISTORBED
- #define BEDTEMPTABLE TT_NAME(THERMISTORBED)
- #define BEDTEMPTABLE_LEN COUNT(BEDTEMPTABLE)
- #elif defined(HEATER_BED_USES_THERMISTOR)
- #error "No bed thermistor table specified"
- #else
- #define BEDTEMPTABLE_LEN 0
- #endif
- #ifdef THERMISTORCHAMBER
- #define CHAMBERTEMPTABLE TT_NAME(THERMISTORCHAMBER)
- #define CHAMBERTEMPTABLE_LEN COUNT(CHAMBERTEMPTABLE)
- #elif defined(HEATER_CHAMBER_USES_THERMISTOR)
- #error "No chamber thermistor table specified"
- #else
- #define CHAMBERTEMPTABLE_LEN 0
- #endif
- 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,
- "Temperature conversion tables over 255 entries need special consideration."
- );
- #ifndef HEATER_0_RAW_HI_TEMP
- #ifdef HEATER_0_USES_THERMISTOR
- #define HEATER_0_RAW_HI_TEMP 0
- #define HEATER_0_RAW_LO_TEMP 16383
- #else
- #define HEATER_0_RAW_HI_TEMP 16383
- #define HEATER_0_RAW_LO_TEMP 0
- #endif
- #endif
- #ifndef HEATER_1_RAW_HI_TEMP
- #ifdef HEATER_1_USES_THERMISTOR
- #define HEATER_1_RAW_HI_TEMP 0
- #define HEATER_1_RAW_LO_TEMP 16383
- #else
- #define HEATER_1_RAW_HI_TEMP 16383
- #define HEATER_1_RAW_LO_TEMP 0
- #endif
- #endif
- #ifndef HEATER_2_RAW_HI_TEMP
- #ifdef HEATER_2_USES_THERMISTOR
- #define HEATER_2_RAW_HI_TEMP 0
- #define HEATER_2_RAW_LO_TEMP 16383
- #else
- #define HEATER_2_RAW_HI_TEMP 16383
- #define HEATER_2_RAW_LO_TEMP 0
- #endif
- #endif
- #ifndef HEATER_3_RAW_HI_TEMP
- #ifdef HEATER_3_USES_THERMISTOR
- #define HEATER_3_RAW_HI_TEMP 0
- #define HEATER_3_RAW_LO_TEMP 16383
- #else
- #define HEATER_3_RAW_HI_TEMP 16383
- #define HEATER_3_RAW_LO_TEMP 0
- #endif
- #endif
- #ifndef HEATER_4_RAW_HI_TEMP
- #ifdef HEATER_4_USES_THERMISTOR
- #define HEATER_4_RAW_HI_TEMP 0
- #define HEATER_4_RAW_LO_TEMP 16383
- #else
- #define HEATER_4_RAW_HI_TEMP 16383
- #define HEATER_4_RAW_LO_TEMP 0
- #endif
- #endif
- #ifndef HEATER_BED_RAW_HI_TEMP
- #ifdef HEATER_BED_USES_THERMISTOR
- #define HEATER_BED_RAW_HI_TEMP 0
- #define HEATER_BED_RAW_LO_TEMP 16383
- #else
- #define HEATER_BED_RAW_HI_TEMP 16383
- #define HEATER_BED_RAW_LO_TEMP 0
- #endif
- #endif
- #ifndef HEATER_CHAMBER_RAW_HI_TEMP
- #ifdef HEATER_CHAMBER_USES_THERMISTOR
- #define HEATER_CHAMBER_RAW_HI_TEMP 0
- #define HEATER_CHAMBER_RAW_LO_TEMP 16383
- #else
- #define HEATER_CHAMBER_RAW_HI_TEMP 16383
- #define HEATER_CHAMBER_RAW_LO_TEMP 0
- #endif
- #endif
- #endif
|