Browse Source

First cleanup. Moved all code to cpp files, so there are no dependencies on pde files. And no more odd requirement to cat files together. (Still need to fix the Makefile). Also cleaned up some defines and made defines upper case as by C coding conventions.

daid303 11 years ago
parent
commit
06b58a9c4f

+ 8
- 9
Marlin/Configuration_adv.h View File

181
 #define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
181
 #define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
182
 #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // no z because of layer shift.
182
 #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // no z because of layer shift.
183
 
183
 
184
-// The hardware watchdog should halt the Microcontroller, in case the firmware gets stuck somewhere. However:
185
-// the Watchdog is not working well, so please only enable this for testing
186
-// this enables the watchdog interrupt.
187
-//#define USE_WATCHDOG
188
-//#ifdef USE_WATCHDOG
189
-  // you cannot reboot on a mega2560 due to a bug in he bootloader. Hence, you have to reset manually, and this is done hereby:
184
+// The hardware watchdog should reset the Microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
185
+#define USE_WATCHDOG
186
+
187
+#ifdef USE_WATCHDOG
188
+// you cannot watchdog reboot on Arduino mega2560 due to a bug in he bootloader. Hence we need to ask the user to reset.
189
+//  THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled.
190
 //#define RESET_MANUAL
190
 //#define RESET_MANUAL
191
-//#define WATCHDOG_TIMEOUT 4  //seconds
192
-//#endif
191
+#endif
193
 
192
 
194
 // extruder advance constant (s2/mm3)
193
 // extruder advance constant (s2/mm3)
195
 //
194
 //
214
 #define MM_PER_ARC_SEGMENT 1
213
 #define MM_PER_ARC_SEGMENT 1
215
 #define N_ARC_CORRECTION 25
214
 #define N_ARC_CORRECTION 25
216
 
215
 
217
-const int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
216
+const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
218
 
217
 
219
 // If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted
218
 // If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted
220
 // You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT 
219
 // You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT 

+ 0
- 8
Marlin/EEPROMwrite.h View File

6
 #include "temperature.h"
6
 #include "temperature.h"
7
 //#include <EEPROM.h>
7
 //#include <EEPROM.h>
8
 
8
 
9
-int plaPreheatHotendTemp;
10
-int plaPreheatHPBTemp;
11
-int plaPreheatFanSpeed;
12
-
13
-int absPreheatHotendTemp;
14
-int absPreheatHPBTemp;
15
-int absPreheatFanSpeed;
16
-
17
 template <class T> int EEPROM_writeAnything(int &ee, const T& value)
9
 template <class T> int EEPROM_writeAnything(int &ee, const T& value)
18
 {
10
 {
19
   const byte* p = (const byte*)(const void*)&value;
11
   const byte* p = (const byte*)(const void*)&value;

+ 1
- 2
Marlin/LiquidCrystalRus.cpp View File

1
-#define __PROG_TYPES_COMPAT__
2
 #include "LiquidCrystalRus.h"
1
 #include "LiquidCrystalRus.h"
3
 
2
 
4
 #include <stdio.h>
3
 #include <stdio.h>
14
 
13
 
15
 // it is a russian alphabet translation
14
 // it is a russian alphabet translation
16
 // except 0401 --> 0xa2 = ╗, 0451 --> 0xb5
15
 // except 0401 --> 0xa2 = ╗, 0451 --> 0xb5
17
-const PROGMEM prog_uchar utf_recode[] = 
16
+const PROGMEM uint8_t utf_recode[] = 
18
        { 0x41,0xa0,0x42,0xa1,0xe0,0x45,0xa3,0xa4,0xa5,0xa6,0x4b,0xa7,0x4d,0x48,0x4f,
17
        { 0x41,0xa0,0x42,0xa1,0xe0,0x45,0xa3,0xa4,0xa5,0xa6,0x4b,0xa7,0x4d,0x48,0x4f,
19
          0xa8,0x50,0x43,0x54,0xa9,0xaa,0x58,0xe1,0xab,0xac,0xe2,0xad,0xae,0x62,0xaf,0xb0,0xb1,
18
          0xa8,0x50,0x43,0x54,0xa9,0xaa,0x58,0xe1,0xab,0xac,0xe2,0xad,0xae,0x62,0xaf,0xb0,0xb1,
20
          0x61,0xb2,0xb3,0xb4,0xe3,0x65,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0x6f,
19
          0x61,0xb2,0xb3,0xb4,0xe3,0x65,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0x6f,

+ 7
- 16
Marlin/Marlin.h View File

17
 #include <util/delay.h>
17
 #include <util/delay.h>
18
 #include <avr/pgmspace.h>
18
 #include <avr/pgmspace.h>
19
 #include <avr/eeprom.h>
19
 #include <avr/eeprom.h>
20
-#include  <avr/wdt.h>
21
-#include  <avr/interrupt.h>
20
+#include <avr/wdt.h>
21
+#include <avr/interrupt.h>
22
 
22
 
23
 
23
 
24
 #include "fastio.h"
24
 #include "fastio.h"
52
   #define MYSERIAL MSerial
52
   #define MYSERIAL MSerial
53
 #endif
53
 #endif
54
 
54
 
55
-//this is a unfinsihed attemp to removes a lot of warning messages, see:
56
-// http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=57011
57
-//typedef char prog_char PROGMEM; 
58
-// //#define PSTR    (s )        ((const PROGMEM char *)(s))
59
-// //# define MYPGM(s) (__extension__({static prog_char __c[] = (s); &__c[0];})) 
60
-// //#define MYPGM(s) ((const prog_char *g PROGMEM=s))
61
-#define MYPGM(s) PSTR(s)
62
-//#define MYPGM(s)  (__extension__({static char __c[] __attribute__((__progmem__)) = (s); &__c[0];}))  //This is the normal behaviour
63
-//#define MYPGM(s)  (__extension__({static prog_char __c[]  = (s); &__c[0];})) //this does not work but hides the warnings
64
-
65
-
66
 #define SERIAL_PROTOCOL(x) MYSERIAL.print(x);
55
 #define SERIAL_PROTOCOL(x) MYSERIAL.print(x);
67
 #define SERIAL_PROTOCOL_F(x,y) MYSERIAL.print(x,y);
56
 #define SERIAL_PROTOCOL_F(x,y) MYSERIAL.print(x,y);
68
-#define SERIAL_PROTOCOLPGM(x) serialprintPGM(MYPGM(x));
57
+#define SERIAL_PROTOCOLPGM(x) serialprintPGM(PSTR(x));
69
 #define SERIAL_PROTOCOLLN(x) {MYSERIAL.print(x);MYSERIAL.write('\n');}
58
 #define SERIAL_PROTOCOLLN(x) {MYSERIAL.print(x);MYSERIAL.write('\n');}
70
-#define SERIAL_PROTOCOLLNPGM(x) {serialprintPGM(MYPGM(x));MYSERIAL.write('\n');}
59
+#define SERIAL_PROTOCOLLNPGM(x) {serialprintPGM(PSTR(x));MYSERIAL.write('\n');}
71
 
60
 
72
 
61
 
73
 const char errormagic[] PROGMEM ="Error:";
62
 const char errormagic[] PROGMEM ="Error:";
92
 
81
 
93
 
82
 
94
 //things to write to serial from Programmemory. saves 400 to 2k of RAM.
83
 //things to write to serial from Programmemory. saves 400 to 2k of RAM.
95
-#define SerialprintPGM(x) serialprintPGM(MYPGM(x))
96
 FORCE_INLINE void serialprintPGM(const char *str)
84
 FORCE_INLINE void serialprintPGM(const char *str)
97
 {
85
 {
98
   char ch=pgm_read_byte(str);
86
   char ch=pgm_read_byte(str);
197
 extern float max_pos[3];
185
 extern float max_pos[3];
198
 extern unsigned char FanSpeed;
186
 extern unsigned char FanSpeed;
199
 
187
 
188
+extern unsigned long starttime;
189
+extern unsigned long stoptime;
190
+
200
 // Handling multiple extruders pins
191
 // Handling multiple extruders pins
201
 extern uint8_t active_extruder;
192
 extern uint8_t active_extruder;
202
 
193
 

+ 5
- 1834
Marlin/Marlin.pde
File diff suppressed because it is too large
View File


+ 1865
- 0
Marlin/Marlin_main.cpp
File diff suppressed because it is too large
View File


+ 8
- 5
Marlin/SdFile.cpp View File

55
  * Use writeError to check for errors.
55
  * Use writeError to check for errors.
56
  */
56
  */
57
 #if ARDUINO >= 100
57
 #if ARDUINO >= 100
58
-    size_t SdFile::write(uint8_t b)
58
+size_t SdFile::write(uint8_t b)
59
+{
60
+    return SdBaseFile::write(&b, 1);
61
+}
59
 #else
62
 #else
60
-  void SdFile::write(uint8_t b)
61
-#endif
63
+void SdFile::write(uint8_t b)
62
 {
64
 {
63
-  SdBaseFile::write(&b, 1);
65
+    SdBaseFile::write(&b, 1);
64
 }
66
 }
67
+#endif
65
 //------------------------------------------------------------------------------
68
 //------------------------------------------------------------------------------
66
 /** Write a string to a file. Used by the Arduino Print class.
69
 /** Write a string to a file. Used by the Arduino Print class.
67
  * \param[in] str Pointer to the string.
70
  * \param[in] str Pointer to the string.
89
 }
92
 }
90
 
93
 
91
 
94
 
92
-#endif
95
+#endif

+ 1
- 2
Marlin/planner.cpp View File

191
   // have to use intersection_distance() to calculate when to abort acceleration and start braking
191
   // have to use intersection_distance() to calculate when to abort acceleration and start braking
192
   // in order to reach the final_rate exactly at the end of this block.
192
   // in order to reach the final_rate exactly at the end of this block.
193
   if (plateau_steps < 0) {
193
   if (plateau_steps < 0) {
194
-    accelerate_steps = ceil(
195
-    intersection_distance(block->initial_rate, block->final_rate, acceleration, block->step_event_count));
194
+    accelerate_steps = ceil(intersection_distance(block->initial_rate, block->final_rate, acceleration, block->step_event_count));
196
     accelerate_steps = max(accelerate_steps,0); // Check limits due to numerical round-off
195
     accelerate_steps = max(accelerate_steps,0); // Check limits due to numerical round-off
197
     accelerate_steps = min(accelerate_steps,block->step_event_count);
196
     accelerate_steps = min(accelerate_steps,block->step_event_count);
198
     plateau_steps = 0;
197
     plateau_steps = 0;

+ 7
- 11
Marlin/temperature.cpp View File

145
 
145
 
146
 void PID_autotune(float temp, int extruder, int ncycles)
146
 void PID_autotune(float temp, int extruder, int ncycles)
147
 {
147
 {
148
-  float input;
148
+  float input = 0.0;
149
   int cycles=0;
149
   int cycles=0;
150
   bool heating = true;
150
   bool heating = true;
151
 
151
 
152
   unsigned long temp_millis = millis();
152
   unsigned long temp_millis = millis();
153
   unsigned long t1=temp_millis;
153
   unsigned long t1=temp_millis;
154
   unsigned long t2=temp_millis;
154
   unsigned long t2=temp_millis;
155
-  long t_high;
156
-  long t_low;
155
+  long t_high = 0;
156
+  long t_low = 0;
157
 
157
 
158
   long bias, d;
158
   long bias, d;
159
   float Ku, Tu;
159
   float Ku, Tu;
160
   float Kp, Ki, Kd;
160
   float Kp, Ki, Kd;
161
-  float max, min;
161
+  float max = 0, min = 10000;
162
 
162
 
163
 	if ((extruder > EXTRUDERS)
163
 	if ((extruder > EXTRUDERS)
164
   #if (TEMP_BED_PIN <= -1)
164
   #if (TEMP_BED_PIN <= -1)
315
 
315
 
316
 void manage_heater()
316
 void manage_heater()
317
 {
317
 {
318
-
319
-  #ifdef USE_WATCHDOG
320
-    wd_reset();
321
-  #endif
322
-  
323
   float pid_input;
318
   float pid_input;
324
   float pid_output;
319
   float pid_output;
325
 
320
 
326
   if(temp_meas_ready != true)   //better readability
321
   if(temp_meas_ready != true)   //better readability
327
     return; 
322
     return; 
328
 
323
 
324
+  //Reset the watchdog after we know we have a temperature measurement.
325
+  watchdog_reset();
326
+
329
   CRITICAL_SECTION_START;
327
   CRITICAL_SECTION_START;
330
   temp_meas_ready = false;
328
   temp_meas_ready = false;
331
   CRITICAL_SECTION_END;
329
   CRITICAL_SECTION_END;
548
 #elif defined BED_USES_AD595
546
 #elif defined BED_USES_AD595
549
     return lround(((celsius-TEMP_SENSOR_AD595_OFFSET)/TEMP_SENSOR_AD595_GAIN) * (1024.0 * OVERSAMPLENR/ (5.0 * 100.0) ) );
547
     return lround(((celsius-TEMP_SENSOR_AD595_OFFSET)/TEMP_SENSOR_AD595_GAIN) * (1024.0 * OVERSAMPLENR/ (5.0 * 100.0) ) );
550
 #else
548
 #else
551
-    #warning No heater-type defined for the bed.
552
     return 0;
549
     return 0;
553
 #endif
550
 #endif
554
 }
551
 }
625
   #elif defined BED_USES_AD595
622
   #elif defined BED_USES_AD595
626
     return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
623
     return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
627
   #else
624
   #else
628
-    #warning No heater-type defined for the bed.
629
     return 0;
625
     return 0;
630
   #endif
626
   #endif
631
 }
627
 }

Marlin/ultralcd.pde → Marlin/ultralcd.cpp View File

6
 #include "language.h"
6
 #include "language.h"
7
 #include "temperature.h"
7
 #include "temperature.h"
8
 #include "EEPROMwrite.h"
8
 #include "EEPROMwrite.h"
9
-#if LANGUAGE_CHOICE == 6
10
-#include "LiquidCrystalRus.h"
11
-#else
12
-#include <LiquidCrystal.h>
13
-#endif
9
+
14
 //===========================================================================
10
 //===========================================================================
15
 //=============================imported variables============================
11
 //=============================imported variables============================
16
 //===========================================================================
12
 //===========================================================================
33
 long encoderpos=0;
29
 long encoderpos=0;
34
 short lastenc=0;
30
 short lastenc=0;
35
 
31
 
32
+//TODO: This should be in a preferences file.
33
+int plaPreheatHotendTemp;
34
+int plaPreheatHPBTemp;
35
+int plaPreheatFanSpeed;
36
+
37
+int absPreheatHotendTemp;
38
+int absPreheatHPBTemp;
39
+int absPreheatFanSpeed;
36
 
40
 
37
 //===========================================================================
41
 //===========================================================================
38
 //=============================private  variables============================
42
 //=============================private  variables============================
42
 //return for string conversion routines
46
 //return for string conversion routines
43
 static char conv[8];
47
 static char conv[8];
44
 
48
 
45
-#if LANGUAGE_CHOICE == 6
46
-LiquidCrystalRus lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7);  //RS,Enable,D4,D5,D6,D7
47
-#else
48
-LiquidCrystal lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7);  //RS,Enable,D4,D5,D6,D7 
49
-#endif
49
+LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7);  //RS,Enable,D4,D5,D6,D7
50
 
50
 
51
 static unsigned long previous_millis_lcd=0;
51
 static unsigned long previous_millis_lcd=0;
52
 //static long previous_millis_buttons=0;
52
 //static long previous_millis_buttons=0;
70
     ch=pgm_read_byte(++str);
70
     ch=pgm_read_byte(++str);
71
   }
71
   }
72
 }
72
 }
73
-#define lcdprintPGM(x) lcdProgMemprint(MYPGM(x))
73
+#define LCD_PRINT_PGM(x) lcdProgMemprint(PSTR(x))
74
 
74
 
75
 
75
 
76
 //===========================================================================
76
 //===========================================================================
366
   {
366
   {
367
     encoderpos=feedmultiply;
367
     encoderpos=feedmultiply;
368
     clear();
368
     clear();
369
-    lcd.setCursor(0,0);lcdprintPGM("\002000/000\001 ");
369
+    lcd.setCursor(0,0);LCD_PRINT_PGM("\002000/000\001 ");
370
     #if defined BED_USES_THERMISTOR || defined BED_USES_AD595 
370
     #if defined BED_USES_THERMISTOR || defined BED_USES_AD595 
371
-      lcd.setCursor(10,0);lcdprintPGM("B000/000\001 ");
371
+      lcd.setCursor(10,0);LCD_PRINT_PGM("B000/000\001 ");
372
     #elif EXTRUDERS > 1
372
     #elif EXTRUDERS > 1
373
-      lcd.setCursor(10,0);lcdprintPGM("\002000/000\001 ");
373
+      lcd.setCursor(10,0);LCD_PRINT_PGM("\002000/000\001 ");
374
     #endif
374
     #endif
375
   }
375
   }
376
     
376
     
432
     
432
     
433
     if(starttime!=oldtime)
433
     if(starttime!=oldtime)
434
     {
434
     {
435
-      lcd.print(itostr2(time/60));lcdprintPGM("h ");lcd.print(itostr2(time%60));lcdprintPGM("m");
435
+      lcd.print(itostr2(time/60));LCD_PRINT_PGM("h ");lcd.print(itostr2(time%60));LCD_PRINT_PGM("m");
436
       oldtime=time;
436
       oldtime=time;
437
     }
437
     }
438
   }
438
   }
441
   if((currentz!=oldzpos)||force_lcd_update)
441
   if((currentz!=oldzpos)||force_lcd_update)
442
   {
442
   {
443
     lcd.setCursor(10,1);
443
     lcd.setCursor(10,1);
444
-    lcdprintPGM("Z:");lcd.print(ftostr52(current_position[2]));
444
+    LCD_PRINT_PGM("Z:");lcd.print(ftostr52(current_position[2]));
445
     oldzpos=currentz;
445
     oldzpos=currentz;
446
   }
446
   }
447
   
447
   
468
   {
468
   {
469
    oldfeedmultiply=curfeedmultiply;
469
    oldfeedmultiply=curfeedmultiply;
470
    lcd.setCursor(0,2);
470
    lcd.setCursor(0,2);
471
-   lcd.print(itostr3(curfeedmultiply));lcdprintPGM("% ");
471
+   lcd.print(itostr3(curfeedmultiply));LCD_PRINT_PGM("% ");
472
   }
472
   }
473
   
473
   
474
   if(messagetext[0]!='\0')
474
   if(messagetext[0]!='\0')
487
   {
487
   {
488
      lcd.setCursor(10,2);
488
      lcd.setCursor(10,2);
489
     lcd.print(itostr3((int)percent));
489
     lcd.print(itostr3((int)percent));
490
-    lcdprintPGM("%SD");
490
+    LCD_PRINT_PGM("%SD");
491
   }
491
   }
492
 #endif
492
 #endif
493
 #else //smaller LCDS----------------------------------
493
 #else //smaller LCDS----------------------------------
496
   if(force_lcd_update)  //initial display of content
496
   if(force_lcd_update)  //initial display of content
497
   {
497
   {
498
     encoderpos=feedmultiply;
498
     encoderpos=feedmultiply;
499
-    lcd.setCursor(0,0);lcdprintPGM("\002---/---\001 ");
499
+    lcd.setCursor(0,0);LCD_PRINT_PGM("\002---/---\001 ");
500
   }
500
   }
501
     
501
     
502
   int tHotEnd0=intround(degHotend0());
502
   int tHotEnd0=intround(degHotend0());
550
   switch(i)
550
   switch(i)
551
   {
551
   {
552
     case ItemP_exit:
552
     case ItemP_exit:
553
-      MENUITEM(  lcdprintPGM(MSG_MAIN)  ,  BLOCK;status=Main_Menu;beepshort(); ) ;
553
+      MENUITEM(  LCD_PRINT_PGM(MSG_MAIN)  ,  BLOCK;status=Main_Menu;beepshort(); ) ;
554
       break;
554
       break;
555
     case ItemP_autostart:
555
     case ItemP_autostart:
556
-      MENUITEM(  lcdprintPGM(MSG_AUTOSTART)  ,  BLOCK;
556
+      MENUITEM(  LCD_PRINT_PGM(MSG_AUTOSTART)  ,  BLOCK;
557
 #ifdef SDSUPPORT
557
 #ifdef SDSUPPORT
558
           card.lastnr=0;card.setroot();card.checkautostart(true);
558
           card.lastnr=0;card.setroot();card.checkautostart(true);
559
 #endif
559
 #endif
560
           beepshort(); ) ;
560
           beepshort(); ) ;
561
       break;
561
       break;
562
     case ItemP_disstep:
562
     case ItemP_disstep:
563
-      MENUITEM(  lcdprintPGM(MSG_DISABLE_STEPPERS)  ,  BLOCK;enquecommand("M84");beepshort(); ) ;
563
+      MENUITEM(  LCD_PRINT_PGM(MSG_DISABLE_STEPPERS)  ,  BLOCK;enquecommand("M84");beepshort(); ) ;
564
       break;
564
       break;
565
     case ItemP_home:
565
     case ItemP_home:
566
-      MENUITEM(  lcdprintPGM(MSG_AUTO_HOME)  ,  BLOCK;enquecommand("G28");beepshort(); ) ;
566
+      MENUITEM(  LCD_PRINT_PGM(MSG_AUTO_HOME)  ,  BLOCK;enquecommand("G28");beepshort(); ) ;
567
       break;
567
       break;
568
     case ItemP_origin:
568
     case ItemP_origin:
569
-      MENUITEM(  lcdprintPGM(MSG_SET_ORIGIN)  ,  BLOCK;enquecommand("G92 X0 Y0 Z0");beepshort(); ) ;
569
+      MENUITEM(  LCD_PRINT_PGM(MSG_SET_ORIGIN)  ,  BLOCK;enquecommand("G92 X0 Y0 Z0");beepshort(); ) ;
570
       break;
570
       break;
571
     case ItemP_preheat_pla:
571
     case ItemP_preheat_pla:
572
-		MENUITEM(  lcdprintPGM(MSG_PREHEAT_PLA)  ,  BLOCK;setTargetHotend0(plaPreheatHotendTemp);setTargetBed(plaPreheatHPBTemp);
572
+		MENUITEM(  LCD_PRINT_PGM(MSG_PREHEAT_PLA)  ,  BLOCK;setTargetHotend0(plaPreheatHotendTemp);setTargetBed(plaPreheatHPBTemp);
573
       #if FAN_PIN > -1
573
       #if FAN_PIN > -1
574
 		FanSpeed = plaPreheatFanSpeed;
574
 		FanSpeed = plaPreheatFanSpeed;
575
         analogWrite(FAN_PIN,  FanSpeed);
575
         analogWrite(FAN_PIN,  FanSpeed);
577
       beepshort(); );
577
       beepshort(); );
578
       break;
578
       break;
579
     case ItemP_preheat_abs:
579
     case ItemP_preheat_abs:
580
-      MENUITEM(  lcdprintPGM(MSG_PREHEAT_ABS)  ,  BLOCK;setTargetHotend0(absPreheatHotendTemp);setTargetBed(absPreheatHPBTemp); 
580
+      MENUITEM(  LCD_PRINT_PGM(MSG_PREHEAT_ABS)  ,  BLOCK;setTargetHotend0(absPreheatHotendTemp);setTargetBed(absPreheatHPBTemp); 
581
       #if FAN_PIN > -1
581
       #if FAN_PIN > -1
582
 	  	FanSpeed = absPreheatFanSpeed;
582
 	  	FanSpeed = absPreheatFanSpeed;
583
         analogWrite(FAN_PIN,  FanSpeed);
583
         analogWrite(FAN_PIN,  FanSpeed);
585
       beepshort(); );
585
       beepshort(); );
586
       break;
586
       break;
587
     case ItemP_cooldown:
587
     case ItemP_cooldown:
588
-      MENUITEM(  lcdprintPGM(MSG_COOLDOWN)  ,  BLOCK;setTargetHotend0(0);setTargetHotend1(0);setTargetHotend2(0);setTargetBed(0);beepshort(); ) ;
588
+      MENUITEM(  LCD_PRINT_PGM(MSG_COOLDOWN)  ,  BLOCK;setTargetHotend0(0);setTargetHotend1(0);setTargetHotend2(0);setTargetBed(0);beepshort(); ) ;
589
       break;
589
       break;
590
 //    case ItemP_extrude:
590
 //    case ItemP_extrude:
591
-  //    MENUITEM(  lcdprintPGM(" Extrude")  ,  BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E50");beepshort(); ) ;
591
+  //    MENUITEM(  LCD_PRINT_PGM(" Extrude")  ,  BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E50");beepshort(); ) ;
592
     //  break;
592
     //  break;
593
     case ItemP_move:
593
     case ItemP_move:
594
-      MENUITEM(  lcdprintPGM(MSG_MOVE_AXIS) , BLOCK;status=Sub_PrepareMove;beepshort(); );
594
+      MENUITEM(  LCD_PRINT_PGM(MSG_MOVE_AXIS) , BLOCK;status=Sub_PrepareMove;beepshort(); );
595
       break;
595
       break;
596
         default:   
596
         default:   
597
       break;
597
       break;
617
      switch(i)
617
      switch(i)
618
       {
618
       {
619
           case ItemAM_exit:
619
           case ItemAM_exit:
620
-          MENUITEM(  lcdprintPGM(MSG_PREPARE_ALT)  ,  BLOCK;status=Main_Prepare;beepshort(); ) ;
620
+          MENUITEM(  LCD_PRINT_PGM(MSG_PREPARE_ALT)  ,  BLOCK;status=Main_Prepare;beepshort(); ) ;
621
           break;
621
           break;
622
           case ItemAM_X:
622
           case ItemAM_X:
623
           {
623
           {
624
 	 	  //oldencoderpos=0;
624
 	 	  //oldencoderpos=0;
625
                   if(force_lcd_update)
625
                   if(force_lcd_update)
626
                   {
626
                   {
627
-                    lcd.setCursor(0,line);lcdprintPGM(" X:");
627
+                    lcd.setCursor(0,line);LCD_PRINT_PGM(" X:");
628
                     lcd.setCursor(11,line);lcd.print(ftostr52(current_position[X_AXIS]));
628
                     lcd.setCursor(11,line);lcd.print(ftostr52(current_position[X_AXIS]));
629
                   }
629
                   }
630
       
630
       
669
             {
669
             {
670
                   if(force_lcd_update)
670
                   if(force_lcd_update)
671
                   {
671
                   {
672
-                    lcd.setCursor(0,line);lcdprintPGM(" Y:");
672
+                    lcd.setCursor(0,line);LCD_PRINT_PGM(" Y:");
673
                     lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Y_AXIS]));
673
                     lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Y_AXIS]));
674
                   }
674
                   }
675
       
675
       
714
           {
714
           {
715
                   if(force_lcd_update)
715
                   if(force_lcd_update)
716
                   {
716
                   {
717
-                    lcd.setCursor(0,line);lcdprintPGM(" Z:");
717
+                    lcd.setCursor(0,line);LCD_PRINT_PGM(" Z:");
718
                     lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Z_AXIS]));
718
                     lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Z_AXIS]));
719
                   }
719
                   }
720
       
720
       
757
           break;
757
           break;
758
           case ItemAM_E:
758
           case ItemAM_E:
759
           // ErikDB: TODO: this length should be changed for volumetric.
759
           // ErikDB: TODO: this length should be changed for volumetric.
760
-          MENUITEM(  lcdprintPGM(MSG_EXTRUDE)  ,  BLOCK;enquecommand("G92 E0");enquecommand("G1 F70 E1");beepshort(); ) ;
760
+          MENUITEM(  LCD_PRINT_PGM(MSG_EXTRUDE)  ,  BLOCK;enquecommand("G92 E0");enquecommand("G1 F70 E1");beepshort(); ) ;
761
           break;
761
           break;
762
           case ItemAM_ERetract:
762
           case ItemAM_ERetract:
763
               // ErikDB: TODO: this length should be changed for volumetric.
763
               // ErikDB: TODO: this length should be changed for volumetric.
764
-              MENUITEM(  lcdprintPGM(MSG_RETRACT)  ,  BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E-1");beepshort(); ) ;
764
+              MENUITEM(  LCD_PRINT_PGM(MSG_RETRACT)  ,  BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E-1");beepshort(); ) ;
765
               break;
765
               break;
766
           default:
766
           default:
767
           break;
767
           break;
787
   switch(i)
787
   switch(i)
788
   {
788
   {
789
   case ItemT_exit:
789
   case ItemT_exit:
790
-      MENUITEM(  lcdprintPGM(MSG_MAIN)  ,  BLOCK;status=Main_Menu;beepshort(); ) ;
790
+      MENUITEM(  LCD_PRINT_PGM(MSG_MAIN)  ,  BLOCK;status=Main_Menu;beepshort(); ) ;
791
       break;
791
       break;
792
   case ItemT_speed:
792
   case ItemT_speed:
793
     {
793
     {
794
       if(force_lcd_update)
794
       if(force_lcd_update)
795
       {
795
       {
796
-        lcd.setCursor(0,line);lcdprintPGM(MSG_SPEED);
796
+        lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_SPEED);
797
         lcd.setCursor(13,line);lcd.print(ftostr3(feedmultiply));
797
         lcd.setCursor(13,line);lcd.print(ftostr3(feedmultiply));
798
       }
798
       }
799
       
799
       
828
       {
828
       {
829
         if(force_lcd_update)
829
         if(force_lcd_update)
830
         {
830
         {
831
-          lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE);
831
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_NOZZLE);
832
           lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
832
           lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
833
         } 
833
         } 
834
         
834
         
862
       {
862
       {
863
         if(force_lcd_update)
863
         if(force_lcd_update)
864
         {
864
         {
865
-          lcd.setCursor(0,line);lcdprintPGM(MSG_BED);
865
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_BED);
866
           lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
866
           lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
867
         }
867
         }
868
         
868
         
898
       {
898
       {
899
         if(force_lcd_update)
899
         if(force_lcd_update)
900
         {
900
         {
901
-          lcd.setCursor(0,line);lcdprintPGM(MSG_FAN_SPEED);
901
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_FAN_SPEED);
902
           lcd.setCursor(13,line);lcd.print(ftostr3(FanSpeed));
902
           lcd.setCursor(13,line);lcd.print(ftostr3(FanSpeed));
903
         }
903
         }
904
         
904
         
933
          {
933
          {
934
       if(force_lcd_update)
934
       if(force_lcd_update)
935
         {
935
         {
936
-          lcd.setCursor(0,line);lcdprintPGM(MSG_FLOW);
936
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_FLOW);
937
           lcd.setCursor(13,line);lcd.print(ftostr52(axis_steps_per_unit[E_AXIS]));
937
           lcd.setCursor(13,line);lcd.print(ftostr52(axis_steps_per_unit[E_AXIS]));
938
         }
938
         }
939
         
939
         
975
  updateActiveLines(ItemT_fan,encoderpos);
975
  updateActiveLines(ItemT_fan,encoderpos);
976
 }
976
 }
977
 
977
 
978
-//does not work
979
-// #define MENUCHANGEITEM(repaint_action,  enter_action, accept_action,  change_action) \
980
-//   {\
981
-//     if(force_lcd_update)  { lcd.setCursor(0,line);  repaint_action; } \
982
-//     if(activeline==line)  \
983
-//     { \
984
-//       if(CLICKED) \
985
-//       { \
986
-//         linechanging=!linechanging; \
987
-//         if(linechanging)  {enter_action;} \
988
-//         else {accept_action;} \
989
-//       }  \
990
-//       else \
991
-//       if(linechanging) {change_action};}\
992
-//   }
993
-//   
978
+/*does not work
979
+#define MENUCHANGEITEM(repaint_action,  enter_action, accept_action,  change_action) \
980
+   {\
981
+     if(force_lcd_update)  { lcd.setCursor(0,line);  repaint_action; } \
982
+     if(activeline==line)  \
983
+     { \
984
+       if(CLICKED) \
985
+       { \
986
+         linechanging=!linechanging; \
987
+         if(linechanging)  {enter_action;} \
988
+         else {accept_action;} \
989
+       }  \
990
+       else \
991
+       if(linechanging) {change_action};}\
992
+   }
993
+*/   
994
 
994
 
995
 enum {
995
 enum {
996
   ItemCT_exit,ItemCT_nozzle0,
996
   ItemCT_exit,ItemCT_nozzle0,
1022
   switch(i)
1022
   switch(i)
1023
   {
1023
   {
1024
     case ItemCT_exit:
1024
     case ItemCT_exit:
1025
-      MENUITEM(  lcdprintPGM(MSG_CONTROL)  ,  BLOCK;status=Main_Control;beepshort(); ) ;
1025
+      MENUITEM(  LCD_PRINT_PGM(MSG_CONTROL)  ,  BLOCK;status=Main_Control;beepshort(); ) ;
1026
       break;
1026
       break;
1027
     case ItemCT_nozzle0:
1027
     case ItemCT_nozzle0:
1028
       {
1028
       {
1029
         if(force_lcd_update)
1029
         if(force_lcd_update)
1030
         {
1030
         {
1031
-          lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE);
1031
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_NOZZLE);
1032
           lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
1032
           lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
1033
         }
1033
         }
1034
         
1034
         
1063
       {
1063
       {
1064
         if(force_lcd_update)
1064
         if(force_lcd_update)
1065
         {
1065
         {
1066
-          lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE1);
1066
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_NOZZLE1);
1067
           lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend1())));
1067
           lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend1())));
1068
         }
1068
         }
1069
         
1069
         
1099
       {
1099
       {
1100
         if(force_lcd_update)
1100
         if(force_lcd_update)
1101
         {
1101
         {
1102
-          lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE2);
1102
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_NOZZLE2);
1103
           lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend2())));
1103
           lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend2())));
1104
         }
1104
         }
1105
         
1105
         
1135
       {
1135
       {
1136
         if(force_lcd_update)
1136
         if(force_lcd_update)
1137
         {
1137
         {
1138
-          lcd.setCursor(0,line);lcdprintPGM(MSG_MIN);
1138
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_MIN);
1139
           lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_min));
1139
           lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_min));
1140
         }
1140
         }
1141
         
1141
         
1169
       {
1169
       {
1170
         if(force_lcd_update)
1170
         if(force_lcd_update)
1171
         {
1171
         {
1172
-          lcd.setCursor(0,line);lcdprintPGM(MSG_MAX);
1172
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_MAX);
1173
           lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_max));
1173
           lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_max));
1174
         }
1174
         }
1175
         
1175
         
1203
       {
1203
       {
1204
         if(force_lcd_update)
1204
         if(force_lcd_update)
1205
         {
1205
         {
1206
-          lcd.setCursor(0,line);lcdprintPGM(MSG_FACTOR);
1206
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_FACTOR);
1207
           lcd.setCursor(13,line);lcd.print(ftostr32(autotemp_factor));
1207
           lcd.setCursor(13,line);lcd.print(ftostr32(autotemp_factor));
1208
         }
1208
         }
1209
         
1209
         
1237
       {
1237
       {
1238
         if(force_lcd_update)
1238
         if(force_lcd_update)
1239
         {
1239
         {
1240
-          lcd.setCursor(0,line);lcdprintPGM(MSG_AUTOTEMP);
1240
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_AUTOTEMP);
1241
           lcd.setCursor(13,line);
1241
           lcd.setCursor(13,line);
1242
           if(autotemp_enabled)
1242
           if(autotemp_enabled)
1243
-            lcdprintPGM(MSG_ON);
1243
+            LCD_PRINT_PGM(MSG_ON);
1244
           else
1244
           else
1245
-            lcdprintPGM(MSG_OFF);
1245
+            LCD_PRINT_PGM(MSG_OFF);
1246
         }
1246
         }
1247
         
1247
         
1248
         if((activeline!=line) )
1248
         if((activeline!=line) )
1253
           autotemp_enabled=!autotemp_enabled;
1253
           autotemp_enabled=!autotemp_enabled;
1254
           lcd.setCursor(13,line);
1254
           lcd.setCursor(13,line);
1255
           if(autotemp_enabled)
1255
           if(autotemp_enabled)
1256
-            lcdprintPGM(MSG_ON);
1256
+            LCD_PRINT_PGM(MSG_ON);
1257
           else
1257
           else
1258
-            lcdprintPGM(MSG_OFF);
1258
+            LCD_PRINT_PGM(MSG_OFF);
1259
           BLOCK;
1259
           BLOCK;
1260
         }
1260
         }
1261
         
1261
         
1266
       {
1266
       {
1267
         if(force_lcd_update)
1267
         if(force_lcd_update)
1268
         {
1268
         {
1269
-          lcd.setCursor(0,line);lcdprintPGM(MSG_BED);
1269
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_BED);
1270
           lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
1270
           lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
1271
         }
1271
         }
1272
         
1272
         
1300
       {
1300
       {
1301
         if(force_lcd_update)
1301
         if(force_lcd_update)
1302
         {
1302
         {
1303
-          lcd.setCursor(0,line);lcdprintPGM(MSG_FAN_SPEED);
1303
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_FAN_SPEED);
1304
           lcd.setCursor(13,line);lcd.print(ftostr3(FanSpeed));
1304
           lcd.setCursor(13,line);lcd.print(ftostr3(FanSpeed));
1305
         }
1305
         }
1306
         
1306
         
1336
       {
1336
       {
1337
       if(force_lcd_update)
1337
       if(force_lcd_update)
1338
         {
1338
         {
1339
-          lcd.setCursor(0,line);lcdprintPGM(" PID-P: ");
1339
+          lcd.setCursor(0,line);LCD_PRINT_PGM(" PID-P: ");
1340
           lcd.setCursor(13,line);lcd.print(itostr4(Kp));
1340
           lcd.setCursor(13,line);lcd.print(itostr4(Kp));
1341
         }
1341
         }
1342
         
1342
         
1371
       {
1371
       {
1372
       if(force_lcd_update)
1372
       if(force_lcd_update)
1373
         {
1373
         {
1374
-          lcd.setCursor(0,line);lcdprintPGM(MSG_PID_I);
1374
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_PID_I);
1375
           lcd.setCursor(13,line);lcd.print(ftostr51(Ki/PID_dT));
1375
           lcd.setCursor(13,line);lcd.print(ftostr51(Ki/PID_dT));
1376
         }
1376
         }
1377
         
1377
         
1406
       {
1406
       {
1407
       if(force_lcd_update)
1407
       if(force_lcd_update)
1408
         {
1408
         {
1409
-          lcd.setCursor(0,line);lcdprintPGM(MSG_PID_D);
1409
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_PID_D);
1410
           lcd.setCursor(13,line);lcd.print(itostr4(Kd*PID_dT));
1410
           lcd.setCursor(13,line);lcd.print(itostr4(Kd*PID_dT));
1411
         }
1411
         }
1412
         
1412
         
1443
       {
1443
       {
1444
       if(force_lcd_update)
1444
       if(force_lcd_update)
1445
         {
1445
         {
1446
-          lcd.setCursor(0,line);lcdprintPGM(MSG_PID_C);
1446
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_PID_C);
1447
           lcd.setCursor(13,line);lcd.print(itostr3(Kc));
1447
           lcd.setCursor(13,line);lcd.print(itostr3(Kc));
1448
         }
1448
         }
1449
         
1449
         
1478
     #endif
1478
     #endif
1479
       break;
1479
       break;
1480
 	  case ItemCT_PLA_PreHeat_Setting:
1480
 	  case ItemCT_PLA_PreHeat_Setting:
1481
-        MENUITEM(  lcdprintPGM(MSG_PREHEAT_PLA_SETTINGS)  ,  BLOCK;status=Sub_PreheatPLASettings;beepshort(); ) ;
1481
+        MENUITEM(  LCD_PRINT_PGM(MSG_PREHEAT_PLA_SETTINGS)  ,  BLOCK;status=Sub_PreheatPLASettings;beepshort(); ) ;
1482
 	  break;
1482
 	  break;
1483
 	  case ItemCT_ABS_PreHeat_Setting:
1483
 	  case ItemCT_ABS_PreHeat_Setting:
1484
-        MENUITEM(  lcdprintPGM(MSG_PREHEAT_ABS_SETTINGS)  ,  BLOCK;status=Sub_PreheatABSSettings;beepshort(); ) ;
1484
+        MENUITEM(  LCD_PRINT_PGM(MSG_PREHEAT_ABS_SETTINGS)  ,  BLOCK;status=Sub_PreheatABSSettings;beepshort(); ) ;
1485
 	  break;
1485
 	  break;
1486
     default:   
1486
     default:   
1487
       break;
1487
       break;
1513
   switch(i)
1513
   switch(i)
1514
   {
1514
   {
1515
     case ItemCM_exit:
1515
     case ItemCM_exit:
1516
-      MENUITEM(  lcdprintPGM(MSG_CONTROL)  ,  BLOCK;status=Main_Control;beepshort(); ) ;
1516
+      MENUITEM(  LCD_PRINT_PGM(MSG_CONTROL)  ,  BLOCK;status=Main_Control;beepshort(); ) ;
1517
       break;
1517
       break;
1518
     case ItemCM_acc:
1518
     case ItemCM_acc:
1519
     {
1519
     {
1520
       if(force_lcd_update)
1520
       if(force_lcd_update)
1521
         {
1521
         {
1522
-          lcd.setCursor(0,line);lcdprintPGM(MSG_ACC);
1523
-          lcd.setCursor(13,line);lcd.print(itostr3(acceleration/100));lcdprintPGM("00");
1522
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_ACC);
1523
+          lcd.setCursor(13,line);lcd.print(itostr3(acceleration/100));LCD_PRINT_PGM("00");
1524
         }
1524
         }
1525
         
1525
         
1526
         if((activeline!=line) )
1526
         if((activeline!=line) )
1545
         {
1545
         {
1546
           if(encoderpos<5) encoderpos=5;
1546
           if(encoderpos<5) encoderpos=5;
1547
           if(encoderpos>990) encoderpos=990;
1547
           if(encoderpos>990) encoderpos=990;
1548
-          lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));lcdprintPGM("00");
1548
+          lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));LCD_PRINT_PGM("00");
1549
         }
1549
         }
1550
         
1550
         
1551
       }break;
1551
       }break;
1553
       {
1553
       {
1554
       if(force_lcd_update)
1554
       if(force_lcd_update)
1555
         {
1555
         {
1556
-          lcd.setCursor(0,line);lcdprintPGM(MSG_VXY_JERK);
1556
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_VXY_JERK);
1557
           lcd.setCursor(13,line);lcd.print(itostr3(max_xy_jerk));
1557
           lcd.setCursor(13,line);lcd.print(itostr3(max_xy_jerk));
1558
         }
1558
         }
1559
         
1559
         
1592
       {
1592
       {
1593
       if(force_lcd_update)
1593
       if(force_lcd_update)
1594
         {
1594
         {
1595
-          lcd.setCursor(0,line);lcdprintPGM(MSG_VMAX);
1596
-          if(i==ItemCM_vmaxx)lcdprintPGM(MSG_X);
1597
-          if(i==ItemCM_vmaxy)lcdprintPGM(MSG_Y);
1598
-          if(i==ItemCM_vmaxz)lcdprintPGM(MSG_Z);
1599
-          if(i==ItemCM_vmaxe)lcdprintPGM(MSG_E);
1595
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_VMAX);
1596
+          if(i==ItemCM_vmaxx)LCD_PRINT_PGM(MSG_X);
1597
+          if(i==ItemCM_vmaxy)LCD_PRINT_PGM(MSG_Y);
1598
+          if(i==ItemCM_vmaxz)LCD_PRINT_PGM(MSG_Z);
1599
+          if(i==ItemCM_vmaxe)LCD_PRINT_PGM(MSG_E);
1600
           lcd.setCursor(13,line);lcd.print(itostr3(max_feedrate[i-ItemCM_vmaxx]));
1600
           lcd.setCursor(13,line);lcd.print(itostr3(max_feedrate[i-ItemCM_vmaxx]));
1601
         }
1601
         }
1602
         
1602
         
1632
     {
1632
     {
1633
       if(force_lcd_update)
1633
       if(force_lcd_update)
1634
         {
1634
         {
1635
-          lcd.setCursor(0,line);lcdprintPGM(MSG_VMIN);
1635
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_VMIN);
1636
           lcd.setCursor(13,line);lcd.print(itostr3(minimumfeedrate));
1636
           lcd.setCursor(13,line);lcd.print(itostr3(minimumfeedrate));
1637
         }
1637
         }
1638
         
1638
         
1667
     {
1667
     {
1668
       if(force_lcd_update)
1668
       if(force_lcd_update)
1669
         {
1669
         {
1670
-          lcd.setCursor(0,line);lcdprintPGM(MSG_VTRAV_MIN);
1670
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_VTRAV_MIN);
1671
           lcd.setCursor(13,line);lcd.print(itostr3(mintravelfeedrate));
1671
           lcd.setCursor(13,line);lcd.print(itostr3(mintravelfeedrate));
1672
         }
1672
         }
1673
         
1673
         
1706
     {
1706
     {
1707
       if(force_lcd_update)
1707
       if(force_lcd_update)
1708
         {
1708
         {
1709
-          lcd.setCursor(0,line);lcdprintPGM(" Amax ");
1710
-          if(i==ItemCM_amaxx)lcdprintPGM(MSG_X);
1711
-          if(i==ItemCM_amaxy)lcdprintPGM(MSG_Y);
1712
-          if(i==ItemCM_amaxz)lcdprintPGM(MSG_Z);
1713
-          if(i==ItemCM_amaxe)lcdprintPGM(MSG_E);
1714
-          lcd.setCursor(13,line);lcd.print(itostr3(max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100));lcdprintPGM("00");
1709
+          lcd.setCursor(0,line);LCD_PRINT_PGM(" Amax ");
1710
+          if(i==ItemCM_amaxx)LCD_PRINT_PGM(MSG_X);
1711
+          if(i==ItemCM_amaxy)LCD_PRINT_PGM(MSG_Y);
1712
+          if(i==ItemCM_amaxz)LCD_PRINT_PGM(MSG_Z);
1713
+          if(i==ItemCM_amaxe)LCD_PRINT_PGM(MSG_E);
1714
+          lcd.setCursor(13,line);lcd.print(itostr3(max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100));LCD_PRINT_PGM("00");
1715
         }
1715
         }
1716
         
1716
         
1717
         if((activeline!=line) )
1717
         if((activeline!=line) )
1736
         {
1736
         {
1737
           if(encoderpos<1) encoderpos=1;
1737
           if(encoderpos<1) encoderpos=1;
1738
           if(encoderpos>990) encoderpos=990;
1738
           if(encoderpos>990) encoderpos=990;
1739
-          lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));lcdprintPGM("00");
1739
+          lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));LCD_PRINT_PGM("00");
1740
         }
1740
         }
1741
         
1741
         
1742
       }break;
1742
       }break;
1746
     {
1746
     {
1747
         if(force_lcd_update)
1747
         if(force_lcd_update)
1748
         {
1748
         {
1749
-          lcd.setCursor(0,line);lcdprintPGM(MSG_A_RETRACT);
1750
-          lcd.setCursor(13,line);lcd.print(ftostr3(retract_acceleration/100));lcdprintPGM("00");
1749
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_A_RETRACT);
1750
+          lcd.setCursor(13,line);lcd.print(ftostr3(retract_acceleration/100));LCD_PRINT_PGM("00");
1751
         }
1751
         }
1752
         
1752
         
1753
         if((activeline!=line) )
1753
         if((activeline!=line) )
1773
         {
1773
         {
1774
           if(encoderpos<10) encoderpos=10;
1774
           if(encoderpos<10) encoderpos=10;
1775
           if(encoderpos>990) encoderpos=990;
1775
           if(encoderpos>990) encoderpos=990;
1776
-          lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));lcdprintPGM("00");
1776
+          lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));LCD_PRINT_PGM("00");
1777
         }
1777
         }
1778
         
1778
         
1779
       }break;
1779
       }break;
1781
          {
1781
          {
1782
       if(force_lcd_update)
1782
       if(force_lcd_update)
1783
         {
1783
         {
1784
-          lcd.setCursor(0,line);lcdprintPGM(MSG_XSTEPS);
1784
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_XSTEPS);
1785
           lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[X_AXIS]));
1785
           lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[X_AXIS]));
1786
         }
1786
         }
1787
         
1787
         
1818
          {
1818
          {
1819
       if(force_lcd_update)
1819
       if(force_lcd_update)
1820
         {
1820
         {
1821
-          lcd.setCursor(0,line);lcdprintPGM(MSG_YSTEPS);
1821
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_YSTEPS);
1822
           lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[Y_AXIS]));
1822
           lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[Y_AXIS]));
1823
         }
1823
         }
1824
         
1824
         
1856
          {
1856
          {
1857
       if(force_lcd_update)
1857
       if(force_lcd_update)
1858
         {
1858
         {
1859
-          lcd.setCursor(0,line);lcdprintPGM(MSG_ZSTEPS);
1859
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_ZSTEPS);
1860
           lcd.setCursor(11,line);lcd.print(ftostr51(axis_steps_per_unit[Z_AXIS]));
1860
           lcd.setCursor(11,line);lcd.print(ftostr51(axis_steps_per_unit[Z_AXIS]));
1861
         }
1861
         }
1862
         
1862
         
1895
          {
1895
          {
1896
       if(force_lcd_update)
1896
       if(force_lcd_update)
1897
         {
1897
         {
1898
-          lcd.setCursor(0,line);lcdprintPGM(MSG_ESTEPS);
1898
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_ESTEPS);
1899
           lcd.setCursor(11,line);lcd.print(ftostr51(axis_steps_per_unit[E_AXIS]));
1899
           lcd.setCursor(11,line);lcd.print(ftostr51(axis_steps_per_unit[E_AXIS]));
1900
         }
1900
         }
1901
         
1901
         
1958
   switch(i)
1958
   switch(i)
1959
   {
1959
   {
1960
     case ItemR_exit:
1960
     case ItemR_exit:
1961
-      MENUITEM(  lcdprintPGM(MSG_CONTROL)  ,  BLOCK;status=Main_Control;beepshort(); ) ;
1961
+      MENUITEM(  LCD_PRINT_PGM(MSG_CONTROL)  ,  BLOCK;status=Main_Control;beepshort(); ) ;
1962
       break;
1962
       break;
1963
     
1963
     
1964
       //float retract_length=2, retract_feedrate=1200, retract_zlift=0.4;
1964
       //float retract_length=2, retract_feedrate=1200, retract_zlift=0.4;
1967
       {
1967
       {
1968
         if(force_lcd_update)
1968
         if(force_lcd_update)
1969
         {
1969
         {
1970
-          lcd.setCursor(0,line);lcdprintPGM(MSG_AUTORETRACT);
1970
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_AUTORETRACT);
1971
           lcd.setCursor(13,line);
1971
           lcd.setCursor(13,line);
1972
           if(autoretract_enabled)
1972
           if(autoretract_enabled)
1973
-            lcdprintPGM(MSG_ON);
1973
+            LCD_PRINT_PGM(MSG_ON);
1974
           else
1974
           else
1975
-            lcdprintPGM(MSG_OFF);
1975
+            LCD_PRINT_PGM(MSG_OFF);
1976
         }
1976
         }
1977
         
1977
         
1978
         if((activeline!=line) )
1978
         if((activeline!=line) )
1983
           autoretract_enabled=!autoretract_enabled;
1983
           autoretract_enabled=!autoretract_enabled;
1984
           lcd.setCursor(13,line);
1984
           lcd.setCursor(13,line);
1985
           if(autoretract_enabled)
1985
           if(autoretract_enabled)
1986
-            lcdprintPGM(MSG_ON);
1986
+            LCD_PRINT_PGM(MSG_ON);
1987
           else
1987
           else
1988
-            lcdprintPGM(MSG_OFF);
1988
+            LCD_PRINT_PGM(MSG_OFF);
1989
           BLOCK;
1989
           BLOCK;
1990
         }
1990
         }
1991
         
1991
         
1995
     {
1995
     {
1996
         if(force_lcd_update)
1996
         if(force_lcd_update)
1997
         {
1997
         {
1998
-          lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACT);
1998
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_CONTROL_RETRACT);
1999
           lcd.setCursor(13,line);lcd.print(ftostr52(retract_length));
1999
           lcd.setCursor(13,line);lcd.print(ftostr52(retract_length));
2000
         }
2000
         }
2001
         
2001
         
2030
     {
2030
     {
2031
         if(force_lcd_update)
2031
         if(force_lcd_update)
2032
         {
2032
         {
2033
-          lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACTF);
2033
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_CONTROL_RETRACTF);
2034
           lcd.setCursor(13,line);lcd.print(itostr4(retract_feedrate));
2034
           lcd.setCursor(13,line);lcd.print(itostr4(retract_feedrate));
2035
         }
2035
         }
2036
         
2036
         
2065
     {
2065
     {
2066
         if(force_lcd_update)
2066
         if(force_lcd_update)
2067
         {
2067
         {
2068
-          lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACT_ZLIFT);
2068
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_CONTROL_RETRACT_ZLIFT);
2069
           lcd.setCursor(13,line);lcd.print(ftostr52(retract_zlift));;
2069
           lcd.setCursor(13,line);lcd.print(ftostr52(retract_zlift));;
2070
         }
2070
         }
2071
         
2071
         
2100
     {
2100
     {
2101
         if(force_lcd_update)
2101
         if(force_lcd_update)
2102
         {
2102
         {
2103
-          lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACT_RECOVER);
2103
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_CONTROL_RETRACT_RECOVER);
2104
           lcd.setCursor(13,line);lcd.print(ftostr52(retract_recover_length));;
2104
           lcd.setCursor(13,line);lcd.print(ftostr52(retract_recover_length));;
2105
         }
2105
         }
2106
         
2106
         
2136
     {
2136
     {
2137
         if(force_lcd_update)
2137
         if(force_lcd_update)
2138
         {
2138
         {
2139
-          lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACT_RECOVERF);
2139
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_CONTROL_RETRACT_RECOVERF);
2140
           lcd.setCursor(13,line);lcd.print(itostr4(retract_recover_feedrate));
2140
           lcd.setCursor(13,line);lcd.print(itostr4(retract_recover_feedrate));
2141
         }
2141
         }
2142
         
2142
         
2196
   switch(i)
2196
   switch(i)
2197
   {
2197
   {
2198
     case ItemC_exit:
2198
     case ItemC_exit:
2199
-      MENUITEM(  lcdprintPGM(MSG_MAIN_WIDE)  ,  BLOCK;status=Main_Menu;beepshort(); ) ;
2199
+      MENUITEM(  LCD_PRINT_PGM(MSG_MAIN_WIDE)  ,  BLOCK;status=Main_Menu;beepshort(); ) ;
2200
       break;
2200
       break;
2201
     case ItemC_temp:
2201
     case ItemC_temp:
2202
-      MENUITEM(  lcdprintPGM(MSG_TEMPERATURE_WIDE)  ,  BLOCK;status=Sub_TempControl;beepshort(); ) ;
2202
+      MENUITEM(  LCD_PRINT_PGM(MSG_TEMPERATURE_WIDE)  ,  BLOCK;status=Sub_TempControl;beepshort(); ) ;
2203
       break;
2203
       break;
2204
    case ItemC_move:
2204
    case ItemC_move:
2205
-      MENUITEM(  lcdprintPGM(MSG_MOTION_WIDE)  ,  BLOCK;status=Sub_MotionControl;beepshort(); ) ;
2205
+      MENUITEM(  LCD_PRINT_PGM(MSG_MOTION_WIDE)  ,  BLOCK;status=Sub_MotionControl;beepshort(); ) ;
2206
       break;
2206
       break;
2207
 #ifdef FWRETRACT
2207
 #ifdef FWRETRACT
2208
     case ItemC_rectract:
2208
     case ItemC_rectract:
2209
-      MENUITEM(  lcdprintPGM(MSG_RECTRACT_WIDE)  ,  BLOCK;status=Sub_RetractControl;beepshort(); ) ;
2209
+      MENUITEM(  LCD_PRINT_PGM(MSG_RECTRACT_WIDE)  ,  BLOCK;status=Sub_RetractControl;beepshort(); ) ;
2210
       break;
2210
       break;
2211
 #endif
2211
 #endif
2212
     case ItemC_store:
2212
     case ItemC_store:
2213
     {
2213
     {
2214
       if(force_lcd_update)
2214
       if(force_lcd_update)
2215
       {
2215
       {
2216
-        lcd.setCursor(0,line);lcdprintPGM(MSG_STORE_EPROM);
2216
+        lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_STORE_EPROM);
2217
       }
2217
       }
2218
       if((activeline==line) && CLICKED)
2218
       if((activeline==line) && CLICKED)
2219
       {
2219
       {
2227
     {
2227
     {
2228
       if(force_lcd_update)
2228
       if(force_lcd_update)
2229
       {
2229
       {
2230
-        lcd.setCursor(0,line);lcdprintPGM(MSG_LOAD_EPROM);
2230
+        lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_LOAD_EPROM);
2231
       }
2231
       }
2232
       if((activeline==line) && CLICKED)
2232
       if((activeline==line) && CLICKED)
2233
       {
2233
       {
2241
     {
2241
     {
2242
       if(force_lcd_update)
2242
       if(force_lcd_update)
2243
       {
2243
       {
2244
-        lcd.setCursor(0,line);lcdprintPGM(MSG_RESTORE_FAILSAFE);
2244
+        lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_RESTORE_FAILSAFE);
2245
       }
2245
       }
2246
       if((activeline==line) && CLICKED)
2246
       if((activeline==line) && CLICKED)
2247
       {
2247
       {
2288
   switch(i)
2288
   switch(i)
2289
   {
2289
   {
2290
     case 0:
2290
     case 0:
2291
-      MENUITEM(  lcdprintPGM(MSG_MAIN)  ,  BLOCK;status=Main_Menu;beepshort(); ) ;
2291
+      MENUITEM(  LCD_PRINT_PGM(MSG_MAIN)  ,  BLOCK;status=Main_Menu;beepshort(); ) ;
2292
       break;
2292
       break;
2293
 //     case 1:
2293
 //     case 1:
2294
 //       {
2294
 //       {
2301
 //           if(true)
2301
 //           if(true)
2302
 //           #endif
2302
 //           #endif
2303
 //           {
2303
 //           {
2304
-//             lcdprintPGM(" \004Refresh");
2304
+//             LCD_PRINT_PGM(" \004Refresh");
2305
 //           }
2305
 //           }
2306
 //           else
2306
 //           else
2307
 //           {
2307
 //           {
2308
-//             lcdprintPGM(" \004Insert Card");
2308
+//             LCD_PRINT_PGM(" \004Insert Card");
2309
 //           }
2309
 //           }
2310
 //           
2310
 //           
2311
 //         }
2311
 //         }
2320
 //       }break;
2320
 //       }break;
2321
     case 1:
2321
     case 1:
2322
       MENUITEM(  lcd.print(" ");card.getWorkDirName();
2322
       MENUITEM(  lcd.print(" ");card.getWorkDirName();
2323
-	  if(card.filename[0]=='/') lcdprintPGM(MSG_REFRESH);
2323
+	  if(card.filename[0]=='/') LCD_PRINT_PGM(MSG_REFRESH);
2324
 	  else {
2324
 	  else {
2325
 		  lcd.print("\005");
2325
 		  lcd.print("\005");
2326
 		  lcd.print(card.filename);
2326
 		  lcd.print(card.filename);
2343
         {
2343
         {
2344
           card.getfilename(i-FIRSTITEM);
2344
           card.getfilename(i-FIRSTITEM);
2345
           //Serial.print("Filenr:");Serial.println(i-2);
2345
           //Serial.print("Filenr:");Serial.println(i-2);
2346
-          lcd.setCursor(0,line);lcdprintPGM(" ");
2347
-          if(card.filenameIsDir) lcd.print("\005");
2346
+          lcd.setCursor(0,line);LCD_PRINT_PGM(" ");
2347
+          if(card.filenameIsDir)
2348
+          {
2349
+            lcd.print("\005");
2350
+            card.longFilename[LCD_WIDTH-2] = '\0';
2351
+          }
2348
           if (card.longFilename[0])
2352
           if (card.longFilename[0])
2349
           {
2353
           {
2350
             card.longFilename[LCD_WIDTH-1] = '\0';
2354
             card.longFilename[LCD_WIDTH-1] = '\0';
2436
     switch(i)
2440
     switch(i)
2437
     { 
2441
     { 
2438
       case ItemM_watch:
2442
       case ItemM_watch:
2439
-        MENUITEM(  lcdprintPGM(MSG_WATCH)  ,  BLOCK;status=Main_Status;beepshort(); ) ;
2443
+        MENUITEM(  LCD_PRINT_PGM(MSG_WATCH)  ,  BLOCK;status=Main_Status;beepshort(); ) ;
2440
        break;
2444
        break;
2441
       case ItemM_prepare:
2445
       case ItemM_prepare:
2442
-        MENUITEM(  if(!tune) lcdprintPGM(MSG_PREPARE);else  lcdprintPGM(MSG_TUNE); ,  BLOCK;status=Main_Prepare;beepshort(); ) ;
2446
+        MENUITEM(  if(!tune) LCD_PRINT_PGM(MSG_PREPARE);else  LCD_PRINT_PGM(MSG_TUNE); ,  BLOCK;status=Main_Prepare;beepshort(); ) ;
2443
       break;
2447
       break;
2444
        
2448
        
2445
       case ItemM_control:
2449
       case ItemM_control:
2446
-        MENUITEM(  lcdprintPGM(MSG_CONTROL_ARROW)  ,  BLOCK;status=Main_Control;beepshort(); ) ;
2450
+        MENUITEM(  LCD_PRINT_PGM(MSG_CONTROL_ARROW)  ,  BLOCK;status=Main_Control;beepshort(); ) ;
2447
       break;
2451
       break;
2448
       #ifdef SDSUPPORT
2452
       #ifdef SDSUPPORT
2449
       case ItemM_file:    
2453
       case ItemM_file:    
2458
           #endif
2462
           #endif
2459
           {
2463
           {
2460
             if(card.sdprinting)
2464
             if(card.sdprinting)
2461
-              lcdprintPGM(MSG_STOP_PRINT);
2465
+              LCD_PRINT_PGM(MSG_STOP_PRINT);
2462
             else
2466
             else
2463
-              lcdprintPGM(MSG_CARD_MENU);
2467
+              LCD_PRINT_PGM(MSG_CARD_MENU);
2464
           }
2468
           }
2465
           else
2469
           else
2466
           {
2470
           {
2467
-           lcdprintPGM(MSG_NO_CARD); 
2471
+           LCD_PRINT_PGM(MSG_NO_CARD); 
2468
           }
2472
           }
2469
         }
2473
         }
2470
         #ifdef CARDINSERTED
2474
         #ifdef CARDINSERTED
2490
 #endif
2494
 #endif
2491
                     {
2495
                     {
2492
                         if(card.sdprinting)
2496
                         if(card.sdprinting)
2493
-                            lcdprintPGM(MSG_PAUSE_PRINT);
2497
+                            LCD_PRINT_PGM(MSG_PAUSE_PRINT);
2494
                         else
2498
                         else
2495
-                            lcdprintPGM(MSG_RESUME_PRINT);
2499
+                            LCD_PRINT_PGM(MSG_RESUME_PRINT);
2496
                     }
2500
                     }
2497
                     else
2501
                     else
2498
                     {
2502
                     {
2499
-                        //lcdprintPGM(MSG_NO_CARD);
2503
+                        //LCD_PRINT_PGM(MSG_NO_CARD);
2500
                     }
2504
                     }
2501
             }
2505
             }
2502
 #ifdef CARDINSERTED
2506
 #ifdef CARDINSERTED
2666
   {
2670
   {
2667
 
2671
 
2668
 	case ItemPLAPreHeat_Exit:
2672
 	case ItemPLAPreHeat_Exit:
2669
-      MENUITEM(  lcdprintPGM(MSG_TEMPERATURE_RTN)  ,  BLOCK;status=Sub_TempControl;beepshort(); ) ;
2673
+      MENUITEM(  LCD_PRINT_PGM(MSG_TEMPERATURE_RTN)  ,  BLOCK;status=Sub_TempControl;beepshort(); ) ;
2670
       break;
2674
       break;
2671
 
2675
 
2672
     case ItemPLAPreHeat_set_PLA_FanSpeed:
2676
     case ItemPLAPreHeat_set_PLA_FanSpeed:
2673
        {
2677
        {
2674
         if(force_lcd_update)
2678
         if(force_lcd_update)
2675
         {
2679
         {
2676
-          lcd.setCursor(0,line);lcdprintPGM(MSG_FAN_SPEED);
2680
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_FAN_SPEED);
2677
           lcd.setCursor(13,line);lcd.print(ftostr3(plaPreheatFanSpeed));
2681
           lcd.setCursor(13,line);lcd.print(ftostr3(plaPreheatFanSpeed));
2678
         }
2682
         }
2679
         
2683
         
2707
       {
2711
       {
2708
         if(force_lcd_update)
2712
         if(force_lcd_update)
2709
         {
2713
         {
2710
-          lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE);
2714
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_NOZZLE);
2711
           lcd.setCursor(13,line);lcd.print(ftostr3(plaPreheatHotendTemp));
2715
           lcd.setCursor(13,line);lcd.print(ftostr3(plaPreheatHotendTemp));
2712
         } 
2716
         } 
2713
         
2717
         
2741
       {
2745
       {
2742
         if(force_lcd_update)
2746
         if(force_lcd_update)
2743
         {
2747
         {
2744
-          lcd.setCursor(0,line);lcdprintPGM(MSG_BED);
2748
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_BED);
2745
           lcd.setCursor(13,line);lcd.print(ftostr3(plaPreheatHPBTemp));
2749
           lcd.setCursor(13,line);lcd.print(ftostr3(plaPreheatHPBTemp));
2746
         } 
2750
         } 
2747
         
2751
         
2774
     {
2778
     {
2775
       if(force_lcd_update)
2779
       if(force_lcd_update)
2776
       {
2780
       {
2777
-        lcd.setCursor(0,line);lcdprintPGM(MSG_STORE_EPROM);
2781
+        lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_STORE_EPROM);
2778
       }
2782
       }
2779
       if((activeline==line) && CLICKED)
2783
       if((activeline==line) && CLICKED)
2780
       {
2784
       {
2812
   {
2816
   {
2813
 
2817
 
2814
 	case ItemABSPreHeat_Exit:
2818
 	case ItemABSPreHeat_Exit:
2815
-      MENUITEM(  lcdprintPGM(MSG_TEMPERATURE_RTN)  ,  BLOCK;status=Sub_TempControl;beepshort(); ) ;
2819
+      MENUITEM(  LCD_PRINT_PGM(MSG_TEMPERATURE_RTN)  ,  BLOCK;status=Sub_TempControl;beepshort(); ) ;
2816
       break;
2820
       break;
2817
 
2821
 
2818
     case ItemABSPreHeat_set_FanSpeed:
2822
     case ItemABSPreHeat_set_FanSpeed:
2819
        {
2823
        {
2820
         if(force_lcd_update)
2824
         if(force_lcd_update)
2821
         {
2825
         {
2822
-          lcd.setCursor(0,line);lcdprintPGM(MSG_FAN_SPEED);
2826
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_FAN_SPEED);
2823
           lcd.setCursor(13,line);lcd.print(ftostr3(absPreheatFanSpeed));
2827
           lcd.setCursor(13,line);lcd.print(ftostr3(absPreheatFanSpeed));
2824
         }
2828
         }
2825
         
2829
         
2853
       {
2857
       {
2854
         if(force_lcd_update)
2858
         if(force_lcd_update)
2855
         {
2859
         {
2856
-          lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE);
2860
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_NOZZLE);
2857
           lcd.setCursor(13,line);lcd.print(ftostr3(absPreheatHotendTemp));
2861
           lcd.setCursor(13,line);lcd.print(ftostr3(absPreheatHotendTemp));
2858
         } 
2862
         } 
2859
         
2863
         
2887
       {
2891
       {
2888
         if(force_lcd_update)
2892
         if(force_lcd_update)
2889
         {
2893
         {
2890
-          lcd.setCursor(0,line);lcdprintPGM(MSG_BED);
2894
+          lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_BED);
2891
           lcd.setCursor(13,line);lcd.print(ftostr3(absPreheatHPBTemp));
2895
           lcd.setCursor(13,line);lcd.print(ftostr3(absPreheatHPBTemp));
2892
         } 
2896
         } 
2893
         
2897
         
2920
     {
2924
     {
2921
       if(force_lcd_update)
2925
       if(force_lcd_update)
2922
       {
2926
       {
2923
-        lcd.setCursor(0,line);lcdprintPGM(MSG_STORE_EPROM);
2927
+        lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_STORE_EPROM);
2924
       }
2928
       }
2925
       if((activeline==line) && CLICKED)
2929
       if((activeline==line) && CLICKED)
2926
       {
2930
       {

+ 45
- 31
Marlin/ultralcd.h View File

1
 #ifndef ULTRALCD_H
1
 #ifndef ULTRALCD_H
2
 #define ULTRALCD_H
2
 #define ULTRALCD_H
3
+
3
 #include "Marlin.h"
4
 #include "Marlin.h"
5
+
4
 #ifdef ULTRA_LCD
6
 #ifdef ULTRA_LCD
5
 #include "language.h"
7
 #include "language.h"
8
+
6
 #if LANGUAGE_CHOICE == 6
9
 #if LANGUAGE_CHOICE == 6
7
 #include "LiquidCrystalRus.h"
10
 #include "LiquidCrystalRus.h"
11
+#define LCD_CLASS LiquidCrystalRus
8
 #else
12
 #else
9
 #include <LiquidCrystal.h>
13
 #include <LiquidCrystal.h>
14
+#define LCD_CLASS LiquidCrystal
10
 #endif
15
 #endif
11
-  void lcd_status();
12
-  void lcd_init();
13
-  void lcd_status(const char* message);
14
-  void beep();
15
-  void buttons_init();
16
-  void buttons_check();
17
-
18
-  #define LCD_UPDATE_INTERVAL 100
19
-  #define STATUSTIMEOUT 15000
20
-#if LANGUAGE_CHOICE == 6
21
-  extern LiquidCrystalRus lcd;
22
-#else
23
-  extern LiquidCrystal lcd;
24
-#endif
25
-  extern volatile char buttons;  //the last checked buttons in a bit array.
16
+
17
+void lcd_status();
18
+void lcd_init();
19
+void lcd_status(const char* message);
20
+void beep();
21
+void buttons_init();
22
+void buttons_check();
23
+
24
+#define LCD_UPDATE_INTERVAL 100
25
+#define STATUSTIMEOUT 15000
26
+
27
+extern LCD_CLASS lcd;
28
+
29
+extern volatile char buttons;  //the last checked buttons in a bit array.
26
   
30
   
27
-  #ifdef NEWPANEL
31
+#ifdef NEWPANEL
28
     #define EN_C (1<<BLEN_C)
32
     #define EN_C (1<<BLEN_C)
29
     #define EN_B (1<<BLEN_B)
33
     #define EN_B (1<<BLEN_B)
30
     #define EN_A (1<<BLEN_A)
34
     #define EN_A (1<<BLEN_A)
31
-    
35
+
32
     #define CLICKED (buttons&EN_C)
36
     #define CLICKED (buttons&EN_C)
33
     #define BLOCK {blocking=millis()+blocktime;}
37
     #define BLOCK {blocking=millis()+blocktime;}
34
-    #if (SDCARDDETECT > -1)
35
-      #ifdef SDCARDDETECTINVERTED 
36
-        #define CARDINSERTED (READ(SDCARDDETECT)!=0)
37
-      #else
38
-        #define CARDINSERTED (READ(SDCARDDETECT)==0)
39
-      #endif
40
-    #endif  //SDCARDTETECTINVERTED
41
-
42
-  #else
43
-
38
+#else
44
     //atomatic, do not change
39
     //atomatic, do not change
45
     #define B_LE (1<<BL_LE)
40
     #define B_LE (1<<BL_LE)
46
     #define B_UP (1<<BL_UP)
41
     #define B_UP (1<<BL_UP)
53
     
48
     
54
     #define CLICKED ((buttons&B_MI)||(buttons&B_ST))
49
     #define CLICKED ((buttons&B_MI)||(buttons&B_ST))
55
     #define BLOCK {blocking[BL_MI]=millis()+blocktime;blocking[BL_ST]=millis()+blocktime;}
50
     #define BLOCK {blocking[BL_MI]=millis()+blocktime;blocking[BL_ST]=millis()+blocktime;}
56
-    
57
-  #endif
51
+#endif
58
 
52
 
53
+#if (SDCARDDETECT > -1)
54
+#ifdef SDCARDDETECTINVERTED 
55
+#define CARDINSERTED (READ(SDCARDDETECT)!=0)
56
+#else
57
+#define CARDINSERTED (READ(SDCARDDETECT)==0)
58
+#endif //SDCARDTETECTINVERTED
59
+#else
60
+//If we don't have a card detect line, aways asume the card is inserted
61
+#define CARDINSERTED true
62
+#endif
59
 
63
 
60
     
64
     
61
   // blocking time for recognizing a new keypress of one key, ms
65
   // blocking time for recognizing a new keypress of one key, ms
152
 
156
 
153
   #define LCD_INIT lcd_init();
157
   #define LCD_INIT lcd_init();
154
   #define LCD_MESSAGE(x) lcd_status(x);
158
   #define LCD_MESSAGE(x) lcd_status(x);
155
-  #define LCD_MESSAGEPGM(x) lcd_statuspgm(MYPGM(x));
156
-  #define LCD_ALERTMESSAGEPGM(x) lcd_alertstatuspgm(MYPGM(x));
159
+  #define LCD_MESSAGEPGM(x) lcd_statuspgm(PSTR(x));
160
+  #define LCD_ALERTMESSAGEPGM(x) lcd_alertstatuspgm(PSTR(x));
157
   #define LCD_STATUS lcd_status()
161
   #define LCD_STATUS lcd_status()
158
 #else //no lcd
162
 #else //no lcd
159
   #define LCD_INIT
163
   #define LCD_INIT
178
 char *itostr3(const int &xx);
182
 char *itostr3(const int &xx);
179
 char *itostr4(const int &xx);
183
 char *itostr4(const int &xx);
180
 char *ftostr51(const float &x);
184
 char *ftostr51(const float &x);
185
+
186
+//TODO: These do not belong here.
187
+extern int plaPreheatHotendTemp;
188
+extern int plaPreheatHPBTemp;
189
+extern int plaPreheatFanSpeed;
190
+
191
+extern int absPreheatHotendTemp;
192
+extern int absPreheatHPBTemp;
193
+extern int absPreheatFanSpeed;
194
+
181
 #endif //ULTRALCD
195
 #endif //ULTRALCD

+ 54
- 0
Marlin/watchdog.cpp View File

1
+#include "Marlin.h"
2
+
3
+#ifdef USE_WATCHDOG
4
+#include "watchdog.h"
5
+#include "ultralcd.h"
6
+
7
+//===========================================================================
8
+//=============================private variables  ============================
9
+//===========================================================================
10
+
11
+//===========================================================================
12
+//=============================functinos         ============================
13
+//===========================================================================
14
+
15
+
16
+/// intialise watch dog with a 1 sec interrupt time
17
+void watchdog_init()
18
+{
19
+#ifdef RESET_MANUAL
20
+    //We enable the watchdog timer, but only for the interrupt.
21
+    //Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details.
22
+    wdt_reset();
23
+    _WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE);
24
+    _WD_CONTROL_REG = _BV(WDIE) | WDTO_1S;
25
+#else
26
+    wdt_enable(WDTO_1S);
27
+#endif
28
+}
29
+
30
+/// reset watchdog. MUST be called every 1s after init or avr will reset.
31
+void watchdog_reset() 
32
+{
33
+  wdt_reset();
34
+}
35
+
36
+//===========================================================================
37
+//=============================ISR               ============================
38
+//===========================================================================
39
+
40
+//Watchdog timer interrupt, called if main program blocks >1sec and manual reset is enabled.
41
+#ifdef RESET_MANUAL
42
+ISR(WDT_vect)
43
+{ 
44
+    LCD_MESSAGEPGM("ERR:Please Reset");//16 characters so it fits on a 16x2 display
45
+    LCD_STATUS;
46
+    SERIAL_ERROR_START;
47
+    SERIAL_ERRORLNPGM("Something is wrong, please turn off the printer.");
48
+
49
+    kill(); //kill blocks
50
+    while(1); //wait for user or serial reset
51
+}
52
+#endif//RESET_MANUAL
53
+
54
+#endif//USE_WATCHDOG

+ 8
- 7
Marlin/watchdog.h View File

1
 #ifndef WATCHDOG_H
1
 #ifndef WATCHDOG_H
2
 #define WATCHDOG_H
2
 #define WATCHDOG_H
3
+
3
 #include "Marlin.h"
4
 #include "Marlin.h"
4
-#ifdef USE_WATCHDOG
5
 
5
 
6
+#ifdef USE_WATCHDOG
6
   // intialise watch dog with a 1 sec interrupt time
7
   // intialise watch dog with a 1 sec interrupt time
7
-  void wd_init();
8
-  // pad the dog/reset watchdog. MUST be called at least every second after the first wd_init or avr will go into emergency procedures..
9
-  void wd_reset();
10
-
8
+  void watchdog_init();
9
+  // pad the dog/reset watchdog. MUST be called at least every second after the first watchdog_init or avr will go into emergency procedures..
10
+  void watchdog_reset();
11
 #else
11
 #else
12
-  FORCE_INLINE void wd_init() {};
13
-  FORCE_INLINE void wd_reset() {};
12
+  //If we do not have a watchdog, then we can have empty functions which are optimized away.
13
+  FORCE_INLINE void watchdog_init() {};
14
+  FORCE_INLINE void watchdog_reset() {};
14
 #endif
15
 #endif
15
 
16
 
16
 #endif
17
 #endif

+ 0
- 63
Marlin/watchdog.pde View File

1
-#ifdef USE_WATCHDOG
2
-#include "Marlin.h"
3
-#include "watchdog.h"
4
-
5
-//===========================================================================
6
-//=============================private variables  ============================
7
-//===========================================================================
8
-
9
-static volatile uint8_t timeout_seconds=0;
10
-
11
-void(* ctrlaltdelete) (void) = 0; //does not work on my atmega2560
12
-
13
-//===========================================================================
14
-//=============================functinos         ============================
15
-//===========================================================================
16
-
17
-
18
-/// intialise watch dog with a 1 sec interrupt time
19
-void wd_init() 
20
-{
21
-  WDTCSR |= (1<<WDCE )|(1<<WDE ); //allow changes
22
-  WDTCSR = (1<<WDCE )|(1<<WDE )|(1<<WDP3 )|(1<<WDP0); // Reset after 8 sec.
23
-//  WDTCSR = (1<<WDIF)|(1<<WDIE)| (1<<WDCE )|(1<<WDE )|  (1<<WDP3) | (1<<WDP0);
24
-}
25
-
26
-/// reset watchdog. MUST be called every 1s after init or avr will reset.
27
-void wd_reset() 
28
-{
29
-  wdt_reset();
30
-}
31
-
32
-//===========================================================================
33
-//=============================ISR               ============================
34
-//===========================================================================
35
-
36
-//Watchdog timer interrupt, called if main program blocks >1sec
37
-ISR(WDT_vect) 
38
-{ 
39
-  if(timeout_seconds++ >= WATCHDOG_TIMEOUT)
40
-  {
41
- 
42
-    #ifdef RESET_MANUAL
43
-      LCD_MESSAGEPGM("Please Reset!");
44
-      LCD_STATUS;
45
-      SERIAL_ERROR_START;
46
-      SERIAL_ERRORLNPGM("Something is wrong, please turn off the printer.");
47
-    #else
48
-      LCD_MESSAGEPGM("Timeout, resetting!");
49
-      LCD_STATUS;
50
-    #endif 
51
-    //disable watchdog, it will survife reboot.
52
-    WDTCSR |= (1<<WDCE) | (1<<WDE);
53
-    WDTCSR = 0;
54
-    #ifdef RESET_MANUAL
55
-      kill(); //kill blocks
56
-      while(1); //wait for user or serial reset
57
-    #else
58
-      ctrlaltdelete();
59
-    #endif
60
-  }
61
-}
62
-
63
-#endif /* USE_WATCHDOG */

Loading…
Cancel
Save