|
@@ -33,6 +33,7 @@
|
33
|
33
|
#include "ultralcd.h"
|
34
|
34
|
#include "temperature.h"
|
35
|
35
|
#include "watchdog.h"
|
|
36
|
+#include "language.h"
|
36
|
37
|
|
37
|
38
|
#include "Sd2PinMap.h"
|
38
|
39
|
|
|
@@ -228,11 +229,11 @@ void PID_autotune(float temp, int extruder, int ncycles)
|
228
|
229
|
|| extruder < 0
|
229
|
230
|
#endif
|
230
|
231
|
) {
|
231
|
|
- SERIAL_ECHOLN("PID Autotune failed. Bad extruder number.");
|
|
232
|
+ SERIAL_ECHOLN(MSG_PID_BAD_EXTRUDER_NUM);
|
232
|
233
|
return;
|
233
|
234
|
}
|
234
|
235
|
|
235
|
|
- SERIAL_ECHOLN("PID Autotune start");
|
|
236
|
+ SERIAL_ECHOLN(MSG_PID_AUTOTUNE_START);
|
236
|
237
|
|
237
|
238
|
disable_heater(); // switch off all heaters.
|
238
|
239
|
|
|
@@ -287,22 +288,22 @@ void PID_autotune(float temp, int extruder, int ncycles)
|
287
|
288
|
bias = constrain(bias, 20, max_pow - 20);
|
288
|
289
|
d = (bias > max_pow / 2) ? max_pow - 1 - bias : bias;
|
289
|
290
|
|
290
|
|
- SERIAL_PROTOCOLPGM(" bias: "); SERIAL_PROTOCOL(bias);
|
291
|
|
- SERIAL_PROTOCOLPGM(" d: "); SERIAL_PROTOCOL(d);
|
292
|
|
- SERIAL_PROTOCOLPGM(" min: "); SERIAL_PROTOCOL(min);
|
293
|
|
- SERIAL_PROTOCOLPGM(" max: "); SERIAL_PROTOCOLLN(max);
|
|
291
|
+ SERIAL_PROTOCOLPGM(MSG_BIAS); SERIAL_PROTOCOL(bias);
|
|
292
|
+ SERIAL_PROTOCOLPGM(MSG_D); SERIAL_PROTOCOL(d);
|
|
293
|
+ SERIAL_PROTOCOLPGM(MSG_MIN); SERIAL_PROTOCOL(min);
|
|
294
|
+ SERIAL_PROTOCOLPGM(MSG_MAX); SERIAL_PROTOCOLLN(max);
|
294
|
295
|
if (cycles > 2) {
|
295
|
296
|
Ku = (4.0 * d) / (3.14159265 * (max - min) / 2.0);
|
296
|
297
|
Tu = ((float)(t_low + t_high) / 1000.0);
|
297
|
|
- SERIAL_PROTOCOLPGM(" Ku: "); SERIAL_PROTOCOL(Ku);
|
298
|
|
- SERIAL_PROTOCOLPGM(" Tu: "); SERIAL_PROTOCOLLN(Tu);
|
|
298
|
+ SERIAL_PROTOCOLPGM(MSG_KU); SERIAL_PROTOCOL(Ku);
|
|
299
|
+ SERIAL_PROTOCOLPGM(MSG_TU); SERIAL_PROTOCOLLN(Tu);
|
299
|
300
|
Kp = 0.6 * Ku;
|
300
|
301
|
Ki = 2 * Kp / Tu;
|
301
|
302
|
Kd = Kp * Tu / 8;
|
302
|
|
- SERIAL_PROTOCOLLNPGM(" Classic PID ");
|
303
|
|
- SERIAL_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(Kp);
|
304
|
|
- SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(Ki);
|
305
|
|
- SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(Kd);
|
|
303
|
+ SERIAL_PROTOCOLLNPGM(MSG_CLASSIC_PID);
|
|
304
|
+ SERIAL_PROTOCOLPGM(MSG_KP); SERIAL_PROTOCOLLN(Kp);
|
|
305
|
+ SERIAL_PROTOCOLPGM(MSG_KI); SERIAL_PROTOCOLLN(Ki);
|
|
306
|
+ SERIAL_PROTOCOLPGM(MSG_KD); SERIAL_PROTOCOLLN(Kd);
|
306
|
307
|
/*
|
307
|
308
|
Kp = 0.33*Ku;
|
308
|
309
|
Ki = Kp/Tu;
|
|
@@ -331,7 +332,7 @@ void PID_autotune(float temp, int extruder, int ncycles)
|
331
|
332
|
}
|
332
|
333
|
}
|
333
|
334
|
if (input > temp + 20) {
|
334
|
|
- SERIAL_PROTOCOLLNPGM("PID Autotune failed! Temperature too high");
|
|
335
|
+ SERIAL_PROTOCOLLNPGM(MSG_PID_TEMP_TOO_HIGH);
|
335
|
336
|
return;
|
336
|
337
|
}
|
337
|
338
|
// Every 2 seconds...
|
|
@@ -339,26 +340,26 @@ void PID_autotune(float temp, int extruder, int ncycles)
|
339
|
340
|
int p;
|
340
|
341
|
if (extruder < 0) {
|
341
|
342
|
p = soft_pwm_bed;
|
342
|
|
- SERIAL_PROTOCOLPGM("ok B:");
|
|
343
|
+ SERIAL_PROTOCOLPGM(MSG_OK_B);
|
343
|
344
|
}
|
344
|
345
|
else {
|
345
|
346
|
p = soft_pwm[extruder];
|
346
|
|
- SERIAL_PROTOCOLPGM("ok T:");
|
|
347
|
+ SERIAL_PROTOCOLPGM(MSG_OK_T);
|
347
|
348
|
}
|
348
|
349
|
|
349
|
350
|
SERIAL_PROTOCOL(input);
|
350
|
|
- SERIAL_PROTOCOLPGM(" @:");
|
|
351
|
+ SERIAL_PROTOCOLPGM(MSG_AT);
|
351
|
352
|
SERIAL_PROTOCOLLN(p);
|
352
|
353
|
|
353
|
354
|
temp_millis = ms;
|
354
|
355
|
} // every 2 seconds
|
355
|
356
|
// Over 2 minutes?
|
356
|
357
|
if (((ms - t1) + (ms - t2)) > (10L*60L*1000L*2L)) {
|
357
|
|
- SERIAL_PROTOCOLLNPGM("PID Autotune failed! timeout");
|
|
358
|
+ SERIAL_PROTOCOLLNPGM(MSG_PID_TIMEOUT);
|
358
|
359
|
return;
|
359
|
360
|
}
|
360
|
361
|
if (cycles > ncycles) {
|
361
|
|
- SERIAL_PROTOCOLLNPGM("PID Autotune finished! Put the last Kp, Ki and Kd constants from above into Configuration.h");
|
|
362
|
+ SERIAL_PROTOCOLLNPGM(MSG_PID_AUTOTUNE_FINISHED);
|
362
|
363
|
return;
|
363
|
364
|
}
|
364
|
365
|
lcd_update();
|
|
@@ -571,17 +572,17 @@ void manage_heater() {
|
571
|
572
|
|
572
|
573
|
#ifdef PID_DEBUG
|
573
|
574
|
SERIAL_ECHO_START;
|
574
|
|
- SERIAL_ECHO(" PID_DEBUG ");
|
|
575
|
+ SERIAL_ECHO(MSG_PID_DEBUG);
|
575
|
576
|
SERIAL_ECHO(e);
|
576
|
|
- SERIAL_ECHO(": Input ");
|
|
577
|
+ SERIAL_ECHO(MSG_PID_DEBUG_INPUT);
|
577
|
578
|
SERIAL_ECHO(pid_input);
|
578
|
|
- SERIAL_ECHO(" Output ");
|
|
579
|
+ SERIAL_ECHO(MSG_PID_DEBUG_OUTPUT);
|
579
|
580
|
SERIAL_ECHO(pid_output);
|
580
|
|
- SERIAL_ECHO(" pTerm ");
|
|
581
|
+ SERIAL_ECHO(MSG_PID_DEBUG_PTERM);
|
581
|
582
|
SERIAL_ECHO(pTerm[e]);
|
582
|
|
- SERIAL_ECHO(" iTerm ");
|
|
583
|
+ SERIAL_ECHO(MSG_PID_DEBUG_ITERM);
|
583
|
584
|
SERIAL_ECHO(iTerm[e]);
|
584
|
|
- SERIAL_ECHO(" dTerm ");
|
|
585
|
+ SERIAL_ECHO(MSG_PID_DEBUG_DTERM);
|
585
|
586
|
SERIAL_ECHOLN(dTerm[e]);
|
586
|
587
|
#endif //PID_DEBUG
|
587
|
588
|
|
|
@@ -599,9 +600,9 @@ void manage_heater() {
|
599
|
600
|
if (watchmillis[e] && ms > watchmillis[e] + WATCH_TEMP_PERIOD) {
|
600
|
601
|
if (degHotend(e) < watch_start_temp[e] + WATCH_TEMP_INCREASE) {
|
601
|
602
|
setTargetHotend(0, e);
|
602
|
|
- LCD_MESSAGEPGM("Heating failed");
|
|
603
|
+ LCD_MESSAGEPGM(MSG_HEATING_FAILED_LCD); // translatable
|
603
|
604
|
SERIAL_ECHO_START;
|
604
|
|
- SERIAL_ECHOLNPGM("Heating failed");
|
|
605
|
+ SERIAL_ECHOLNPGM(MSG_HEATING_FAILED);
|
605
|
606
|
}
|
606
|
607
|
else {
|
607
|
608
|
watchmillis[e] = 0;
|
|
@@ -614,8 +615,8 @@ void manage_heater() {
|
614
|
615
|
disable_heater();
|
615
|
616
|
if (IsStopped() == false) {
|
616
|
617
|
SERIAL_ERROR_START;
|
617
|
|
- SERIAL_ERRORLNPGM("Extruder switched off. Temperature difference between temp sensors is too high !");
|
618
|
|
- LCD_ALERTMESSAGEPGM("Err: REDUNDANT TEMP ERROR");
|
|
618
|
+ SERIAL_ERRORLNPGM(MSG_EXTRUDER_SWITCHED_OFF);
|
|
619
|
+ LCD_ALERTMESSAGEPGM(MSG_ERR_REDUNDANT_TEMP); // translatable
|
619
|
620
|
}
|
620
|
621
|
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
|
621
|
622
|
Stop();
|
|
@@ -728,7 +729,7 @@ static float analog2temp(int raw, uint8_t e) {
|
728
|
729
|
{
|
729
|
730
|
SERIAL_ERROR_START;
|
730
|
731
|
SERIAL_ERROR((int)e);
|
731
|
|
- SERIAL_ERRORLNPGM(" - Invalid extruder number !");
|
|
732
|
+ SERIAL_ERRORLNPGM(MSG_INVALID_EXTRUDER_NUM);
|
732
|
733
|
kill();
|
733
|
734
|
return 0.0;
|
734
|
735
|
}
|
|
@@ -1074,9 +1075,9 @@ void thermal_runaway_protection(int *state, unsigned long *timer, float temperat
|
1074
|
1075
|
else if ( (ms - *timer) > ((unsigned long) period_seconds) * 1000)
|
1075
|
1076
|
{
|
1076
|
1077
|
SERIAL_ERROR_START;
|
1077
|
|
- SERIAL_ERRORLNPGM("Thermal Runaway, system stopped! Heater_ID: ");
|
|
1078
|
+ SERIAL_ERRORLNPGM(MSG_THERMAL_RUNAWAY_STOP);
|
1078
|
1079
|
SERIAL_ERRORLN((int)heater_id);
|
1079
|
|
- LCD_ALERTMESSAGEPGM("THERMAL RUNAWAY");
|
|
1080
|
+ LCD_ALERTMESSAGEPGM(MSG_THERMAL_RUNAWAY); // translatable
|
1080
|
1081
|
thermal_runaway = true;
|
1081
|
1082
|
while(1)
|
1082
|
1083
|
{
|
|
@@ -1140,8 +1141,8 @@ void max_temp_error(uint8_t e) {
|
1140
|
1141
|
if(IsStopped() == false) {
|
1141
|
1142
|
SERIAL_ERROR_START;
|
1142
|
1143
|
SERIAL_ERRORLN((int)e);
|
1143
|
|
- SERIAL_ERRORLNPGM(": Extruder switched off. MAXTEMP triggered !");
|
1144
|
|
- LCD_ALERTMESSAGEPGM("Err: MAXTEMP");
|
|
1144
|
+ SERIAL_ERRORLNPGM(MSG_MAXTEMP_EXTRUDER_OFF);
|
|
1145
|
+ LCD_ALERTMESSAGEPGM(MSG_ERR_MAXTEMP); // translatable
|
1145
|
1146
|
}
|
1146
|
1147
|
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
|
1147
|
1148
|
Stop();
|
|
@@ -1153,8 +1154,8 @@ void min_temp_error(uint8_t e) {
|
1153
|
1154
|
if(IsStopped() == false) {
|
1154
|
1155
|
SERIAL_ERROR_START;
|
1155
|
1156
|
SERIAL_ERRORLN((int)e);
|
1156
|
|
- SERIAL_ERRORLNPGM(": Extruder switched off. MINTEMP triggered !");
|
1157
|
|
- LCD_ALERTMESSAGEPGM("Err: MINTEMP");
|
|
1157
|
+ SERIAL_ERRORLNPGM(MSG_MINTEMP_EXTRUDER_OFF);
|
|
1158
|
+ LCD_ALERTMESSAGEPGM(MSG_ERR_MINTEMP); // translatable
|
1158
|
1159
|
}
|
1159
|
1160
|
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
|
1160
|
1161
|
Stop();
|
|
@@ -1167,8 +1168,8 @@ void bed_max_temp_error(void) {
|
1167
|
1168
|
#endif
|
1168
|
1169
|
if (IsStopped() == false) {
|
1169
|
1170
|
SERIAL_ERROR_START;
|
1170
|
|
- SERIAL_ERRORLNPGM("Temperature heated bed switched off. MAXTEMP triggered !!");
|
1171
|
|
- LCD_ALERTMESSAGEPGM("Err: MAXTEMP BED");
|
|
1171
|
+ SERIAL_ERRORLNPGM(MSG_MAXTEMP_BED_OFF);
|
|
1172
|
+ LCD_ALERTMESSAGEPGM(MSG_ERR_MAXTEMP_BED); // translatable
|
1172
|
1173
|
}
|
1173
|
1174
|
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
|
1174
|
1175
|
Stop();
|