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
This commit is contained in:
Scott Lahteine 2020-07-01 16:27:28 -05:00 committed by GitHub
parent 70fa4c9323
commit c43bbcce15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 295 additions and 167 deletions

View file

@ -240,10 +240,6 @@ bool wait_for_heatup = true;
#endif
// Inactivity shutdown
millis_t max_inactive_time, // = 0
stepper_inactive_time = SEC_TO_MS(DEFAULT_STEPPER_DEACTIVE_TIME);
#if PIN_EXISTS(CHDK)
extern millis_t chdk_timeout;
#endif
@ -469,20 +465,23 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
const millis_t ms = millis();
if (max_inactive_time && ELAPSED(ms, gcode.previous_move_ms + max_inactive_time)) {
// Prevent steppers timing-out in the middle of M600
#define STAY_TEST (BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT) && did_pause_print)
if (STAY_TEST || ignore_stepper_queue)
gcode.reset_stepper_timeout(ms);
if (gcode.stepper_max_timed_out(ms)) {
SERIAL_ERROR_START();
SERIAL_ECHOLNPAIR(STR_KILL_INACTIVE_TIME, parser.command_ptr);
kill();
}
// Prevent steppers timing-out in the middle of M600
#define STAY_TEST (BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT) && did_pause_print)
if (stepper_inactive_time) {
if (gcode.stepper_inactive_time) {
static bool already_shutdown_steppers; // = false
if (planner.has_blocks_queued())
gcode.reset_stepper_timeout();
else if (!STAY_TEST && !ignore_stepper_queue && ELAPSED(ms, gcode.previous_move_ms + stepper_inactive_time)) {
gcode.reset_stepper_timeout(ms);
else if (!STAY_TEST && !ignore_stepper_queue && gcode.stepper_inactive_timeout()) {
if (!already_shutdown_steppers) {
already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this
if (ENABLED(DISABLE_INACTIVE_X)) DISABLE_AXIS_X();
@ -601,7 +600,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
}
#endif // !SWITCHING_EXTRUDER
gcode.reset_stepper_timeout();
gcode.reset_stepper_timeout(ms);
}
#endif // EXTRUDER_RUNOUT_PREVENT

View file

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

View file

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

View file

@ -164,6 +164,8 @@
*/
G29_TYPE GcodeSuite::G29() {
reset_stepper_timeout();
const bool seenQ = EITHER(DEBUG_LEVELING_FEATURE, PROBE_MANUALLY) && parser.seen('Q');
// G29 Q is also available if debugging
@ -675,7 +677,7 @@ G29_TYPE GcodeSuite::G29() {
#endif
abl_should_enable = false;
idle();
idle_no_sleep();
} // inner
} // outer

View file

@ -203,15 +203,15 @@
*/
void GcodeSuite::G28() {
#if ENABLED(LASER_MOVE_G28_OFF)
cutter.set_inline_enabled(false); // turn off laser
#endif
if (DEBUGGING(LEVELING)) {
DEBUG_ECHOLNPGM(">>> G28");
log_machine_info();
}
#if ENABLED(LASER_MOVE_G28_OFF)
cutter.set_inline_enabled(false); // turn off laser
#endif
TERN_(DWIN_CREALITY_LCD, HMI_flag.home_flag = true);
#if ENABLED(DUAL_X_CARRIAGE)
@ -251,6 +251,9 @@ void GcodeSuite::G28() {
TERN_(CNC_WORKSPACE_PLANES, workspace_plane = PLANE_XY);
// Count this command as movement / activity
reset_stepper_timeout();
#define HAS_CURRENT_HOME(N) (defined(N##_CURRENT_HOME) && N##_CURRENT_HOME != N##_CURRENT)
#if HAS_CURRENT_HOME(X) || HAS_CURRENT_HOME(X2) || HAS_CURRENT_HOME(Y) || HAS_CURRENT_HOME(Y2)
#define HAS_HOMING_CURRENT 1

View file

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

View file

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

View file

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

View file

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

View file

@ -334,8 +334,14 @@ public:
static bool select_coordinate_system(const int8_t _new);
#endif
static millis_t previous_move_ms;
FORCE_INLINE static void reset_stepper_timeout() { previous_move_ms = millis(); }
static millis_t previous_move_ms, max_inactive_time, stepper_inactive_time;
FORCE_INLINE static void reset_stepper_timeout(const millis_t ms=millis()) { previous_move_ms = ms; }
FORCE_INLINE static bool stepper_max_timed_out(const millis_t ms=millis()) {
return max_inactive_time && ELAPSED(ms, previous_move_ms + max_inactive_time);
}
FORCE_INLINE static bool stepper_inactive_timeout(const millis_t ms=millis()) {
return ELAPSED(ms, previous_move_ms + stepper_inactive_time);
}
static int8_t get_target_extruder_from_command();
static int8_t get_target_e_stepper_from_command();

View file

@ -110,12 +110,12 @@
#if HOTEND_USES_THERMISTOR
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
static const void* heater_ttbl_map[2] = { (void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE };
static const temp_entry_t* heater_ttbl_map[2] = { HEATER_0_TEMPTABLE, HEATER_1_TEMPTABLE };
static constexpr uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN };
#else
#define NEXT_TEMPTABLE(N) ,HEATER_##N##_TEMPTABLE
#define NEXT_TEMPTABLE_LEN(N) ,HEATER_##N##_TEMPTABLE_LEN
static const void* heater_ttbl_map[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_TEMPTABLE REPEAT_S(1, HOTENDS, NEXT_TEMPTABLE));
static const temp_entry_t* heater_ttbl_map[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_TEMPTABLE REPEAT_S(1, HOTENDS, NEXT_TEMPTABLE));
static constexpr uint8_t heater_ttbllen_map[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_TEMPTABLE_LEN REPEAT_S(1, HOTENDS, NEXT_TEMPTABLE_LEN));
#endif
#endif
@ -900,11 +900,13 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
SERIAL_ECHO_START();
SERIAL_ECHOPAIR(STR_PID_DEBUG, ee, STR_PID_DEBUG_INPUT, temp_hotend[ee].celsius, STR_PID_DEBUG_OUTPUT, pid_output);
#if DISABLED(PID_OPENLOOP)
{
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
#if ENABLED(PID_EXTRUSION_SCALING)
, STR_PID_DEBUG_CTERM, work_pid[ee].Kc
#endif
);
}
#endif
SERIAL_EOL();
}
@ -920,7 +922,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
return pid_output;
}
#endif // HOTENDS
#endif // HAS_HOTEND
#if ENABLED(PIDTEMPBED)
@ -1058,7 +1060,7 @@ void Temperature::manage_heater() {
} // HOTEND_LOOP
#endif // HOTENDS
#endif // HAS_HOTEND
#if HAS_AUTO_FAN
if (ELAPSED(ms, next_auto_fan_check_ms)) { // only need to check fan state very infrequently
@ -1212,15 +1214,15 @@ void Temperature::manage_heater() {
uint8_t l = 0, r = LEN, m; \
for (;;) { \
m = (l + r) >> 1; \
if (!m) return short(pgm_read_word(&TBL[0][1])); \
if (m == l || m == r) return short(pgm_read_word(&TBL[LEN-1][1])); \
short v00 = pgm_read_word(&TBL[m-1][0]), \
v10 = pgm_read_word(&TBL[m-0][0]); \
if (!m) return int16_t(pgm_read_word(&TBL[0].celsius)); \
if (m == l || m == r) return int16_t(pgm_read_word(&TBL[LEN-1].celsius)); \
int16_t v00 = pgm_read_word(&TBL[m-1].value), \
v10 = pgm_read_word(&TBL[m-0].value); \
if (raw < v00) r = m; \
else if (raw > v10) l = m; \
else { \
const short v01 = short(pgm_read_word(&TBL[m-1][1])), \
v11 = short(pgm_read_word(&TBL[m-0][1])); \
const int16_t v01 = int16_t(pgm_read_word(&TBL[m-1].celsius)), \
v11 = int16_t(pgm_read_word(&TBL[m-0].celsius)); \
return v01 + (raw - v00) * float(v11 - v01) / float(v10 - v00); \
} \
} \
@ -1452,13 +1454,13 @@ void Temperature::manage_heater() {
#if HOTEND_USES_THERMISTOR
// Thermistor with conversion table?
const short(*tt)[][2] = (short(*)[][2])(heater_ttbl_map[e]);
const temp_entry_t(*tt)[] = (temp_entry_t(*)[])(heater_ttbl_map[e]);
SCAN_THERMISTOR_TABLE((*tt), heater_ttbllen_map[e]);
#endif
return 0;
}
#endif // HOTENDS
#endif // HAS_HOTEND
#if HAS_HEATED_BED
// Derived from RepRap FiveD extruder::getTemperature()
@ -1790,80 +1792,91 @@ void Temperature::init() {
#if HAS_HOTEND
#define _TEMP_MIN_E(NR) do{ \
temp_range[NR].mintemp = HEATER_ ##NR## _MINTEMP; \
while (analog_to_celsius_hotend(temp_range[NR].raw_min, NR) < HEATER_ ##NR## _MINTEMP) \
const int16_t tmin = _MAX(HEATER_ ##NR## _MINTEMP, (int16_t)pgm_read_word(&HEATER_ ##NR## _TEMPTABLE[HEATER_ ##NR## _SENSOR_MINTEMP_IND].celsius)); \
temp_range[NR].mintemp = tmin; \
while (analog_to_celsius_hotend(temp_range[NR].raw_min, NR) < tmin) \
temp_range[NR].raw_min += TEMPDIR(NR) * (OVERSAMPLENR); \
}while(0)
#define _TEMP_MAX_E(NR) do{ \
temp_range[NR].maxtemp = HEATER_ ##NR## _MAXTEMP; \
while (analog_to_celsius_hotend(temp_range[NR].raw_max, NR) > HEATER_ ##NR## _MAXTEMP) \
const int16_t tmax = _MIN(HEATER_ ##NR## _MAXTEMP, (int16_t)pgm_read_word(&HEATER_ ##NR## _TEMPTABLE[HEATER_ ##NR## _SENSOR_MAXTEMP_IND].celsius) - 1); \
temp_range[NR].maxtemp = tmax; \
while (analog_to_celsius_hotend(temp_range[NR].raw_max, NR) > tmax) \
temp_range[NR].raw_max -= TEMPDIR(NR) * (OVERSAMPLENR); \
}while(0)
#if THERMISTOR_HEATER_0
#ifdef HEATER_0_MINTEMP
_TEMP_MIN_E(0);
#endif
#ifdef HEATER_0_MAXTEMP
_TEMP_MAX_E(0);
#endif
#if HAS_MULTI_HOTEND
#endif
#if HAS_MULTI_HOTEND && THERMISTOR_HEATER_1
#ifdef HEATER_1_MINTEMP
_TEMP_MIN_E(1);
#endif
#ifdef HEATER_1_MAXTEMP
_TEMP_MAX_E(1);
#endif
#if HOTENDS > 2
#endif
#if HOTENDS > 2 && THERMISTOR_HEATER_2
#ifdef HEATER_2_MINTEMP
_TEMP_MIN_E(2);
#endif
#ifdef HEATER_2_MAXTEMP
_TEMP_MAX_E(2);
#endif
#if HOTENDS > 3
#endif
#if HOTENDS > 3 && THERMISTOR_HEATER_3
#ifdef HEATER_3_MINTEMP
_TEMP_MIN_E(3);
#endif
#ifdef HEATER_3_MAXTEMP
_TEMP_MAX_E(3);
#endif
#if HOTENDS > 4
#endif
#if HOTENDS > 4 && THERMISTOR_HEATER_4
#ifdef HEATER_4_MINTEMP
_TEMP_MIN_E(4);
#endif
#ifdef HEATER_4_MAXTEMP
_TEMP_MAX_E(4);
#endif
#if HOTENDS > 5
#endif
#if HOTENDS > 5 && THERMISTOR_HEATER_5
#ifdef HEATER_5_MINTEMP
_TEMP_MIN_E(5);
#endif
#ifdef HEATER_5_MAXTEMP
_TEMP_MAX_E(5);
#endif
#if HOTENDS > 6
#endif
#if HOTENDS > 6 && THERMISTOR_HEATER_6
#ifdef HEATER_6_MINTEMP
_TEMP_MIN_E(6);
#endif
#ifdef HEATER_6_MAXTEMP
_TEMP_MAX_E(6);
#endif
#if HOTENDS > 7
#endif
#if HOTENDS > 7 && THERMISTOR_HEATER_7
#ifdef HEATER_7_MINTEMP
_TEMP_MIN_E(7);
#endif
#ifdef HEATER_7_MAXTEMP
_TEMP_MAX_E(7);
#endif
#endif // HOTENDS > 7
#endif // HOTENDS > 6
#endif // HOTENDS > 5
#endif // HOTENDS > 4
#endif // HOTENDS > 3
#endif // HOTENDS > 2
#endif // HAS_MULTI_HOTEND
#endif
#endif // HOTENDS
#endif // HAS_HOTEND
#if HAS_HEATED_BED
#ifdef BED_MINTEMP
@ -2319,7 +2332,7 @@ void Temperature::readings_ready() {
}
}
#endif // HOTENDS
#endif // HAS_HOTEND
#if HAS_HEATED_BED
#if TEMPDIR(BED) < 0
@ -2573,6 +2586,10 @@ void Temperature::tick() {
_SLOW_PWM(BED, soft_pwm_bed, temp_bed);
#endif
#if HAS_HEATED_CHAMBER
_SLOW_PWM(CHAMBER, soft_pwm_chamber, temp_chamber);
#endif
} // slow_pwm_count == 0
#if HAS_HOTEND
@ -2584,6 +2601,10 @@ void Temperature::tick() {
_PWM_OFF(BED, soft_pwm_bed);
#endif
#if HAS_HEATED_CHAMBER
_PWM_OFF(CHAMBER, soft_pwm_chamber);
#endif
#if ENABLED(FAN_SOFT_PWM)
if (pwm_count_tmp >= 127) {
pwm_count_tmp = 0;
@ -2662,6 +2683,7 @@ void Temperature::tick() {
HOTEND_LOOP() soft_pwm_hotend[e].dec();
#endif
TERN_(HAS_HEATED_BED, soft_pwm_bed.dec());
TERN_(HAS_HEATED_CHAMBER, soft_pwm_chamber.dec());
}
#endif // SLOW_PWM_HEATERS

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -22,7 +22,7 @@
#pragma once
// 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.
const short temptable_15[][2] PROGMEM = {
const temp_entry_t temptable_15[] PROGMEM = {
{ OV( 31), 275 },
{ OV( 33), 270 },
{ OV( 35), 260 },

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -42,6 +42,8 @@
#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)
typedef struct { int16_t value, celsius; } temp_entry_t;
// Pt1000 and Pt100 handling
//
// Rt=R0*(1+a*T+b*T*T) [for T>0]
@ -185,12 +187,13 @@
#include "thermistor_999.h"
#endif
#if ANY_THERMISTOR_IS(1000) // Custom
const short temptable_1000[][2] PROGMEM = { { 0, 0 } };
const temp_entry_t temptable_1000[] PROGMEM = { { 0, 0 } };
#endif
#define _TT_NAME(_N) temptable_ ## _N
#define TT_NAME(_N) _TT_NAME(_N)
#if THERMISTOR_HEATER_0
#define HEATER_0_TEMPTABLE TT_NAME(THERMISTOR_HEATER_0)
#define HEATER_0_TEMPTABLE_LEN COUNT(HEATER_0_TEMPTABLE)
@ -288,9 +291,12 @@
#else
#define CHAMBER_TEMPTABLE_LEN 0
#endif
#ifdef THERMISTORPROBE
#define PROBE_TEMPTABLE TT_NAME(THERMISTORPROBE)
#define PROBE_TEMPTABLE_LEN COUNT(PROBE_TEMPTABLE)
#elif defined(HEATER_PROBE_USES_THERMISTOR)
#error "No probe thermistor table specified"
#else
#define PROBE_TEMPTABLE_LEN 0
#endif
@ -300,7 +306,7 @@ 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
&& HEATER_6_TEMPTABLE_LEN < 258 && HEATER_7_TEMPTABLE_LEN < 258
&& HEATER_6_TEMPTABLE_LEN < 256 && HEATER_7_TEMPTABLE_LEN < 256
&& BED_TEMPTABLE_LEN < 256 && CHAMBER_TEMPTABLE_LEN < 256
&& PROBE_TEMPTABLE_LEN < 256,
"Temperature conversion tables over 255 entries need special consideration."
@ -309,8 +315,85 @@ static_assert(
// Set the high and low raw values for the heaters
// For thermistors the highest temperature results in the lowest ADC value
// For thermocouples the highest temperature results in the highest ADC value
#define _TT_REV(N) REVERSE_TEMP_SENSOR_RANGE_##N
#define TT_REV(N) _TT_REV(N)
#ifdef HEATER_0_TEMPTABLE
#if TT_REV(THERMISTOR_HEATER_0)
#define HEATER_0_SENSOR_MINTEMP_IND 0
#define HEATER_0_SENSOR_MAXTEMP_IND HEATER_0_TEMPTABLE_LEN - 1
#else
#define HEATER_0_SENSOR_MINTEMP_IND HEATER_0_TEMPTABLE_LEN - 1
#define HEATER_0_SENSOR_MAXTEMP_IND 0
#endif
#endif
#ifdef HEATER_1_TEMPTABLE
#if TT_REV(THERMISTOR_HEATER_1)
#define HEATER_1_SENSOR_MINTEMP_IND 0
#define HEATER_1_SENSOR_MAXTEMP_IND HEATER_1_TEMPTABLE_LEN - 1
#else
#define HEATER_1_SENSOR_MINTEMP_IND HEATER_1_TEMPTABLE_LEN - 1
#define HEATER_1_SENSOR_MAXTEMP_IND 0
#endif
#endif
#ifdef HEATER_2_TEMPTABLE
#if TT_REV(THERMISTOR_HEATER_2)
#define HEATER_2_SENSOR_MINTEMP_IND 0
#define HEATER_2_SENSOR_MAXTEMP_IND HEATER_2_TEMPTABLE_LEN - 1
#else
#define HEATER_2_SENSOR_MINTEMP_IND HEATER_2_TEMPTABLE_LEN - 1
#define HEATER_2_SENSOR_MAXTEMP_IND 0
#endif
#endif
#ifdef HEATER_3_TEMPTABLE
#if TT_REV(THERMISTOR_HEATER_3)
#define HEATER_3_SENSOR_MINTEMP_IND 0
#define HEATER_3_SENSOR_MAXTEMP_IND HEATER_3_TEMPTABLE_LEN - 1
#else
#define HEATER_3_SENSOR_MINTEMP_IND HEATER_3_TEMPTABLE_LEN - 1
#define HEATER_3_SENSOR_MAXTEMP_IND 0
#endif
#endif
#ifdef HEATER_4_TEMPTABLE
#if TT_REV(THERMISTOR_HEATER_4)
#define HEATER_4_SENSOR_MINTEMP_IND 0
#define HEATER_4_SENSOR_MAXTEMP_IND HEATER_4_TEMPTABLE_LEN - 1
#else
#define HEATER_4_SENSOR_MINTEMP_IND HEATER_4_TEMPTABLE_LEN - 1
#define HEATER_4_SENSOR_MAXTEMP_IND 0
#endif
#endif
#ifdef HEATER_5_TEMPTABLE
#if TT_REV(THERMISTOR_HEATER_5)
#define HEATER_5_SENSOR_MINTEMP_IND 0
#define HEATER_5_SENSOR_MAXTEMP_IND HEATER_5_TEMPTABLE_LEN - 1
#else
#define HEATER_5_SENSOR_MINTEMP_IND HEATER_5_TEMPTABLE_LEN - 1
#define HEATER_5_SENSOR_MAXTEMP_IND 0
#endif
#endif
#ifdef HEATER_6_TEMPTABLE
#if TT_REV(THERMISTOR_HEATER_6)
#define HEATER_6_SENSOR_MINTEMP_IND 0
#define HEATER_6_SENSOR_MAXTEMP_IND HEATER_6_TEMPTABLE_LEN - 1
#else
#define HEATER_6_SENSOR_MINTEMP_IND HEATER_6_TEMPTABLE_LEN - 1
#define HEATER_6_SENSOR_MAXTEMP_IND 0
#endif
#endif
#ifdef HEATER_7_TEMPTABLE
#if TT_REV(THERMISTOR_HEATER_7)
#define HEATER_7_SENSOR_MINTEMP_IND 0
#define HEATER_7_SENSOR_MAXTEMP_IND HEATER_7_TEMPTABLE_LEN - 1
#else
#define HEATER_7_SENSOR_MINTEMP_IND HEATER_7_TEMPTABLE_LEN - 1
#define HEATER_7_SENSOR_MAXTEMP_IND 0
#endif
#endif
#ifndef HEATER_0_RAW_HI_TEMP
#if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_0_USES_THERMISTOR)
#if TT_REV(THERMISTOR_HEATER_0) || !defined(HEATER_0_USES_THERMISTOR)
#define HEATER_0_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_0_RAW_LO_TEMP 0
#else
@ -319,7 +402,7 @@ static_assert(
#endif
#endif
#ifndef HEATER_1_RAW_HI_TEMP
#if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_1_USES_THERMISTOR)
#if TT_REV(THERMISTOR_HEATER_1) || !defined(HEATER_1_USES_THERMISTOR)
#define HEATER_1_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_1_RAW_LO_TEMP 0
#else
@ -328,7 +411,7 @@ static_assert(
#endif
#endif
#ifndef HEATER_2_RAW_HI_TEMP
#if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_2_USES_THERMISTOR)
#if TT_REV(THERMISTOR_HEATER_2) || !defined(HEATER_2_USES_THERMISTOR)
#define HEATER_2_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_2_RAW_LO_TEMP 0
#else
@ -337,7 +420,7 @@ static_assert(
#endif
#endif
#ifndef HEATER_3_RAW_HI_TEMP
#if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_3_USES_THERMISTOR)
#if TT_REV(THERMISTOR_HEATER_3) || !defined(HEATER_3_USES_THERMISTOR)
#define HEATER_3_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_3_RAW_LO_TEMP 0
#else
@ -346,7 +429,7 @@ static_assert(
#endif
#endif
#ifndef HEATER_4_RAW_HI_TEMP
#if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_4_USES_THERMISTOR)
#if TT_REV(THERMISTOR_HEATER_4) || !defined(HEATER_4_USES_THERMISTOR)
#define HEATER_4_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_4_RAW_LO_TEMP 0
#else
@ -355,7 +438,7 @@ static_assert(
#endif
#endif
#ifndef HEATER_5_RAW_HI_TEMP
#if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_5_USES_THERMISTOR)
#if TT_REV(THERMISTOR_HEATER_5) || !defined(HEATER_5_USES_THERMISTOR)
#define HEATER_5_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_5_RAW_LO_TEMP 0
#else
@ -364,7 +447,7 @@ static_assert(
#endif
#endif
#ifndef HEATER_6_RAW_HI_TEMP
#if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_6_USES_THERMISTOR)
#if TT_REV(THERMISTOR_HEATER_6) || !defined(HEATER_6_USES_THERMISTOR)
#define HEATER_6_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_6_RAW_LO_TEMP 0
#else
@ -373,7 +456,7 @@ static_assert(
#endif
#endif
#ifndef HEATER_7_RAW_HI_TEMP
#if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_7_USES_THERMISTOR)
#if TT_REV(THERMISTOR_HEATER_7) || !defined(HEATER_7_USES_THERMISTOR)
#define HEATER_7_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_7_RAW_LO_TEMP 0
#else
@ -382,7 +465,7 @@ static_assert(
#endif
#endif
#ifndef HEATER_BED_RAW_HI_TEMP
#if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_BED_USES_THERMISTOR)
#if TT_REV(THERMISTORBED) || !defined(HEATER_BED_USES_THERMISTOR)
#define HEATER_BED_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_BED_RAW_LO_TEMP 0
#else
@ -391,7 +474,7 @@ static_assert(
#endif
#endif
#ifndef HEATER_CHAMBER_RAW_HI_TEMP
#if defined(REVERSE_TEMP_SENSOR_RANGE) || !defined(HEATER_CHAMBER_USES_THERMISTOR)
#if TT_REV(THERMISTORCHAMBER) || !defined(HEATER_CHAMBER_USES_THERMISTOR)
#define HEATER_CHAMBER_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_CHAMBER_RAW_LO_TEMP 0
#else
@ -399,5 +482,15 @@ static_assert(
#define HEATER_CHAMBER_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
#endif
#endif
#ifndef HEATER_PROBE_RAW_HI_TEMP
#if TT_REV(THERMISTORPROBE) || !defined(HEATER_PROBE_USES_THERMISTOR)
#define HEATER_PROBE_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_PROBE_RAW_LO_TEMP 0
#else
#define HEATER_PROBE_RAW_HI_TEMP 0
#define HEATER_PROBE_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
#endif
#endif
#undef REVERSE_TEMP_SENSOR_RANGE
#undef _TT_REV
#undef TT_REV