temperature.cpp

Sat, 07 Nov 2015 13:24:46 +0100

author
mbayer
date
Sat, 07 Nov 2015 13:24:46 +0100
changeset 1
b584642d4f58
parent 0
2c8ba1964db7
permissions
-rw-r--r--

several modifications to support laser enable - still needs cleanup

0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1 /*
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2 temperature.c - temperature control
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
3 Part of Marlin
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
4
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
5 Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
6
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
7 This program is free software: you can redistribute it and/or modify
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
9 the Free Software Foundation, either version 3 of the License, or
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
10 (at your option) any later version.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
11
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
12 This program is distributed in the hope that it will be useful,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
15 GNU General Public License for more details.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
16
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
19 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
20
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
21 /*
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
22 This firmware is a mashup between Sprinter and grbl.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
23 (https://github.com/kliment/Sprinter)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
24 (https://github.com/simen/grbl/tree)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
25
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
26 It has preliminary support for Matthew Roberts advance algorithm
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
27 http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
28
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
29 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
30
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
31
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
32 #include "Marlin.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
33 #include "ultralcd.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
34 #include "temperature.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
35
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
36 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
37 //=============================public variables============================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
38 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
39 int target_raw[EXTRUDERS_T] = { 0 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
40 int target_raw_bed = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
41
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
42 int current_raw[EXTRUDERS_T] = { 0 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
43 int current_raw_bed = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
44
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
45 int b_beta = BED_BETA;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
46 int b_resistor = BED_RS;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
47 long b_thermistor = BED_NTC;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
48 float b_inf = BED_R_INF;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
49
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
50 int n_beta = E_BETA;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
51 int n_resistor = E_RS;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
52 long n_thermistor = E_NTC;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
53 float n_inf = E_R_INF;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
54
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
55 #ifdef PIDTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
56 // used external
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
57 float pid_setpoint[EXTRUDERS_T] = { 0.0 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
58
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
59 float Kp=DEFAULT_Kp;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
60 float Ki=DEFAULT_Ki;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
61 int Ki_Max=PID_INTEGRAL_DRIVE_MAX;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
62 float Kd=DEFAULT_Kd;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
63
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
64 #endif //PIDTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
65
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
66
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
67 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
68 //=============================private variables============================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
69 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
70 static volatile bool temp_meas_ready = false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
71
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
72 static unsigned long previous_millis_bed_heater;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
73 //static unsigned long previous_millis_heater;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
74
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
75 #ifdef PIDTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
76 //static cannot be external:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
77 static float temp_iState[EXTRUDERS_T] = { 0 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
78 static float temp_dState[EXTRUDERS_T] = { 0 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
79 static float pTerm[EXTRUDERS_T];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
80 static float iTerm[EXTRUDERS_T];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
81 static float dTerm[EXTRUDERS_T];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
82 //int output;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
83 static float pid_error[EXTRUDERS_T];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
84 static float temp_iState_min[EXTRUDERS_T];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
85 static float temp_iState_max[EXTRUDERS_T];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
86 // static float pid_input[EXTRUDERS_T];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
87 // static float pid_output[EXTRUDERS_T];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
88 static bool pid_reset[EXTRUDERS_T];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
89 #endif //PIDTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
90 static unsigned char soft_pwm[EXTRUDERS_T];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
91
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
92
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
93 // Init min and max temp with extreme values to prevent false errors during startup
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
94 // static int minttemp[EXTRUDERS_T] = { 0 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
95 // static int maxttemp[EXTRUDERS_T] = { 16383 }; // the first value used for all
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
96 static int bed_minttemp = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
97 static int bed_maxttemp = 16383;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
98
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
99
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
100 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
101 //============================= functions ============================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
102 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
103
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
104 void PID_autotune(float temp)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
105 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
106 float input;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
107 int cycles=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
108 bool heating = true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
109
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
110 unsigned long temp_millis = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
111 unsigned long t1=temp_millis;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
112 unsigned long t2=temp_millis;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
113 long t_high;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
114 long t_low;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
115
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
116 long bias=PID_MAX/2;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
117 long d = PID_MAX/2;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
118 float Ku, Tu;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
119 float Kp, Ki, Kd;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
120 float max, min;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
121
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
122 SERIAL_ECHOLN("PID Autotune start");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
123
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
124 disable_heater(); // switch off all heaters.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
125
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
126 soft_pwm[0] = PID_MAX/2;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
127
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
128 for(;;) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
129
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
130 if(temp_meas_ready == true) { // temp sample ready
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
131 CRITICAL_SECTION_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
132 temp_meas_ready = false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
133 CRITICAL_SECTION_END;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
134 input = analog2temp(current_raw[0], 0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
135
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
136 max=max(max,input);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
137 min=min(min,input);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
138 if(heating == true && input > temp) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
139 if(millis() - t2 > 5000) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
140 heating=false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
141 soft_pwm[0] = (bias - d) >> 1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
142 t1=millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
143 t_high=t1 - t2;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
144 max=temp;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
145 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
146 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
147 if(heating == false && input < temp) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
148 if(millis() - t1 > 5000) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
149 heating=true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
150 t2=millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
151 t_low=t2 - t1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
152 if(cycles > 0) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
153 bias += (d*(t_high - t_low))/(t_low + t_high);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
154 bias = constrain(bias, 20 ,PID_MAX-FULL_PID_BAND);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
155 if(bias > PID_MAX/2) d = PID_MAX - 1 - bias;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
156 else d = bias;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
157
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
158 SERIAL_PROTOCOLPGM(" bias: "); SERIAL_PROTOCOL(bias);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
159 SERIAL_PROTOCOLPGM(" d: "); SERIAL_PROTOCOL(d);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
160 SERIAL_PROTOCOLPGM(" min: "); SERIAL_PROTOCOL(min);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
161 SERIAL_PROTOCOLPGM(" max: "); SERIAL_PROTOCOLLN(max);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
162 if(cycles > 2) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
163 Ku = (4.0*d)/(3.14159*(max-min)/2.0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
164 Tu = ((float)(t_low + t_high)/1000.0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
165 SERIAL_PROTOCOLPGM(" Ku: "); SERIAL_PROTOCOL(Ku);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
166 SERIAL_PROTOCOLPGM(" Tu: "); SERIAL_PROTOCOLLN(Tu);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
167 Kp = 0.6*Ku;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
168 Ki = 2*Kp/Tu;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
169 Kd = Kp*Tu/8;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
170 SERIAL_PROTOCOLLNPGM(" Clasic PID ")
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
171 SERIAL_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(Kp);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
172 SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(Ki);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
173 SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(Kd);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
174 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
175 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
176 soft_pwm[0] = (bias + d) >> 1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
177 cycles++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
178 min=temp;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
179 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
180 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
181 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
182 if(input > (temp + 20)) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
183 SERIAL_PROTOCOLLNPGM("PID Autotune failed! Temperature to high");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
184 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
185 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
186 if(millis() - temp_millis > 2000) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
187 temp_millis = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
188 SERIAL_PROTOCOLPGM("ok T:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
189 SERIAL_PROTOCOL(degHotend(0));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
190 SERIAL_PROTOCOLPGM(" @:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
191 SERIAL_PROTOCOLLN(getHeaterPower(0));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
192 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
193 if(((millis() - t1) + (millis() - t2)) > (10L*60L*1000L*2L)) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
194 SERIAL_PROTOCOLLNPGM("PID Autotune failed! timeout");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
195 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
196 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
197 if(cycles > 5) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
198 SERIAL_PROTOCOLLNPGM("PID Autotune finished ! Place the Kp, Ki and Kd constants in the configuration.h");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
199 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
200 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
201 LCD_STATUS;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
202 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
203 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
204
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
205 void updatePID()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
206 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
207 #ifdef PIDTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
208 for(int e = 0; e < EXTRUDERS_T; e++) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
209 temp_iState_max[e] = Ki_Max / Ki;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
210 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
211 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
212 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
213
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
214 int getHeaterPower(int heater) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
215 return soft_pwm[heater];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
216 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
217
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
218 void manage_heater()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
219 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
220 float pid_input;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
221 float pid_output;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
222
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
223 if(temp_meas_ready != true) //better readability
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
224 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
225
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
226 CRITICAL_SECTION_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
227 temp_meas_ready = false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
228 CRITICAL_SECTION_END;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
229
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
230 for(int e = 0; e < EXTRUDERS_T; e++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
231 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
232
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
233 #ifdef PIDTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
234 pid_input = analog2temp(current_raw[e], e);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
235
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
236
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
237 pid_error[e] = pid_setpoint[e] - pid_input;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
238 if(pid_error[e] > FULL_PID_BAND) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
239 pid_output = PID_MAX;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
240 pid_reset[e] = true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
241 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
242 else if(pid_error[e] < -FULL_PID_BAND) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
243 pid_output = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
244 pid_reset[e] = true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
245 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
246 else {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
247 if(pid_reset[e] == true) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
248 temp_iState[e] = 0.0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
249 pid_reset[e] = false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
250 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
251 pTerm[e] = Kp * pid_error[e];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
252 temp_iState[e] += pid_error[e];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
253 temp_iState[e] = constrain(temp_iState[e], temp_iState_min[e], temp_iState_max[e]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
254 iTerm[e] = Ki * temp_iState[e];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
255 //K1 defined in Configuration.h in the PID settings
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
256 #define K2 (1.0-K1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
257 dTerm[e] = (Kd * (pid_input - temp_dState[e]))*K2 + (K1 * dTerm[e]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
258 temp_dState[e] = pid_input;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
259 pid_output = constrain(pTerm[e] + iTerm[e] - dTerm[e], 0, PID_MAX);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
260 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
261
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
262 #ifdef PID_DEBUG
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
263 SERIAL_ECHOLN(" PIDDEBUG "<<e<<": Input "<<pid_input<<" Output "<<pid_output" pTerm "<<pTerm[e]<<" iTerm "<<iTerm[e]<<" dTerm "<<dTerm[e]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
264 #endif //PID_DEBUG
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
265 #else /* PID off */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
266 pid_output = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
267 if(current_raw[e] < target_raw[e]) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
268 pid_output = PID_MAX;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
269 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
270 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
271
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
272 // Check if temperature is within the correct range
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
273 if((current_raw[e] > minttemp[e]) && (current_raw[e] < maxttemp[e]))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
274 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
275 soft_pwm[e] = (int)pid_output >> 1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
276 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
277 else {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
278 soft_pwm[e] = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
279 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
280 } // End extruder for loop
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
281
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
282
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
283 if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
284 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
285 previous_millis_bed_heater = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
286
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
287 #if TEMP_BED_PIN > -1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
288
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
289 // Check if temperature is within the correct range
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
290 if((current_raw_bed > bed_minttemp) && (current_raw_bed < bed_maxttemp)) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
291 if(current_raw_bed >= target_raw_bed)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
292 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
293 WRITE(HEATER_BED_PIN,LOW);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
294 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
295 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
296 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
297 WRITE(HEATER_BED_PIN,HIGH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
298 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
299 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
300 else {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
301 WRITE(HEATER_BED_PIN,LOW);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
302 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
303 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
304 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
305
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
306 // Use algebra to work out temperatures, not tables
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
307 // NB - this assumes all extruders use the same thermistor type.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
308 int temp2analogi(int celsius, const float& beta, const float& rs, const float& r_inf)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
309 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
310 float r = r_inf*exp(beta/(celsius - ABS_ZERO));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
311 return AD_RANGE - (int)(0.5 + AD_RANGE*r/(r + rs));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
312 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
313
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
314 float analog2tempi(int raw, const float& beta, const float& rs, const float& r_inf)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
315 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
316 float rawf = (float)(AD_RANGE - raw);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
317 return ABS_ZERO + beta/log( (rawf*rs/(AD_RANGE - rawf))/r_inf );
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
318 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
319
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
320
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
321 #ifdef REPRAPPRO_MULTIMATERIALS
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
322
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
323
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
324 float analog2temp_remote(uint8_t e)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
325 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
326 return slaveDegHotend(e);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
327 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
328
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
329 int temp2analog_remote(int celsius, uint8_t e)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
330 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
331 // What do we do about this, then?
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
332 return temp2analogi(celsius, n_beta, n_resistor, n_inf);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
333 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
334 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
335
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
336
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
337 int temp2analog(int celsius, uint8_t e)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
338 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
339 #ifdef REPRAPPRO_MULTIMATERIALS
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
340 if(e > 0) return temp2analog_remote(celsius, e);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
341 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
342 return temp2analogi(celsius, n_beta, n_resistor, n_inf);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
343 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
344 float analog2temp(int raw, uint8_t e)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
345 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
346 #ifdef REPRAPPRO_MULTIMATERIALS
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
347 if(e > 0) return analog2temp_remote(e);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
348 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
349 return analog2tempi(raw, n_beta, n_resistor, n_inf);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
350 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
351
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
352 int temp2analogBed(int celsius)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
353 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
354 return temp2analogi(celsius, b_beta, b_resistor, b_inf);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
355 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
356 float analog2tempBed(int raw)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
357 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
358 return analog2tempi(raw, b_beta, b_resistor, b_inf);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
359 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
360
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
361
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
362
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
363 void tp_init()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
364 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
365 // Finish init of mult extruder arrays
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
366 for(int e = 0; e < EXTRUDERS_T; e++) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
367 // populate with the first value
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
368 maxttemp[e] = maxttemp[0];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
369 #ifdef PIDTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
370 temp_iState_min[e] = 0.0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
371 temp_iState_max[e] = Ki_Max / Ki;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
372 #endif //PIDTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
373 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
374
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
375 #if (HEATER_0_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
376 SET_OUTPUT(HEATER_0_PIN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
377 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
378 #if (HEATER_1_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
379 SET_OUTPUT(HEATER_1_PIN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
380 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
381 #if (HEATER_2_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
382 SET_OUTPUT(HEATER_2_PIN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
383 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
384 #if (HEATER_BED_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
385 SET_OUTPUT(HEATER_BED_PIN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
386 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
387 #if (FAN_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
388 SET_OUTPUT(FAN_PIN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
389 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
390
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
391
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
392 // Set analog inputs
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
393 ADCSRA = 1<<ADEN | 1<<ADSC | 1<<ADIF | 0x07;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
394 DIDR0 = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
395 #ifdef DIDR2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
396 DIDR2 = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
397 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
398 #if (TEMP_0_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
399 #if TEMP_0_PIN < 8
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
400 DIDR0 |= 1 << TEMP_0_PIN;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
401 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
402 DIDR2 |= 1<<(TEMP_0_PIN - 8);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
403 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
404 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
405 #if (TEMP_1_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
406 #if TEMP_1_PIN < 8
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
407 DIDR0 |= 1<<TEMP_1_PIN;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
408 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
409 DIDR2 |= 1<<(TEMP_1_PIN - 8);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
410 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
411 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
412 #if (TEMP_2_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
413 #if TEMP_2_PIN < 8
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
414 DIDR0 |= 1 << TEMP_2_PIN;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
415 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
416 DIDR2 = 1<<(TEMP_2_PIN - 8);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
417 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
418 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
419 #if (TEMP_BED_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
420 #if TEMP_BED_PIN < 8
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
421 DIDR0 |= 1<<TEMP_BED_PIN;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
422 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
423 DIDR2 |= 1<<(TEMP_BED_PIN - 8);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
424 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
425 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
426
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
427 // Use timer0 for temperature measurement
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
428 // Interleave temperature interrupt with millies interrupt
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
429 OCR0B = 128;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
430 TIMSK0 |= (1<<OCIE0B);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
431
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
432 // Wait for temperature measurement to settle
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
433 delay(250);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
434
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
435 #ifdef HEATER_0_MINTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
436 minttemp[0] = temp2analog(HEATER_0_MINTEMP, 0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
437 #endif //MINTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
438 #ifdef HEATER_0_MAXTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
439 maxttemp[0] = temp2analog(HEATER_0_MAXTEMP, 0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
440 #endif //MAXTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
441
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
442 #if (EXTRUDERS_T > 1) && defined(HEATER_1_MINTEMP)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
443 minttemp[1] = temp2analog(HEATER_1_MINTEMP, 1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
444 #endif // MINTEMP 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
445 #if (EXTRUDERS_T > 1) && defined(HEATER_1_MAXTEMP)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
446 maxttemp[1] = temp2analog(HEATER_1_MAXTEMP, 1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
447 #endif //MAXTEMP 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
448
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
449 #if (EXTRUDERS_T > 2) && defined(HEATER_2_MINTEMP)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
450 minttemp[2] = temp2analog(HEATER_2_MINTEMP, 2);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
451 #endif //MINTEMP 2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
452 #if (EXTRUDERS_T > 2) && defined(HEATER_2_MAXTEMP)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
453 maxttemp[2] = temp2analog(HEATER_2_MAXTEMP, 2);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
454 #endif //MAXTEMP 2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
455
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
456 #ifdef BED_MINTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
457 bed_minttemp = temp2analogBed(BED_MINTEMP);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
458 #endif //BED_MINTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
459 #ifdef BED_MAXTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
460 bed_maxttemp = temp2analogBed(BED_MAXTEMP);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
461 #endif //BED_MAXTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
462 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
463
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
464
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
465
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
466 void disable_heater()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
467 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
468 for(int i=0;i<EXTRUDERS_T;i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
469 setTargetHotend(0,i);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
470 setTargetBed(0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
471 #if TEMP_0_PIN > -1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
472 target_raw[0]=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
473 soft_pwm[0]=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
474 #if HEATER_0_PIN > -1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
475 WRITE(HEATER_0_PIN,LOW);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
476 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
477 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
478
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
479 #if TEMP_1_PIN > -1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
480 target_raw[1]=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
481 soft_pwm[1]=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
482 #if HEATER_1_PIN > -1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
483 WRITE(HEATER_1_PIN,LOW);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
484 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
485 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
486
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
487 #if TEMP_2_PIN > -1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
488 target_raw[2]=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
489 soft_pwm[2]=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
490 #if HEATER_2_PIN > -1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
491 WRITE(HEATER_2_PIN,LOW);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
492 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
493 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
494
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
495 #if TEMP_BED_PIN > -1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
496 target_raw_bed=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
497 #if HEATER_BED_PIN > -1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
498 WRITE(HEATER_BED_PIN,LOW);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
499 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
500 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
501 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
502
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
503 void max_temp_error(uint8_t e) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
504 disable_heater();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
505 if(IsStopped() == false) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
506 SERIAL_ERROR_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
507 SERIAL_ERRORLN((int)e);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
508 SERIAL_ERRORLNPGM(": Extruder switched off. MAXTEMP triggered !");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
509 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
510 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
511
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
512 void min_temp_error(uint8_t e) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
513 disable_heater();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
514 if(IsStopped() == false) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
515 SERIAL_ERROR_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
516 SERIAL_ERRORLN((int)e);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
517 SERIAL_ERRORLNPGM(": Extruder switched off. MINTEMP triggered !");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
518 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
519 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
520
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
521 void bed_max_temp_error(void) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
522 #if HEATER_BED_PIN > -1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
523 WRITE(HEATER_BED_PIN, 0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
524 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
525 if(IsStopped() == false) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
526 SERIAL_ERROR_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
527 SERIAL_ERRORLNPGM("Temperature heated bed switched off. MAXTEMP triggered !!");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
528 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
529 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
530
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
531
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
532 // Timer 0 is shared with millies
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
533 ISR(TIMER0_COMPB_vect)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
534 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
535 //these variables are only accesible from the ISR, but static, so they don't loose their value
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
536 static unsigned char temp_count = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
537 static unsigned long raw_temp_0_value = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
538 static unsigned long raw_temp_1_value = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
539 static unsigned long raw_temp_2_value = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
540 static unsigned long raw_temp_bed_value = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
541 static unsigned char temp_state = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
542 static unsigned char pwm_count = 1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
543 static unsigned char soft_pwm_0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
544 static unsigned char soft_pwm_1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
545 static unsigned char soft_pwm_2;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
546
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
547 if(pwm_count == 0){
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
548 soft_pwm_0 = soft_pwm[0];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
549 if(soft_pwm_0 > 0) WRITE(HEATER_0_PIN,1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
550 #ifdef REPRAPPRO_MULTIMATERIALS
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
551 // Nothing to do here - remote handles it
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
552 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
553 #if EXTRUDERS_T > 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
554 soft_pwm_1 = soft_pwm[1];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
555 if(soft_pwm_1 > 0) WRITE(HEATER_1_PIN,1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
556 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
557 #if EXTRUDERS_T > 2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
558 soft_pwm_2 = soft_pwm[2];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
559 if(soft_pwm_2 > 0) WRITE(HEATER_2_PIN,1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
560 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
561 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
562 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
563 if(soft_pwm_0 <= pwm_count) WRITE(HEATER_0_PIN,0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
564 #ifdef REPRAPPRO_MULTIMATERIALS
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
565 // Nothing to do here - remote handles it
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
566 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
567 #if EXTRUDERS_T > 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
568 if(soft_pwm_1 <= pwm_count) WRITE(HEATER_1_PIN,0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
569 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
570 #if EXTRUDERS_T > 2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
571 if(soft_pwm_2 <= pwm_count) WRITE(HEATER_2_PIN,0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
572 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
573 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
574 pwm_count++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
575 pwm_count &= 0x7f;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
576
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
577 switch(temp_state) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
578 case 0: // Prepare TEMP_0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
579 #if (TEMP_0_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
580 #if TEMP_0_PIN > 7
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
581 ADCSRB = 1<<MUX5;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
582 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
583 ADCSRB = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
584 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
585 ADMUX = ((1 << REFS0) | (TEMP_0_PIN & 0x07));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
586 ADCSRA |= 1<<ADSC; // Start conversion
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
587 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
588 #ifdef ULTIPANEL
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
589 buttons_check();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
590 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
591 temp_state = 1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
592 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
593 case 1: // Measure TEMP_0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
594 #if (TEMP_0_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
595 raw_temp_0_value += ADC;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
596 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
597
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
598 temp_state = 2;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
599 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
600 case 2: // Prepare TEMP_BED
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
601 #if (TEMP_BED_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
602 #if TEMP_BED_PIN > 7
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
603 ADCSRB = 1<<MUX5;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
604 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
605 ADMUX = ((1 << REFS0) | (TEMP_BED_PIN & 0x07));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
606 ADCSRA |= 1<<ADSC; // Start conversion
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
607 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
608 #ifdef ULTIPANEL
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
609 buttons_check();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
610 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
611 temp_state = 3;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
612 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
613 case 3: // Measure TEMP_BED
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
614 #if (TEMP_BED_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
615 raw_temp_bed_value += ADC;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
616 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
617 temp_state = 4;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
618 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
619 case 4: // Prepare TEMP_1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
620 #if (TEMP_1_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
621 #if TEMP_1_PIN > 7
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
622 ADCSRB = 1<<MUX5;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
623 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
624 ADCSRB = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
625 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
626 ADMUX = ((1 << REFS0) | (TEMP_1_PIN & 0x07));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
627 ADCSRA |= 1<<ADSC; // Start conversion
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
628 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
629 #ifdef ULTIPANEL
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
630 buttons_check();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
631 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
632 temp_state = 5;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
633 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
634 case 5: // Measure TEMP_1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
635 #if (TEMP_1_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
636 raw_temp_1_value += ADC;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
637 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
638 temp_state = 6;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
639 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
640 case 6: // Prepare TEMP_2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
641 #if (TEMP_2_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
642 #if TEMP_2_PIN > 7
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
643 ADCSRB = 1<<MUX5;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
644 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
645 ADCSRB = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
646 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
647 ADMUX = ((1 << REFS0) | (TEMP_2_PIN & 0x07));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
648 ADCSRA |= 1<<ADSC; // Start conversion
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
649 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
650 #ifdef ULTIPANEL
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
651 buttons_check();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
652 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
653 temp_state = 7;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
654 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
655 case 7: // Measure TEMP_2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
656 #if (TEMP_2_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
657 raw_temp_2_value += ADC;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
658 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
659 temp_state = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
660 temp_count++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
661 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
662 // default:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
663 // SERIAL_ERROR_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
664 // SERIAL_ERRORLNPGM("Temp measurement error!");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
665 // break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
666 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
667
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
668 if(temp_count >= 16) // 8 ms * 16 = 128ms.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
669 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
670 #if defined(HEATER_0_USES_AD595) || defined(HEATER_0_USES_MAX6675)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
671 current_raw[0] = raw_temp_0_value;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
672 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
673 current_raw[0] = 16383 - raw_temp_0_value;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
674 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
675
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
676 #if EXTRUDERS_T > 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
677 #ifdef HEATER_1_USES_AD595
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
678 current_raw[1] = raw_temp_1_value;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
679 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
680 current_raw[1] = 16383 - raw_temp_1_value;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
681 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
682 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
683
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
684 #if EXTRUDERS_T > 2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
685 #ifdef HEATER_2_USES_AD595
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
686 current_raw[2] = raw_temp_2_value;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
687 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
688 current_raw[2] = 16383 - raw_temp_2_value;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
689 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
690 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
691
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
692
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
693 current_raw_bed = 16383 - raw_temp_bed_value;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
694
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
695
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
696 temp_meas_ready = true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
697 temp_count = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
698 raw_temp_0_value = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
699 raw_temp_1_value = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
700 raw_temp_2_value = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
701 raw_temp_bed_value = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
702
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
703 for(unsigned char e = 0; e < EXTRUDERS_T; e++) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
704 if(current_raw[e] >= maxttemp[e]) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
705 target_raw[e] = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
706 max_temp_error(e);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
707 #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
708 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
709 Stop();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
710 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
711 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
712 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
713 if(current_raw[e] <= minttemp[e]) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
714 target_raw[e] = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
715 min_temp_error(e);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
716 #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
717 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
718 Stop();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
719 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
720 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
721 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
722 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
723
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
724 #if defined(BED_MAXTEMP) && (HEATER_BED_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
725 if(current_raw_bed >= bed_maxttemp) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
726 target_raw_bed = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
727 bed_max_temp_error();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
728 Stop();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
729 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
730 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
731 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
732 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
733

mercurial