Browse Source

Move literal strings to language files

Scott Lahteine 9 years ago
parent
commit
fd1ea9d56f
3 changed files with 109 additions and 53 deletions
  1. 37
    0
      Marlin/language.h
  2. 34
    16
      Marlin/language_en.h
  3. 38
    37
      Marlin/temperature.cpp

+ 37
- 0
Marlin/language.h View File

159
 
159
 
160
 #define MSG_ERR_EEPROM_WRITE                "Error writing to EEPROM!"
160
 #define MSG_ERR_EEPROM_WRITE                "Error writing to EEPROM!"
161
 
161
 
162
+// temperature.cpp strings
163
+#define MSG_PID_AUTOTUNE                    "PID Autotune"
164
+#define MSG_PID_AUTOTUNE_START              MSG_PID_AUTOTUNE " start"
165
+#define MSG_PID_AUTOTUNE_FAILED             MSG_PID_AUTOTUNE " failed!"
166
+#define MSG_PID_BAD_EXTRUDER_NUM            MSG_PID_AUTOTUNE_FAILED " Bad extruder number"
167
+#define MSG_PID_TEMP_TOO_HIGH               MSG_PID_AUTOTUNE_FAILED " Temperature too high"
168
+#define MSG_PID_TIMEOUT                     MSG_PID_AUTOTUNE_FAILED " timeout"
169
+#define MSG_BIAS                            " bias: "
170
+#define MSG_D                               " d: "
171
+#define MSG_MIN                             " min: "
172
+#define MSG_MAX                             " max: "
173
+#define MSG_KU                              " Ku: "
174
+#define MSG_TU                              " Tu: "
175
+#define MSG_CLASSIC_PID                     " Classic PID "
176
+#define MSG_KP                              " Kp: "
177
+#define MSG_KI                              " Ki: "
178
+#define MSG_KD                              " Kd: "
179
+#define MSG_OK_B                            "ok B:"
180
+#define MSG_OK_T                            "ok T:"
181
+#define MSG_AT                              " @:"
182
+#define MSG_PID_AUTOTUNE_FINISHED           MSG_PID_AUTOTUNE " finished! Put the last Kp, Ki and Kd constants from above into Configuration.h"
183
+#define MSG_PID_DEBUG                       " PID_DEBUG "
184
+#define MSG_PID_DEBUG_INPUT                 ": Input "
185
+#define MSG_PID_DEBUG_OUTPUT                " Output "
186
+#define MSG_PID_DEBUG_PTERM                 " pTerm "
187
+#define MSG_PID_DEBUG_ITERM                 " iTerm "
188
+#define MSG_PID_DEBUG_DTERM                 " dTerm "
189
+#define MSG_HEATING_FAILED                  "Heating failed"
190
+#define MSG_EXTRUDER_SWITCHED_OFF           "Extruder switched off. Temperature difference between temp sensors is too high !"
191
+
192
+#define MSG_INVALID_EXTRUDER_NUM            " - Invalid extruder number !"
193
+#define MSG_THERMAL_RUNAWAY_STOP            "Thermal Runaway, system stopped! Heater_ID: "
194
+#define MSG_SWITCHED_OFF_MAX                " switched off. MAXTEMP triggered !!"
195
+#define MSG_MINTEMP_EXTRUDER_OFF            ": Extruder switched off. MINTEMP triggered !"
196
+#define MSG_MAXTEMP_EXTRUDER_OFF            ": Extruder" MSG_SWITCHED_OFF_MAX
197
+#define MSG_MAXTEMP_BED_OFF                 "Heated bed" MSG_SWITCHED_OFF_MAX
198
+
162
 // LCD Menu Messages
199
 // LCD Menu Messages
163
 
200
 
164
 // Add your own character. Reference: https://github.com/MarlinFirmware/Marlin/pull/1434 photos
201
 // Add your own character. Reference: https://github.com/MarlinFirmware/Marlin/pull/1434 photos

+ 34
- 16
Marlin/language_en.h View File

255
 #define MSG_VOLUMETRIC                      "Filament"
255
 #define MSG_VOLUMETRIC                      "Filament"
256
 #endif
256
 #endif
257
 #ifndef MSG_VOLUMETRIC_ENABLED
257
 #ifndef MSG_VOLUMETRIC_ENABLED
258
-#define MSG_VOLUMETRIC_ENABLED		        "E in mm" STR_h3
258
+#define MSG_VOLUMETRIC_ENABLED              "E in mm" STR_h3
259
 #endif
259
 #endif
260
 #ifndef MSG_FILAMENT_SIZE_EXTRUDER_0
260
 #ifndef MSG_FILAMENT_SIZE_EXTRUDER_0
261
 #define MSG_FILAMENT_SIZE_EXTRUDER_0        "Fil. Dia. 1"
261
 #define MSG_FILAMENT_SIZE_EXTRUDER_0        "Fil. Dia. 1"
383
 #ifndef MSG_ENDSTOP_ABORT
383
 #ifndef MSG_ENDSTOP_ABORT
384
 #define MSG_ENDSTOP_ABORT                   "Endstop abort"
384
 #define MSG_ENDSTOP_ABORT                   "Endstop abort"
385
 #endif
385
 #endif
386
+#ifndef MSG_HEATING_FAILED_LCD
387
+#define MSG_HEATING_FAILED_LCD              "Heating failed"
388
+#endif
389
+#ifndef MSG_ERR_REDUNDANT_TEMP
390
+#define MSG_ERR_REDUNDANT_TEMP              "Err: REDUNDANT TEMP ERROR"
391
+#endif
392
+#ifndef MSG_THERMAL_RUNAWAY
393
+#define MSG_THERMAL_RUNAWAY                 "THERMAL RUNAWAY"
394
+#endif
395
+#ifndef MSG_ERR_MAXTEMP
396
+#define MSG_ERR_MAXTEMP                     "Err: MAXTEMP"
397
+#endif
398
+#ifndef MSG_ERR_MINTEMP
399
+#define MSG_ERR_MINTEMP                     "Err: MINTEMP"
400
+#endif
401
+#ifndef MSG_ERR_MAXTEMP_BED
402
+#define MSG_ERR_MAXTEMP_BED                 "Err: MAXTEMP BED"
403
+#endif
386
 
404
 
387
 #ifdef DELTA_CALIBRATION_MENU
405
 #ifdef DELTA_CALIBRATION_MENU
388
-    #ifndef MSG_DELTA_CALIBRATE
389
-    #define MSG_DELTA_CALIBRATE             "Delta Calibration"
390
-    #endif
391
-    #ifndef MSG_DELTA_CALIBRATE_X
392
-    #define MSG_DELTA_CALIBRATE_X           "Calibrate X"
393
-    #endif
394
-    #ifndef MSG_DELTA_CALIBRATE_Y
395
-    #define MSG_DELTA_CALIBRATE_Y           "Calibrate Y"
396
-    #endif
397
-    #ifndef MSG_DELTA_CALIBRATE_Z
398
-    #define MSG_DELTA_CALIBRATE_Z           "Calibrate Z"
399
-    #endif
400
-    #ifndef MSG_DELTA_CALIBRATE_CENTER
401
-    #define MSG_DELTA_CALIBRATE_CENTER      "Calibrate Center"
402
-    #endif
406
+  #ifndef MSG_DELTA_CALIBRATE
407
+  #define MSG_DELTA_CALIBRATE             "Delta Calibration"
408
+  #endif
409
+  #ifndef MSG_DELTA_CALIBRATE_X
410
+  #define MSG_DELTA_CALIBRATE_X           "Calibrate X"
411
+  #endif
412
+  #ifndef MSG_DELTA_CALIBRATE_Y
413
+  #define MSG_DELTA_CALIBRATE_Y           "Calibrate Y"
414
+  #endif
415
+  #ifndef MSG_DELTA_CALIBRATE_Z
416
+  #define MSG_DELTA_CALIBRATE_Z           "Calibrate Z"
417
+  #endif
418
+  #ifndef MSG_DELTA_CALIBRATE_CENTER
419
+  #define MSG_DELTA_CALIBRATE_CENTER      "Calibrate Center"
420
+  #endif
403
 #endif // DELTA_CALIBRATION_MENU
421
 #endif // DELTA_CALIBRATION_MENU
404
 
422
 
405
 #endif // LANGUAGE_EN_H
423
 #endif // LANGUAGE_EN_H

+ 38
- 37
Marlin/temperature.cpp View File

33
 #include "ultralcd.h"
33
 #include "ultralcd.h"
34
 #include "temperature.h"
34
 #include "temperature.h"
35
 #include "watchdog.h"
35
 #include "watchdog.h"
36
+#include "language.h"
36
 
37
 
37
 #include "Sd2PinMap.h"
38
 #include "Sd2PinMap.h"
38
 
39
 
228
        || extruder < 0
229
        || extruder < 0
229
     #endif
230
     #endif
230
   ) {
231
   ) {
231
-    SERIAL_ECHOLN("PID Autotune failed. Bad extruder number.");
232
+    SERIAL_ECHOLN(MSG_PID_BAD_EXTRUDER_NUM);
232
     return;
233
     return;
233
   }
234
   }
234
 	
235
 	
235
-  SERIAL_ECHOLN("PID Autotune start");
236
+  SERIAL_ECHOLN(MSG_PID_AUTOTUNE_START);
236
 
237
 
237
   disable_heater(); // switch off all heaters.
238
   disable_heater(); // switch off all heaters.
238
 
239
 
287
             bias = constrain(bias, 20, max_pow - 20);
288
             bias = constrain(bias, 20, max_pow - 20);
288
             d = (bias > max_pow / 2) ? max_pow - 1 - bias : bias;
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
             if (cycles > 2) {
295
             if (cycles > 2) {
295
               Ku = (4.0 * d) / (3.14159265 * (max - min) / 2.0);
296
               Ku = (4.0 * d) / (3.14159265 * (max - min) / 2.0);
296
               Tu = ((float)(t_low + t_high) / 1000.0);
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
               Kp = 0.6 * Ku;
300
               Kp = 0.6 * Ku;
300
               Ki = 2 * Kp / Tu;
301
               Ki = 2 * Kp / Tu;
301
               Kd = Kp * Tu / 8;
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
               Kp = 0.33*Ku;
308
               Kp = 0.33*Ku;
308
               Ki = Kp/Tu;
309
               Ki = Kp/Tu;
331
       } 
332
       } 
332
     }
333
     }
333
     if (input > temp + 20) {
334
     if (input > temp + 20) {
334
-      SERIAL_PROTOCOLLNPGM("PID Autotune failed! Temperature too high");
335
+      SERIAL_PROTOCOLLNPGM(MSG_PID_TEMP_TOO_HIGH);
335
       return;
336
       return;
336
     }
337
     }
337
     // Every 2 seconds...
338
     // Every 2 seconds...
339
       int p;
340
       int p;
340
       if (extruder < 0) {
341
       if (extruder < 0) {
341
         p = soft_pwm_bed;
342
         p = soft_pwm_bed;
342
-        SERIAL_PROTOCOLPGM("ok B:");
343
+        SERIAL_PROTOCOLPGM(MSG_OK_B);
343
       }
344
       }
344
       else {
345
       else {
345
         p = soft_pwm[extruder];
346
         p = soft_pwm[extruder];
346
-        SERIAL_PROTOCOLPGM("ok T:");
347
+        SERIAL_PROTOCOLPGM(MSG_OK_T);
347
       }
348
       }
348
 
349
 
349
       SERIAL_PROTOCOL(input);
350
       SERIAL_PROTOCOL(input);
350
-      SERIAL_PROTOCOLPGM(" @:");
351
+      SERIAL_PROTOCOLPGM(MSG_AT);
351
       SERIAL_PROTOCOLLN(p);
352
       SERIAL_PROTOCOLLN(p);
352
 
353
 
353
       temp_millis = ms;
354
       temp_millis = ms;
354
     } // every 2 seconds
355
     } // every 2 seconds
355
     // Over 2 minutes?
356
     // Over 2 minutes?
356
     if (((ms - t1) + (ms - t2)) > (10L*60L*1000L*2L)) {
357
     if (((ms - t1) + (ms - t2)) > (10L*60L*1000L*2L)) {
357
-      SERIAL_PROTOCOLLNPGM("PID Autotune failed! timeout");
358
+      SERIAL_PROTOCOLLNPGM(MSG_PID_TIMEOUT);
358
       return;
359
       return;
359
     }
360
     }
360
     if (cycles > ncycles) {
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
       return;
363
       return;
363
     }
364
     }
364
     lcd_update();
365
     lcd_update();
571
 
572
 
572
       #ifdef PID_DEBUG
573
       #ifdef PID_DEBUG
573
         SERIAL_ECHO_START;
574
         SERIAL_ECHO_START;
574
-        SERIAL_ECHO(" PID_DEBUG ");
575
+        SERIAL_ECHO(MSG_PID_DEBUG);
575
         SERIAL_ECHO(e);
576
         SERIAL_ECHO(e);
576
-        SERIAL_ECHO(": Input ");
577
+        SERIAL_ECHO(MSG_PID_DEBUG_INPUT);
577
         SERIAL_ECHO(pid_input);
578
         SERIAL_ECHO(pid_input);
578
-        SERIAL_ECHO(" Output ");
579
+        SERIAL_ECHO(MSG_PID_DEBUG_OUTPUT);
579
         SERIAL_ECHO(pid_output);
580
         SERIAL_ECHO(pid_output);
580
-        SERIAL_ECHO(" pTerm ");
581
+        SERIAL_ECHO(MSG_PID_DEBUG_PTERM);
581
         SERIAL_ECHO(pTerm[e]);
582
         SERIAL_ECHO(pTerm[e]);
582
-        SERIAL_ECHO(" iTerm ");
583
+        SERIAL_ECHO(MSG_PID_DEBUG_ITERM);
583
         SERIAL_ECHO(iTerm[e]);
584
         SERIAL_ECHO(iTerm[e]);
584
-        SERIAL_ECHO(" dTerm ");
585
+        SERIAL_ECHO(MSG_PID_DEBUG_DTERM);
585
         SERIAL_ECHOLN(dTerm[e]);
586
         SERIAL_ECHOLN(dTerm[e]);
586
       #endif //PID_DEBUG
587
       #endif //PID_DEBUG
587
 
588
 
599
       if (watchmillis[e] && ms > watchmillis[e] + WATCH_TEMP_PERIOD) {
600
       if (watchmillis[e] && ms > watchmillis[e] + WATCH_TEMP_PERIOD) {
600
         if (degHotend(e) < watch_start_temp[e] + WATCH_TEMP_INCREASE) {
601
         if (degHotend(e) < watch_start_temp[e] + WATCH_TEMP_INCREASE) {
601
           setTargetHotend(0, e);
602
           setTargetHotend(0, e);
602
-          LCD_MESSAGEPGM("Heating failed");
603
+          LCD_MESSAGEPGM(MSG_HEATING_FAILED_LCD); // translatable
603
           SERIAL_ECHO_START;
604
           SERIAL_ECHO_START;
604
-          SERIAL_ECHOLNPGM("Heating failed");
605
+          SERIAL_ECHOLNPGM(MSG_HEATING_FAILED);
605
         }
606
         }
606
         else {
607
         else {
607
           watchmillis[e] = 0;
608
           watchmillis[e] = 0;
614
         disable_heater();
615
         disable_heater();
615
         if (IsStopped() == false) {
616
         if (IsStopped() == false) {
616
           SERIAL_ERROR_START;
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
         #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
621
         #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
621
           Stop();
622
           Stop();
728
   {
729
   {
729
       SERIAL_ERROR_START;
730
       SERIAL_ERROR_START;
730
       SERIAL_ERROR((int)e);
731
       SERIAL_ERROR((int)e);
731
-      SERIAL_ERRORLNPGM(" - Invalid extruder number !");
732
+      SERIAL_ERRORLNPGM(MSG_INVALID_EXTRUDER_NUM);
732
       kill();
733
       kill();
733
       return 0.0;
734
       return 0.0;
734
   } 
735
   } 
1074
       else if ( (ms - *timer) > ((unsigned long) period_seconds) * 1000)
1075
       else if ( (ms - *timer) > ((unsigned long) period_seconds) * 1000)
1075
       {
1076
       {
1076
         SERIAL_ERROR_START;
1077
         SERIAL_ERROR_START;
1077
-        SERIAL_ERRORLNPGM("Thermal Runaway, system stopped! Heater_ID: ");
1078
+        SERIAL_ERRORLNPGM(MSG_THERMAL_RUNAWAY_STOP);
1078
         SERIAL_ERRORLN((int)heater_id);
1079
         SERIAL_ERRORLN((int)heater_id);
1079
-        LCD_ALERTMESSAGEPGM("THERMAL RUNAWAY");
1080
+        LCD_ALERTMESSAGEPGM(MSG_THERMAL_RUNAWAY); // translatable
1080
         thermal_runaway = true;
1081
         thermal_runaway = true;
1081
         while(1)
1082
         while(1)
1082
         {
1083
         {
1140
   if(IsStopped() == false) {
1141
   if(IsStopped() == false) {
1141
     SERIAL_ERROR_START;
1142
     SERIAL_ERROR_START;
1142
     SERIAL_ERRORLN((int)e);
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
   #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
1147
   #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
1147
   Stop();
1148
   Stop();
1153
   if(IsStopped() == false) {
1154
   if(IsStopped() == false) {
1154
     SERIAL_ERROR_START;
1155
     SERIAL_ERROR_START;
1155
     SERIAL_ERRORLN((int)e);
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
   #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
1160
   #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
1160
   Stop();
1161
   Stop();
1167
   #endif
1168
   #endif
1168
   if (IsStopped() == false) {
1169
   if (IsStopped() == false) {
1169
     SERIAL_ERROR_START;
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
   #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
1174
   #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
1174
   Stop();
1175
   Stop();

Loading…
Cancel
Save