From 831fc2a95257d58cddd458d19e57065745fd4024 Mon Sep 17 00:00:00 2001 From: Josef Pavlik Date: Fri, 14 Feb 2014 12:15:31 +0100 Subject: [PATCH 1/2] Pt100 and Pt1000 temperature sensors handling --- Marlin/Configuration.h | 5 +++ Marlin/thermistortables.h | 64 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 33a1c3a16..5d235bc45 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -120,6 +120,11 @@ // 51 is 100k thermistor - EPCOS (1k pullup) // 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup) // 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) +// +// 1047 is Pt1000 with 4k7 pullup +// 1010 is Pt1000 with 1k pullup (non standard) +// 147 is Pt100 with 4k7 pullup +// 110 is Pt100 with 1k pullup (non standard) #define TEMP_SENSOR_0 -1 #define TEMP_SENSOR_1 -1 diff --git a/Marlin/thermistortables.h b/Marlin/thermistortables.h index 58a2466fe..1d2b3ca65 100644 --- a/Marlin/thermistortables.h +++ b/Marlin/thermistortables.h @@ -857,6 +857,70 @@ const short temptable_60[][2] PROGMEM = { }; #endif +// Pt1000 and Pt100 handling +// +// Rt=R0*(1+a*T+b*T*T) [for T>0] +// a=3.9083E-3, b=-5.775E-7 + +#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) { PtAdVal(T,R0,Rup)*OVERSAMPLENR, T }, + +#if (THERMISTORHEATER_0 == 110) || (THERMISTORHEATER_1 == 110) || (THERMISTORHEATER_2 == 110) || (THERMISTORBED == 110) // Pt100 with 1k0 pullup +const short temptable_110[][2] PROGMEM = { +// only few values are needed as the curve is very flat + PtLine(0,100,1000) + PtLine(50,100,1000) + PtLine(100,100,1000) + PtLine(150,100,1000) + PtLine(200,100,1000) + PtLine(250,100,1000) + PtLine(300,100,1000) +}; +#endif +#if (THERMISTORHEATER_0 == 147) || (THERMISTORHEATER_1 == 147) || (THERMISTORHEATER_2 == 147) || (THERMISTORBED == 147) // Pt100 with 4k7 pullup +const short temptable_147[][2] PROGMEM = { +// only few values are needed as the curve is very flat + PtLine(0,100,4700) + PtLine(50,100,4700) + PtLine(100,100,4700) + PtLine(150,100,4700) + PtLine(200,100,4700) + PtLine(250,100,4700) + PtLine(300,100,4700) +}; +#endif +#if (THERMISTORHEATER_0 == 1010) || (THERMISTORHEATER_1 == 1010) || (THERMISTORHEATER_2 == 1010) || (THERMISTORBED == 1010) // Pt1000 with 1k0 pullup +const short temptable_1010[][2] PROGMEM = { + PtLine(0,1000,1000) + PtLine(25,1000,1000) + PtLine(50,1000,1000) + PtLine(75,1000,1000) + PtLine(100,1000,1000) + PtLine(125,1000,1000) + PtLine(150,1000,1000) + PtLine(175,1000,1000) + PtLine(200,1000,1000) + PtLine(225,1000,1000) + PtLine(250,1000,1000) + PtLine(275,1000,1000) + PtLine(300,1000,1000) +}; +#endif +#if (THERMISTORHEATER_0 == 1047) || (THERMISTORHEATER_1 == 1047) || (THERMISTORHEATER_2 == 1047) || (THERMISTORBED == 1047) // Pt1000 with 4k7 pullup +const short temptable_1047[][2] PROGMEM = { +// only few values are needed as the curve is very flat + PtLine(0,1000,4700) + PtLine(50,1000,4700) + PtLine(100,1000,4700) + PtLine(150,1000,4700) + PtLine(200,1000,4700) + PtLine(250,1000,4700) + PtLine(300,1000,4700) +}; +#endif #define _TT_NAME(_N) temptable_ ## _N #define TT_NAME(_N) _TT_NAME(_N) From 477b6fa1df30d1ff6021df103d5bb5efef31ee4a Mon Sep 17 00:00:00 2001 From: Josef Pavlik Date: Mon, 3 Feb 2014 11:30:12 +0100 Subject: [PATCH 2/2] move engaged from lcd console refreshes power off timeout --- Marlin/Marlin.h | 2 ++ Marlin/Marlin_main.cpp | 4 ++++ Marlin/ultralcd.cpp | 3 +++ 3 files changed, 9 insertions(+) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index af3325be4..4d6b22728 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -189,6 +189,8 @@ void enquecommand_P(const char *cmd); //put an ascii command at the end of the c void prepare_arc_move(char isclockwise); void clamp_to_software_endstops(float target[3]); +void refresh_cmd_timeout(void); + #ifdef FAST_PWM_FAN void setPwmFrequency(uint8_t pin, int val); #endif diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 920aed00c..bf13f8e62 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1046,6 +1046,10 @@ static void homeaxis(int axis) { } } #define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS) ++void refresh_cmd_timeout(void) +{ + previous_millis_cmd = millis(); +} void process_commands() { diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 77be8e8e3..acbc8d6e4 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -460,6 +460,7 @@ static void lcd_move_x() { if (encoderPosition != 0) { + refresh_cmd_timeout(); current_position[X_AXIS] += float((int)encoderPosition) * move_menu_scale; if (min_software_endstops && current_position[X_AXIS] < X_MIN_POS) current_position[X_AXIS] = X_MIN_POS; @@ -489,6 +490,7 @@ static void lcd_move_y() { if (encoderPosition != 0) { + refresh_cmd_timeout(); current_position[Y_AXIS] += float((int)encoderPosition) * move_menu_scale; if (min_software_endstops && current_position[Y_AXIS] < Y_MIN_POS) current_position[Y_AXIS] = Y_MIN_POS; @@ -518,6 +520,7 @@ static void lcd_move_z() { if (encoderPosition != 0) { + refresh_cmd_timeout(); current_position[Z_AXIS] += float((int)encoderPosition) * move_menu_scale; if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS) current_position[Z_AXIS] = Z_MIN_POS;