ultralcd.ino

Sat, 07 Nov 2015 13:23:07 +0100

author
mbayer
date
Sat, 07 Nov 2015 13:23:07 +0100
changeset 0
2c8ba1964db7
permissions
-rw-r--r--

Initial code from reprappro Marlin repository

0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1 #include "language.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2 #include "temperature.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
3 #include "ultralcd.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
4 #ifdef ULTRA_LCD
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
5 #include "Marlin.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
6 #include "language.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
7 #include "temperature.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
8 #include "EEPROMwrite.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
9 #include <LiquidCrystal.h>
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
10 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
11 //=============================imported variables============================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
12 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
13
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
14 extern volatile int feedmultiply;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
15 extern volatile bool feedmultiplychanged;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
16
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
17 extern volatile int extrudemultiply;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
18
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
19 extern long position[4];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
20 #ifdef SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
21 #include "cardreader.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
22 extern CardReader card;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
23 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
24
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
25 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
26 //=============================public variables============================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
27 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
28 volatile char buttons=0; //the last checked buttons in a bit array.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
29 long encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
30 short lastenc=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
31
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
32
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
33 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
34 //=============================private variables============================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
35 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
36 static char messagetext[LCD_WIDTH]="";
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
37
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
38 //return for string conversion routines
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
39 static char conv[8];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
40
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
41 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
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
42
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
43 static unsigned long previous_millis_lcd=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
44 //static long previous_millis_buttons=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
45
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
46
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
47 #ifdef NEWPANEL
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
48 static long blocking=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
49 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
50 static long blocking[8]={0,0,0,0,0,0,0,0};
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
51 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
52
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
53 static MainMenu menu;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
54
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
55
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
56 void lcdProgMemprint(const char *str)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
57 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
58 char ch=pgm_read_byte(str);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
59 while(ch)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
60 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
61 lcd.print(ch);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
62 ch=pgm_read_byte(++str);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
63 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
64 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
65 #define lcdprintPGM(x) lcdProgMemprint(MYPGM(x))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
66
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
67
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
68 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
69 //=============================functions ============================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
70 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
71
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
72 int intround(const float &x){return int(0.5+x);}
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
73
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
74 void lcd_status(const char* message)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
75 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
76 strncpy(messagetext,message,LCD_WIDTH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
77 messagetext[strlen(message)]=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
78 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
79
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
80 void lcd_statuspgm(const char* message)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
81 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
82 char ch=pgm_read_byte(message);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
83 char *target=messagetext;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
84 uint8_t cnt=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
85 while(ch &&cnt<LCD_WIDTH)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
86 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
87 *target=ch;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
88 target++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
89 cnt++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
90 ch=pgm_read_byte(++message);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
91 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
92 *target=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
93 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
94
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
95 FORCE_INLINE void clear()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
96 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
97 lcd.clear();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
98 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
99
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
100
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
101 void lcd_init()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
102 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
103 //beep();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
104 #ifdef ULTIPANEL
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
105 buttons_init();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
106 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
107
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
108 byte Degree[8] =
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
109 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
110 B01100,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
111 B10010,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
112 B10010,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
113 B01100,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
114 B00000,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
115 B00000,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
116 B00000,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
117 B00000
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
118 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
119 byte Thermometer[8] =
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
120 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
121 B00100,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
122 B01010,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
123 B01010,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
124 B01010,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
125 B01010,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
126 B10001,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
127 B10001,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
128 B01110
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
129 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
130 byte uplevel[8]={0x04, 0x0e, 0x1f, 0x04, 0x1c, 0x00, 0x00, 0x00};//thanks joris
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
131 byte refresh[8]={0x00, 0x06, 0x19, 0x18, 0x03, 0x13, 0x0c, 0x00}; //thanks joris
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
132 byte folder [8]={0x00, 0x1c, 0x1f, 0x11, 0x11, 0x1f, 0x00, 0x00}; //thanks joris
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
133 lcd.begin(LCD_WIDTH, LCD_HEIGHT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
134 lcd.createChar(1,Degree);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
135 lcd.createChar(2,Thermometer);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
136 lcd.createChar(3,uplevel);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
137 lcd.createChar(4,refresh);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
138 lcd.createChar(5,folder);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
139 LCD_MESSAGEPGM(WELCOME_MSG);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
140 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
141
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
142
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
143 void beep()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
144 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
145 //return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
146 #ifdef ULTIPANEL
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
147 #if (BEEPER > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
148 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
149 pinMode(BEEPER,OUTPUT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
150 for(int8_t i=0;i<20;i++){
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
151 WRITE(BEEPER,HIGH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
152 delay(5);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
153 WRITE(BEEPER,LOW);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
154 delay(5);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
155 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
156 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
157 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
158 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
159 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
160
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
161 void beepshort()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
162 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
163 //return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
164 #ifdef ULTIPANEL
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
165 #if (BEEPER > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
166 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
167 pinMode(BEEPER,OUTPUT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
168 for(int8_t i=0;i<10;i++){
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
169 WRITE(BEEPER,HIGH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
170 delay(3);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
171 WRITE(BEEPER,LOW);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
172 delay(3);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
173 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
174 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
175 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
176 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
177 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
178
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
179 void lcd_status()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
180 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
181 #ifdef ULTIPANEL
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
182 static uint8_t oldbuttons=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
183 //static long previous_millis_buttons=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
184 //static long previous_lcdinit=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
185 // buttons_check(); // Done in temperature interrupt
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
186 //previous_millis_buttons=millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
187 long ms=millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
188 for(int8_t i=0; i<8; i++) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
189 #ifndef NEWPANEL
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
190 if((blocking[i]>ms))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
191 buttons &= ~(1<<i);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
192 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
193 if((blocking>ms))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
194 buttons &= ~(1<<i);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
195 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
196 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
197 if((buttons==oldbuttons) && ((millis() - previous_millis_lcd) < LCD_UPDATE_INTERVAL) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
198 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
199 oldbuttons=buttons;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
200 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
201
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
202 if(((millis() - previous_millis_lcd) < LCD_UPDATE_INTERVAL) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
203 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
204 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
205
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
206 previous_millis_lcd=millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
207 menu.update();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
208 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
209 #ifdef ULTIPANEL
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
210
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
211
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
212 void buttons_init()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
213 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
214 #ifdef NEWPANEL
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
215 pinMode(BTN_EN1,INPUT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
216 pinMode(BTN_EN2,INPUT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
217 pinMode(BTN_ENC,INPUT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
218 pinMode(SDCARDDETECT,INPUT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
219 WRITE(BTN_EN1,HIGH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
220 WRITE(BTN_EN2,HIGH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
221 WRITE(BTN_ENC,HIGH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
222 #if (SDCARDDETECT > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
223 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
224 WRITE(SDCARDDETECT,HIGH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
225 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
226 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
227 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
228 pinMode(SHIFT_CLK,OUTPUT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
229 pinMode(SHIFT_LD,OUTPUT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
230 pinMode(SHIFT_EN,OUTPUT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
231 pinMode(SHIFT_OUT,INPUT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
232 WRITE(SHIFT_OUT,HIGH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
233 WRITE(SHIFT_LD,HIGH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
234 WRITE(SHIFT_EN,LOW);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
235 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
236 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
237
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
238
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
239 void buttons_check()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
240 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
241
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
242 #ifdef NEWPANEL
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
243 uint8_t newbutton=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
244 if(READ(BTN_EN1)==0) newbutton|=EN_A;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
245 if(READ(BTN_EN2)==0) newbutton|=EN_B;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
246 if((blocking<millis()) &&(READ(BTN_ENC)==0))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
247 newbutton|=EN_C;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
248 buttons=newbutton;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
249 #else //read it from the shift register
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
250 uint8_t newbutton=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
251 WRITE(SHIFT_LD,LOW);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
252 WRITE(SHIFT_LD,HIGH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
253 unsigned char tmp_buttons=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
254 for(int8_t i=0;i<8;i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
255 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
256 newbutton = newbutton>>1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
257 if(READ(SHIFT_OUT))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
258 newbutton|=(1<<7);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
259 WRITE(SHIFT_CLK,HIGH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
260 WRITE(SHIFT_CLK,LOW);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
261 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
262 buttons=~newbutton; //invert it, because a pressed switch produces a logical 0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
263 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
264
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
265 //manage encoder rotation
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
266 char enc=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
267 if(buttons&EN_A)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
268 enc|=(1<<0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
269 if(buttons&EN_B)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
270 enc|=(1<<1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
271 if(enc!=lastenc)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
272 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
273 switch(enc)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
274 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
275 case encrot0:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
276 if(lastenc==encrot3)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
277 encoderpos++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
278 else if(lastenc==encrot1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
279 encoderpos--;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
280 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
281 case encrot1:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
282 if(lastenc==encrot0)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
283 encoderpos++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
284 else if(lastenc==encrot2)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
285 encoderpos--;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
286 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
287 case encrot2:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
288 if(lastenc==encrot1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
289 encoderpos++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
290 else if(lastenc==encrot3)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
291 encoderpos--;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
292 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
293 case encrot3:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
294 if(lastenc==encrot2)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
295 encoderpos++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
296 else if(lastenc==encrot0)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
297 encoderpos--;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
298 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
299 default:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
300 ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
301 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
302 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
303 lastenc=enc;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
304 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
305
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
306 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
307
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
308 MainMenu::MainMenu()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
309 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
310 status=Main_Status;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
311 displayStartingRow=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
312 activeline=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
313 force_lcd_update=true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
314 linechanging=false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
315 tune=false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
316 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
317
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
318 void MainMenu::showStatus()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
319 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
320 #if LCD_HEIGHT==4
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
321 static int olddegHotEnd0=-1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
322 static int oldtargetHotEnd0=-1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
323 //force_lcd_update=true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
324 if(force_lcd_update) //initial display of content
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
325 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
326 encoderpos=feedmultiply;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
327 clear();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
328 lcd.setCursor(0,0);lcdprintPGM("\002---/---\001 ");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
329 #if defined BED_USES_THERMISTOR || defined BED_USES_AD595
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
330 lcd.setCursor(10,0);lcdprintPGM("B---/---\001 ");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
331 #elif EXTRUDERS > 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
332 lcd.setCursor(10,0);lcdprintPGM("\002---/---\001 ");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
333 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
334 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
335
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
336 int tHotEnd0=intround(degHotend0());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
337 if((tHotEnd0!=olddegHotEnd0)||force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
338 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
339 lcd.setCursor(1,0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
340 lcd.print(ftostr3(tHotEnd0));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
341 olddegHotEnd0=tHotEnd0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
342 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
343 int ttHotEnd0=intround(degTargetHotend0());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
344 if((ttHotEnd0!=oldtargetHotEnd0)||force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
345 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
346 lcd.setCursor(5,0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
347 lcd.print(ftostr3(ttHotEnd0));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
348 oldtargetHotEnd0=ttHotEnd0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
349 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
350 #if defined BED_USES_THERMISTOR || defined BED_USES_AD595
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
351 static int oldtBed=-1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
352 static int oldtargetBed=-1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
353 int tBed=intround(degBed());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
354 if((tBed!=oldtBed)||force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
355 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
356 lcd.setCursor(11,0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
357 lcd.print(ftostr3(tBed));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
358 oldtBed=tBed;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
359 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
360 int targetBed=intround(degTargetBed());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
361 if((targetBed!=oldtargetBed)||force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
362 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
363 lcd.setCursor(15,0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
364 lcd.print(ftostr3(targetBed));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
365 oldtargetBed=targetBed;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
366 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
367 #elif EXTRUDERS > 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
368 static int olddegHotEnd1=-1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
369 static int oldtargetHotEnd1=-1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
370 int tHotEnd1=intround(degHotend1());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
371 if((tHotEnd1!=olddegHotEnd1)||force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
372 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
373 lcd.setCursor(11,0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
374 lcd.print(ftostr3(tHotEnd1));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
375 olddegHotEnd1=tHotEnd1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
376 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
377 int ttHotEnd1=intround(degTargetHotend1());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
378 if((ttHotEnd1!=oldtargetHotEnd1)||force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
379 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
380 lcd.setCursor(15,0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
381 lcd.print(ftostr3(ttHotEnd1));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
382 oldtargetHotEnd1=ttHotEnd1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
383 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
384 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
385 //starttime=2;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
386 static uint16_t oldtime=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
387 if(starttime!=0)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
388 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
389 lcd.setCursor(0,1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
390 uint16_t time=millis()/60000-starttime/60000;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
391
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
392 if(starttime!=oldtime)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
393 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
394 lcd.print(itostr2(time/60));lcdprintPGM("h ");lcd.print(itostr2(time%60));lcdprintPGM("m");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
395 oldtime=time;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
396 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
397 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
398 static int oldzpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
399 int currentz=current_position[2]*100;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
400 if((currentz!=oldzpos)||force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
401 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
402 lcd.setCursor(10,1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
403 lcdprintPGM("Z:");lcd.print(ftostr52(current_position[2]));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
404 oldzpos=currentz;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
405 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
406
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
407 static int oldfeedmultiply=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
408 int curfeedmultiply=feedmultiply;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
409
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
410 if(feedmultiplychanged == true) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
411 feedmultiplychanged = false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
412 encoderpos = curfeedmultiply;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
413 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
414
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
415 if(encoderpos!=curfeedmultiply||force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
416 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
417 curfeedmultiply=encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
418 if(curfeedmultiply<10)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
419 curfeedmultiply=10;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
420 if(curfeedmultiply>999)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
421 curfeedmultiply=999;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
422 feedmultiply=curfeedmultiply;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
423 encoderpos=curfeedmultiply;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
424 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
425
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
426 if((curfeedmultiply!=oldfeedmultiply)||force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
427 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
428 oldfeedmultiply=curfeedmultiply;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
429 lcd.setCursor(0,2);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
430 lcd.print(itostr3(curfeedmultiply));lcdprintPGM("% ");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
431 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
432
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
433 if(messagetext[0]!='\0')
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
434 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
435 lcd.setCursor(0,LCD_HEIGHT-1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
436 lcd.print(messagetext);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
437 uint8_t n=strlen(messagetext);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
438 for(int8_t i=0;i<LCD_WIDTH-n;i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
439 lcd.print(" ");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
440 messagetext[0]='\0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
441 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
442 #ifdef SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
443 static uint8_t oldpercent=101;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
444 uint8_t percent=card.percentDone();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
445 if(oldpercent!=percent ||force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
446 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
447 lcd.setCursor(10,2);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
448 lcd.print(itostr3((int)percent));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
449 lcdprintPGM("%SD");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
450 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
451 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
452 #else //smaller LCDS----------------------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
453 static int olddegHotEnd0=-1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
454 static int oldtargetHotEnd0=-1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
455 if(force_lcd_update) //initial display of content
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
456 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
457 encoderpos=feedmultiply;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
458 lcd.setCursor(0,0);lcdprintPGM("\002---/---\001 ");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
459 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
460
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
461 int tHotEnd0=intround(degHotend0());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
462 int ttHotEnd0=intround(degTargetHotend0());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
463
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
464
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
465 if((abs(tHotEnd0-olddegHotEnd0)>1)||force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
466 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
467 lcd.setCursor(1,0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
468 lcd.print(ftostr3(tHotEnd0));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
469 olddegHotEnd0=tHotEnd0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
470 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
471 if((ttHotEnd0!=oldtargetHotEnd0)||force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
472 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
473 lcd.setCursor(5,0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
474 lcd.print(ftostr3(ttHotEnd0));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
475 oldtargetHotEnd0=ttHotEnd0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
476 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
477
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
478 if(messagetext[0]!='\0')
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
479 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
480 lcd.setCursor(0,LCD_HEIGHT-1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
481 lcd.print(messagetext);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
482 uint8_t n=strlen(messagetext);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
483 for(int8_t i=0;i<LCD_WIDTH-n;i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
484 lcd.print(" ");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
485 messagetext[0]='\0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
486 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
487
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
488 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
489 force_lcd_update=false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
490 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
491
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
492 enum {ItemP_exit, ItemP_autostart,ItemP_disstep,ItemP_home, ItemP_origin, ItemP_preheat_pla, ItemP_preheat_abs, ItemP_cooldown,/*ItemP_extrude,*/ItemP_move};
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
493
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
494 //any action must not contain a ',' character anywhere, or this breaks:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
495 #define MENUITEM(repaint_action, click_action) \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
496 {\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
497 if(force_lcd_update) { lcd.setCursor(0,line); repaint_action; } \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
498 if((activeline==line) && CLICKED) {click_action} \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
499 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
500
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
501 void MainMenu::showPrepare()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
502 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
503 #ifdef ULTIPANEL
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
504 uint8_t line=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
505 clearIfNecessary();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
506 for(int8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
507 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
508 //Serial.println((int)(line-lineoffset));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
509 switch(i)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
510 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
511 case ItemP_exit:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
512 MENUITEM( lcdprintPGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
513 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
514 case ItemP_autostart:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
515 MENUITEM( lcdprintPGM(MSG_AUTOSTART) , BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
516 #ifdef SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
517 card.lastnr=0;card.setroot();card.checkautostart(true);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
518 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
519 beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
520 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
521 case ItemP_disstep:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
522 MENUITEM( lcdprintPGM(MSG_DISABLE_STEPPERS) , BLOCK;enquecommand("M84");beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
523 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
524 case ItemP_home:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
525 MENUITEM( lcdprintPGM(MSG_AUTO_HOME) , BLOCK;enquecommand("G28");beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
526 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
527 case ItemP_origin:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
528 MENUITEM( lcdprintPGM(MSG_SET_ORIGIN) , BLOCK;enquecommand("G92 X0 Y0 Z0");beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
529 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
530 case ItemP_preheat_pla:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
531 MENUITEM( lcdprintPGM(MSG_PREHEAT_PLA) , BLOCK;setTargetHotend0(PLA_PREHEAT_HOTEND_TEMP);setTargetBed(PLA_PREHEAT_HPB_TEMP);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
532 #if FAN_PIN > -1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
533 analogWrite(FAN_PIN, PLA_PREHEAT_FAN_SPEED);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
534 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
535 beepshort(); );
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
536 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
537 case ItemP_preheat_abs:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
538 MENUITEM( lcdprintPGM(MSG_PREHEAT_ABS) , BLOCK;setTargetHotend0(ABS_PREHEAT_HOTEND_TEMP);setTargetBed(ABS_PREHEAT_HPB_TEMP);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
539 #if FAN_PIN > -1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
540 analogWrite(FAN_PIN, ABS_PREHEAT_FAN_SPEED);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
541 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
542 beepshort(); );
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
543 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
544 case ItemP_cooldown:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
545 MENUITEM( lcdprintPGM(MSG_COOLDOWN) , BLOCK;setTargetHotend0(0);setTargetHotend1(0);setTargetHotend2(0);setTargetBed(0);beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
546 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
547 // case ItemP_extrude:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
548 // MENUITEM( lcdprintPGM(" Extrude") , BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E50");beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
549 // break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
550 case ItemP_move:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
551 MENUITEM( lcdprintPGM(MSG_MOVE_AXIS) , BLOCK;status=Sub_PrepareMove;beepshort(); );
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
552 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
553 default:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
554 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
555 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
556 line++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
557 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
558 updateActiveLines(ItemP_move,encoderpos);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
559 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
560 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
561
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
562 enum {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
563 ItemAM_exit,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
564 ItemAM_X, ItemAM_Y, ItemAM_Z, ItemAM_E
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
565 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
566
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
567 void MainMenu::showAxisMove()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
568 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
569 uint8_t line=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
570 int oldencoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
571 clearIfNecessary();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
572 for(int8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
573 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
574 switch(i)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
575 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
576 case ItemAM_exit:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
577 MENUITEM( lcdprintPGM(MSG_PREPARE_ALT) , BLOCK;status=Main_Menu;beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
578 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
579 case ItemAM_X:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
580 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
581 //oldencoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
582 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
583 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
584 lcd.setCursor(0,line);lcdprintPGM(" X:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
585 lcd.setCursor(11,line);lcd.print(ftostr52(current_position[X_AXIS]));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
586 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
587
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
588 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
589 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
590
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
591 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
592 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
593 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
594 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
595 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
596 enquecommand("G91");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
597 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
598 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
599 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
600 enquecommand("G90");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
601 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
602 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
603 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
604 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
605 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
606 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
607 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
608 if (encoderpos >0)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
609 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
610 enquecommand("G1 F700 X0.1");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
611 oldencoderpos=encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
612 encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
613 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
614
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
615 else if (encoderpos < 0)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
616 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
617 enquecommand("G1 F700 X-0.1");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
618 oldencoderpos=encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
619 encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
620 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
621 lcd.setCursor(11,line);lcd.print(ftostr52(current_position[X_AXIS]));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
622 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
623 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
624 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
625 case ItemAM_Y:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
626 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
627 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
628 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
629 lcd.setCursor(0,line);lcdprintPGM(" Y:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
630 lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Y_AXIS]));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
631 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
632
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
633 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
634 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
635
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
636 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
637 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
638 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
639 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
640 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
641 enquecommand("G91");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
642 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
643 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
644 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
645 enquecommand("G90");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
646 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
647 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
648 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
649 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
650 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
651 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
652 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
653 if (encoderpos >0)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
654 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
655 enquecommand("G1 F700 Y0.1");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
656 oldencoderpos=encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
657 encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
658 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
659
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
660 else if (encoderpos < 0)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
661 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
662 enquecommand("G1 F700 Y-0.1");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
663 oldencoderpos=encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
664 encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
665 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
666 lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Y_AXIS]));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
667 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
668 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
669 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
670 case ItemAM_Z:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
671 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
672 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
673 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
674 lcd.setCursor(0,line);lcdprintPGM(" Z:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
675 lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Z_AXIS]));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
676 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
677
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
678 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
679 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
680
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
681 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
682 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
683 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
684 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
685 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
686 enquecommand("G91");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
687 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
688 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
689 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
690 enquecommand("G90");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
691 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
692 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
693 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
694 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
695 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
696 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
697 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
698 if (encoderpos >0)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
699 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
700 enquecommand("G1 F70 Z0.1");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
701 oldencoderpos=encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
702 encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
703 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
704
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
705 else if (encoderpos < 0)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
706 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
707 enquecommand("G1 F70 Z-0.1");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
708 oldencoderpos=encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
709 encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
710 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
711 lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Z_AXIS]));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
712 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
713 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
714 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
715 case ItemAM_E:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
716 // ErikDB: TODO: this length should be changed for volumetric.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
717 MENUITEM( lcdprintPGM(MSG_EXTRUDE) , BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E5");beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
718 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
719 default:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
720 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
721 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
722 line++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
723 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
724 updateActiveLines(ItemAM_E,encoderpos);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
725 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
726
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
727 enum {ItemT_exit,ItemT_speed,ItemT_flow,ItemT_nozzle,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
728 #if (HEATER_BED_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
729 ItemT_bed,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
730 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
731 ItemT_fan};
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
732
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
733 void MainMenu::showTune()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
734 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
735 uint8_t line=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
736 clearIfNecessary();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
737 for(int8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
738 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
739 //Serial.println((int)(line-lineoffset));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
740 switch(i)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
741 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
742 case ItemT_exit:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
743 MENUITEM( lcdprintPGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
744 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
745 case ItemT_speed:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
746 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
747 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
748 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
749 lcd.setCursor(0,line);lcdprintPGM(MSG_SPEED);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
750 lcd.setCursor(13,line);lcd.print(ftostr3(feedmultiply));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
751 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
752
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
753 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
754 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
755
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
756 if(CLICKED) //AnalogWrite(FAN_PIN, fanpwm);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
757 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
758 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
759 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
760 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
761 encoderpos=feedmultiply;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
762 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
763 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
764 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
765 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
766 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
767 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
768 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
769 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
770 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
771 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
772 if(encoderpos<1) encoderpos=1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
773 if(encoderpos>400) encoderpos=400;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
774 feedmultiply = encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
775 feedmultiplychanged=true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
776 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
777 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
778
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
779 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
780 case ItemT_nozzle:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
781 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
782 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
783 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
784 lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
785 lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
786 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
787
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
788 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
789 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
790
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
791 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
792 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
793 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
794 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
795 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
796 encoderpos=intround(degTargetHotend0());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
797 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
798 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
799 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
800 setTargetHotend0(encoderpos);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
801 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
802 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
803 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
804 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
805 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
806 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
807 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
808 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
809 if(encoderpos>260) encoderpos=260;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
810 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
811 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
812 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
813 #if (HEATER_BED_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
814 case ItemT_bed:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
815 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
816 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
817 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
818 lcd.setCursor(0,line);lcdprintPGM(MSG_BED);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
819 lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
820 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
821
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
822 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
823 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
824
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
825 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
826 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
827 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
828 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
829 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
830 encoderpos=intround(degTargetBed());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
831 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
832 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
833 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
834 setTargetBed(encoderpos);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
835 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
836 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
837 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
838 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
839 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
840 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
841 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
842 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
843 if(encoderpos>260) encoderpos=260;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
844 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
845 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
846 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
847 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
848
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
849
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
850 case ItemT_fan:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
851 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
852 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
853 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
854 lcd.setCursor(0,line);lcdprintPGM(MSG_FAN_SPEED);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
855 lcd.setCursor(13,line);lcd.print(ftostr3(FanSpeed));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
856 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
857
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
858 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
859 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
860
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
861 if(CLICKED) //nalogWrite(FAN_PIN, fanpwm);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
862 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
863 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
864 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
865 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
866 encoderpos=FanSpeed;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
867 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
868 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
869 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
870 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
871 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
872 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
873 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
874 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
875 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
876 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
877 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
878 if(encoderpos>255) encoderpos=255;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
879 FanSpeed=encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
880 analogWrite(FAN_PIN, FanSpeed);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
881 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
882 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
883
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
884 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
885 case ItemT_flow://axis_steps_per_unit[i] = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
886 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
887 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
888 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
889 lcd.setCursor(0,line);lcdprintPGM(MSG_FLOW);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
890 lcd.setCursor(13,line);lcd.print(ftostr52(axis_steps_per_unit[E_AXIS]));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
891 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
892
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
893 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
894 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
895
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
896 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
897 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
898 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
899 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
900 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
901 encoderpos=(long)(axis_steps_per_unit[E_AXIS]*100.0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
902 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
903 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
904 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
905 float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[E_AXIS]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
906 position[E_AXIS]=lround(position[E_AXIS]*factor);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
907 //current_position[E_AXIS]*=factor;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
908 axis_steps_per_unit[E_AXIS]= encoderpos/100.0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
909 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
910
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
911 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
912 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
913 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
914 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
915 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
916 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
917 if(encoderpos<5) encoderpos=5;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
918 if(encoderpos>999999) encoderpos=999999;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
919 lcd.setCursor(13,line);lcd.print(ftostr52(encoderpos/100.0));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
920 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
921
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
922 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
923 default:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
924 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
925 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
926 line++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
927 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
928 updateActiveLines(ItemT_fan,encoderpos);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
929 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
930
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
931 //does not work
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
932 // #define MENUCHANGEITEM(repaint_action, enter_action, accept_action, change_action) \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
933 // {\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
934 // if(force_lcd_update) { lcd.setCursor(0,line); repaint_action; } \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
935 // if(activeline==line) \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
936 // { \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
937 // if(CLICKED) \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
938 // { \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
939 // linechanging=!linechanging; \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
940 // if(linechanging) {enter_action;} \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
941 // else {accept_action;} \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
942 // } \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
943 // else \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
944 // if(linechanging) {change_action};}\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
945 // }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
946 //
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
947
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
948 enum {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
949 ItemCT_exit,ItemCT_nozzle0,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
950 #ifdef AUTOTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
951 ItemCT_autotempactive,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
952 ItemCT_autotempmin,ItemCT_autotempmax,ItemCT_autotempfact,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
953 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
954 #if EXTRUDERS > 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
955 ItemCT_nozzle1,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
956 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
957 #if EXTRUDERS > 2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
958 ItemCT_nozzle2,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
959 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
960 #if defined BED_USES_THERMISTOR || BED_USES_AD595
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
961 ItemCT_bed,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
962 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
963 ItemCT_fan,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
964 ItemCT_PID_P,ItemCT_PID_I,ItemCT_PID_D,ItemCT_PID_C
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
965 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
966
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
967 void MainMenu::showControlTemp()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
968 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
969 uint8_t line=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
970 clearIfNecessary();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
971 for(int8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
972 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
973 switch(i)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
974 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
975 case ItemCT_exit:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
976 MENUITEM( lcdprintPGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
977 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
978 case ItemCT_nozzle0:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
979 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
980 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
981 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
982 lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
983 lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
984 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
985
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
986 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
987 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
988
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
989 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
990 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
991 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
992 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
993 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
994 encoderpos=intround(degTargetHotend0());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
995 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
996 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
997 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
998 setTargetHotend0(encoderpos);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
999 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1000 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1001 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1002 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1003 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1004 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1005 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1006 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1007 if(encoderpos>260) encoderpos=260;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1008 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1009 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1010
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1011 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1012 #if EXTRUDERS > 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1013 case ItemCT_nozzle1:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1014 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1015 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1016 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1017 lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1018 lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend1())));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1019 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1020
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1021 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1022 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1023
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1024 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1025 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1026 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1027 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1028 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1029 encoderpos=intround(degTargetHotend1());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1030 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1031 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1032 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1033 setTargetHotend1(encoderpos);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1034 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1035 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1036 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1037 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1038 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1039 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1040 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1041 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1042 if(encoderpos>260) encoderpos=260;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1043 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1044 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1045
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1046 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1047 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1048 #if EXTRUDERS > 2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1049 case ItemCT_nozzle2:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1050 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1051 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1052 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1053 lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE2);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1054 lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend2())));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1055 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1056
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1057 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1058 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1059
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1060 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1061 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1062 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1063 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1064 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1065 encoderpos=intround(degTargetHotend2());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1066 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1067 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1068 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1069 setTargetHotend1(encoderpos);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1070 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1071 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1072 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1073 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1074 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1075 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1076 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1077 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1078 if(encoderpos>260) encoderpos=260;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1079 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1080 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1081
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1082 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1083 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1084 #ifdef AUTOTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1085 case ItemCT_autotempmin:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1086 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1087 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1088 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1089 lcd.setCursor(0,line);lcdprintPGM(MSG_MIN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1090 lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_min));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1091 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1092
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1093 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1094 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1095
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1096 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1097 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1098 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1099 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1100 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1101 encoderpos=intround(autotemp_min);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1102 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1103 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1104 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1105 autotemp_min=encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1106 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1107 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1108 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1109 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1110 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1111 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1112 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1113 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1114 if(encoderpos>260) encoderpos=260;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1115 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1116 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1117
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1118 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1119 case ItemCT_autotempmax:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1120 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1121 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1122 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1123 lcd.setCursor(0,line);lcdprintPGM(MSG_MAX);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1124 lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_max));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1125 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1126
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1127 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1128 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1129
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1130 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1131 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1132 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1133 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1134 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1135 encoderpos=intround(autotemp_max);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1136 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1137 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1138 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1139 autotemp_max=encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1140 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1141 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1142 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1143 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1144 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1145 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1146 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1147 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1148 if(encoderpos>260) encoderpos=260;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1149 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1150 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1151
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1152 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1153 case ItemCT_autotempfact:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1154 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1155 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1156 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1157 lcd.setCursor(0,line);lcdprintPGM(MSG_FACTOR);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1158 lcd.setCursor(13,line);lcd.print(ftostr32(autotemp_factor));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1159 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1160
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1161 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1162 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1163
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1164 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1165 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1166 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1167 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1168 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1169 encoderpos=intround(autotemp_factor*100);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1170 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1171 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1172 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1173 autotemp_max=encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1174 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1175 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1176 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1177 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1178 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1179 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1180 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1181 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1182 if(encoderpos>99) encoderpos=99;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1183 lcd.setCursor(13,line);lcd.print(ftostr32(encoderpos/100.));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1184 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1185
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1186 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1187 case ItemCT_autotempactive:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1188 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1189 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1190 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1191 lcd.setCursor(0,line);lcdprintPGM(MSG_AUTOTEMP);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1192 lcd.setCursor(13,line);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1193 if(autotemp_enabled)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1194 lcdprintPGM(MSG_ON);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1195 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1196 lcdprintPGM(MSG_OFF);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1197 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1198
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1199 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1200 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1201
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1202 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1203 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1204 autotemp_enabled=!autotemp_enabled;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1205 lcd.setCursor(13,line);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1206 if(autotemp_enabled)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1207 lcdprintPGM(MSG_ON);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1208 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1209 lcdprintPGM(MSG_OFF);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1210 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1211 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1212
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1213 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1214 #endif //autotemp
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1215 #if defined BED_USES_THERMISTOR || BED_USES_AD595
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1216 case ItemCT_bed:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1217 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1218 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1219 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1220 lcd.setCursor(0,line);lcdprintPGM(MSG_BED);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1221 lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1222 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1223
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1224 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1225 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1226
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1227 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1228 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1229 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1230 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1231 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1232 encoderpos=intround(degTargetBed());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1233 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1234 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1235 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1236 setTargetBed(encoderpos);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1237 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1238 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1239 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1240 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1241 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1242 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1243 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1244 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1245 if(encoderpos>260) encoderpos=260;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1246 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1247 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1248 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1249 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1250 case ItemCT_fan:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1251 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1252 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1253 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1254 lcd.setCursor(0,line);lcdprintPGM(MSG_FAN_SPEED);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1255 lcd.setCursor(13,line);lcd.print(ftostr3(FanSpeed));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1256 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1257
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1258 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1259 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1260
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1261 if(CLICKED) //nalogWrite(FAN_PIN, fanpwm);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1262 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1263 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1264 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1265 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1266 encoderpos=FanSpeed;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1267 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1268 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1269 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1270 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1271 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1272 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1273 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1274 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1275 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1276 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1277 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1278 if(encoderpos>255) encoderpos=255;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1279 FanSpeed=encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1280 analogWrite(FAN_PIN, FanSpeed);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1281 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1282 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1283
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1284 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1285 #ifdef PIDTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1286 case ItemCT_PID_P:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1287 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1288 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1289 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1290 lcd.setCursor(0,line);lcdprintPGM(" PID-P: ");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1291 lcd.setCursor(13,line);lcd.print(itostr4(Kp));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1292 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1293
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1294 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1295 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1296
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1297 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1298 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1299 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1300 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1301 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1302 encoderpos=(long)Kp;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1303 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1304 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1305 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1306 Kp= encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1307 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1308
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1309 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1310 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1311 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1312 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1313 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1314 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1315 if(encoderpos<1) encoderpos=1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1316 if(encoderpos>9990) encoderpos=9990;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1317 lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1318 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1319
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1320 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1321 case ItemCT_PID_I:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1322 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1323 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1324 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1325 lcd.setCursor(0,line);lcdprintPGM(MSG_PID_I);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1326 lcd.setCursor(13,line);lcd.print(ftostr51(Ki/PID_dT));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1327 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1328
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1329 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1330 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1331
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1332 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1333 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1334 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1335 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1336 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1337 encoderpos=(long)(Ki*10/PID_dT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1338 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1339 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1340 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1341 Ki= encoderpos/10.*PID_dT;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1342 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1343
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1344 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1345 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1346 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1347 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1348 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1349 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1350 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1351 if(encoderpos>9990) encoderpos=9990;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1352 lcd.setCursor(13,line);lcd.print(ftostr51(encoderpos/10.));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1353 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1354
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1355 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1356 case ItemCT_PID_D:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1357 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1358 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1359 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1360 lcd.setCursor(0,line);lcdprintPGM(MSG_PID_D);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1361 lcd.setCursor(13,line);lcd.print(itostr4(Kd*PID_dT));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1362 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1363
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1364 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1365 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1366
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1367
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1368 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1369 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1370 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1371 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1372 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1373 encoderpos=(long)(Kd/5./PID_dT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1374 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1375 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1376 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1377 Kd= encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1378 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1379
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1380 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1381 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1382 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1383 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1384 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1385 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1386 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1387 if(encoderpos>9990) encoderpos=9990;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1388 lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1389 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1390
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1391 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1392 case ItemCT_PID_C:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1393 #ifdef PID_ADD_EXTRUSION_RATE
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1394 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1395 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1396 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1397 lcd.setCursor(0,line);lcdprintPGM(MSG_PID_C);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1398 lcd.setCursor(13,line);lcd.print(itostr3(Kc));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1399 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1400
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1401 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1402 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1403
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1404 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1405 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1406 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1407 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1408 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1409 encoderpos=(long)Kc;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1410 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1411 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1412 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1413 Kc= encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1414 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1415
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1416 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1417 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1418 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1419 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1420 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1421 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1422 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1423 if(encoderpos>990) encoderpos=990;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1424 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1425 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1426
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1427 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1428 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1429 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1430 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1431 default:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1432 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1433 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1434 line++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1435 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1436 #ifdef PID_ADD_EXTRUSION_RATE
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1437 updateActiveLines(ItemCT_PID_C,encoderpos);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1438 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1439 updateActiveLines(ItemCT_PID_D,encoderpos);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1440 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1441 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1442
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1443
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1444 enum {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1445 ItemCM_exit,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1446 ItemCM_acc, ItemCM_xyjerk,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1447 ItemCM_vmaxx, ItemCM_vmaxy, ItemCM_vmaxz, ItemCM_vmaxe,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1448 ItemCM_vtravmin,ItemCM_vmin,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1449 ItemCM_amaxx, ItemCM_amaxy, ItemCM_amaxz, ItemCM_amaxe,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1450 ItemCM_aret, ItemCM_xsteps,ItemCM_ysteps, ItemCM_zsteps, ItemCM_esteps
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1451 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1452
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1453
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1454
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1455 void MainMenu::showControlMotion()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1456 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1457 uint8_t line=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1458 clearIfNecessary();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1459 for(int8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1460 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1461 switch(i)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1462 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1463 case ItemCM_exit:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1464 MENUITEM( lcdprintPGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1465 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1466 case ItemCM_acc:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1467 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1468 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1469 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1470 lcd.setCursor(0,line);lcdprintPGM(MSG_ACC);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1471 lcd.setCursor(13,line);lcd.print(itostr3(acceleration/100));lcdprintPGM("00");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1472 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1473
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1474 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1475 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1476
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1477 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1478 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1479 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1480 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1481 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1482 encoderpos=(long)acceleration/100;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1483 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1484 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1485 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1486 acceleration= encoderpos*100;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1487 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1488 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1489 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1490 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1491 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1492 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1493 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1494 if(encoderpos<5) encoderpos=5;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1495 if(encoderpos>990) encoderpos=990;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1496 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));lcdprintPGM("00");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1497 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1498
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1499 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1500 case ItemCM_xyjerk: //max_xy_jerk
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1501 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1502 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1503 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1504 lcd.setCursor(0,line);lcdprintPGM(MSG_VXY_JERK);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1505 lcd.setCursor(13,line);lcd.print(itostr3(max_xy_jerk));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1506 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1507
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1508 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1509 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1510
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1511 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1512 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1513 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1514 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1515 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1516 encoderpos=(long)max_xy_jerk;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1517 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1518 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1519 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1520 max_xy_jerk= encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1521 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1522
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1523 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1524 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1525 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1526 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1527 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1528 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1529 if(encoderpos<1) encoderpos=1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1530 if(encoderpos>990) encoderpos=990;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1531 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1532 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1533
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1534 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1535
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1536 case ItemCM_vmaxx:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1537 case ItemCM_vmaxy:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1538 case ItemCM_vmaxz:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1539 case ItemCM_vmaxe:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1540 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1541 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1542 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1543 lcd.setCursor(0,line);lcdprintPGM(MSG_VMAX);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1544 if(i==ItemCM_vmaxx)lcdprintPGM(MSG_X);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1545 if(i==ItemCM_vmaxy)lcdprintPGM(MSG_Y);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1546 if(i==ItemCM_vmaxz)lcdprintPGM(MSG_Z);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1547 if(i==ItemCM_vmaxe)lcdprintPGM(MSG_E);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1548 lcd.setCursor(13,line);lcd.print(itostr3(max_feedrate[i-ItemCM_vmaxx]));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1549 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1550
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1551 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1552 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1553
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1554 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1555 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1556 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1557 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1558 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1559 encoderpos=(long)max_feedrate[i-ItemCM_vmaxx];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1560 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1561 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1562 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1563 max_feedrate[i-ItemCM_vmaxx]= encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1564 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1565
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1566 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1567 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1568 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1569 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1570 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1571 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1572 if(encoderpos<1) encoderpos=1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1573 if(encoderpos>990) encoderpos=990;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1574 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1575 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1576
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1577 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1578
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1579 case ItemCM_vmin:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1580 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1581 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1582 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1583 lcd.setCursor(0,line);lcdprintPGM(MSG_VMIN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1584 lcd.setCursor(13,line);lcd.print(itostr3(minimumfeedrate));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1585 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1586
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1587 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1588 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1589
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1590 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1591 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1592 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1593 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1594 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1595 encoderpos=(long)(minimumfeedrate);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1596 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1597 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1598 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1599 minimumfeedrate= encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1600 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1601
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1602 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1603 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1604 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1605 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1606 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1607 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1608 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1609 if(encoderpos>990) encoderpos=990;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1610 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1611 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1612
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1613 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1614 case ItemCM_vtravmin:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1615 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1616 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1617 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1618 lcd.setCursor(0,line);lcdprintPGM(MSG_VTRAV_MIN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1619 lcd.setCursor(13,line);lcd.print(itostr3(mintravelfeedrate));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1620 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1621
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1622 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1623 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1624
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1625 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1626 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1627 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1628 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1629 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1630 encoderpos=(long)mintravelfeedrate;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1631 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1632 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1633 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1634 mintravelfeedrate= encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1635 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1636
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1637 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1638 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1639 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1640 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1641 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1642 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1643 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1644 if(encoderpos>990) encoderpos=990;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1645 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1646 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1647
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1648 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1649
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1650 case ItemCM_amaxx:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1651 case ItemCM_amaxy:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1652 case ItemCM_amaxz:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1653 case ItemCM_amaxe:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1654 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1655 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1656 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1657 lcd.setCursor(0,line);lcdprintPGM(" Amax ");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1658 if(i==ItemCM_amaxx)lcdprintPGM(MSG_X);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1659 if(i==ItemCM_amaxy)lcdprintPGM(MSG_Y);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1660 if(i==ItemCM_amaxz)lcdprintPGM(MSG_Z);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1661 if(i==ItemCM_amaxe)lcdprintPGM(MSG_E);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1662 lcd.setCursor(13,line);lcd.print(itostr3(max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100));lcdprintPGM("00");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1663 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1664
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1665 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1666 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1667
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1668 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1669 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1670 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1671 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1672 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1673 encoderpos=(long)max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1674 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1675 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1676 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1677 max_acceleration_units_per_sq_second[i-ItemCM_amaxx]= encoderpos*100;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1678 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1679 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1680 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1681 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1682 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1683 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1684 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1685 if(encoderpos<1) encoderpos=1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1686 if(encoderpos>990) encoderpos=990;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1687 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));lcdprintPGM("00");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1688 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1689
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1690 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1691
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1692
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1693 case ItemCM_aret://float retract_acceleration = 7000;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1694 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1695 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1696 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1697 lcd.setCursor(0,line);lcdprintPGM(MSG_A_RETRACT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1698 lcd.setCursor(13,line);lcd.print(ftostr3(retract_acceleration/100));lcdprintPGM("00");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1699 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1700
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1701 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1702 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1703
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1704 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1705 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1706 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1707 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1708 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1709 encoderpos=(long)retract_acceleration/100;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1710 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1711 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1712 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1713 retract_acceleration= encoderpos*100;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1714 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1715
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1716 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1717 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1718 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1719 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1720 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1721 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1722 if(encoderpos<10) encoderpos=10;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1723 if(encoderpos>990) encoderpos=990;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1724 lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));lcdprintPGM("00");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1725 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1726
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1727 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1728 case ItemCM_xsteps://axis_steps_per_unit[i] = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1729 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1730 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1731 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1732 lcd.setCursor(0,line);lcdprintPGM(MSG_XSTEPS);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1733 lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[X_AXIS]));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1734 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1735
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1736 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1737 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1738
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1739 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1740 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1741 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1742 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1743 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1744 encoderpos=(long)(axis_steps_per_unit[X_AXIS]*100.0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1745 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1746 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1747 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1748 float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[X_AXIS]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1749 position[X_AXIS]=lround(position[X_AXIS]*factor);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1750 //current_position[X_AXIS]*=factor;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1751 axis_steps_per_unit[X_AXIS]= encoderpos/100.0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1752 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1753 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1754 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1755 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1756 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1757 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1758 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1759 if(encoderpos<5) encoderpos=5;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1760 if(encoderpos>999999) encoderpos=999999;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1761 lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1762 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1763
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1764 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1765 case ItemCM_ysteps://axis_steps_per_unit[i] = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1766 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1767 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1768 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1769 lcd.setCursor(0,line);lcdprintPGM(MSG_YSTEPS);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1770 lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[Y_AXIS]));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1771 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1772
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1773 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1774 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1775
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1776 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1777 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1778 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1779 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1780 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1781 encoderpos=(long)(axis_steps_per_unit[Y_AXIS]*100.0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1782 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1783 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1784 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1785 float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[Y_AXIS]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1786 position[Y_AXIS]=lround(position[Y_AXIS]*factor);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1787 //current_position[Y_AXIS]*=factor;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1788 axis_steps_per_unit[Y_AXIS]= encoderpos/100.0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1789 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1790
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1791 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1792 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1793 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1794 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1795 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1796 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1797 if(encoderpos<5) encoderpos=5;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1798 if(encoderpos>999999) encoderpos=999999;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1799 lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1800 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1801
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1802 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1803 case ItemCM_zsteps://axis_steps_per_unit[i] = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1804 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1805 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1806 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1807 lcd.setCursor(0,line);lcdprintPGM(MSG_ZSTEPS);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1808 lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[Z_AXIS]));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1809 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1810
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1811 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1812 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1813
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1814 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1815 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1816 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1817 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1818 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1819 encoderpos=(long)(axis_steps_per_unit[Z_AXIS]*100.0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1820 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1821 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1822 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1823 float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[Z_AXIS]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1824 position[Z_AXIS]=lround(position[Z_AXIS]*factor);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1825 //current_position[Z_AXIS]*=factor;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1826 axis_steps_per_unit[Z_AXIS]= encoderpos/100.0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1827 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1828
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1829 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1830 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1831 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1832 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1833 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1834 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1835 if(encoderpos<5) encoderpos=5;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1836 if(encoderpos>999999) encoderpos=999999;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1837 lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1838 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1839
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1840 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1841
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1842 case ItemCM_esteps://axis_steps_per_unit[i] = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1843 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1844 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1845 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1846 lcd.setCursor(0,line);lcdprintPGM(MSG_ESTEPS);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1847 lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[E_AXIS]));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1848 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1849
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1850 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1851 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1852
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1853 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1854 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1855 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1856 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1857 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1858 encoderpos=(long)(axis_steps_per_unit[E_AXIS]*100.0);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1859 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1860 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1861 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1862 float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[E_AXIS]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1863 position[E_AXIS]=lround(position[E_AXIS]*factor);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1864 //current_position[E_AXIS]*=factor;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1865 axis_steps_per_unit[E_AXIS]= encoderpos/100.0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1866 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1867
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1868 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1869 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1870 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1871 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1872 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1873 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1874 if(encoderpos<5) encoderpos=5;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1875 if(encoderpos>999999) encoderpos=999999;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1876 lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1877 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1878
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1879 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1880 default:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1881 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1882 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1883 line++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1884 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1885 updateActiveLines(ItemCM_esteps,encoderpos);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1886 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1887
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1888
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1889 enum {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1890 ItemR_exit,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1891 ItemR_autoretract,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1892 ItemR_retract_length,ItemR_retract_feedrate,ItemR_retract_zlift,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1893 ItemR_unretract_length,ItemR_unretract_feedrate,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1894
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1895 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1896
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1897
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1898
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1899 void MainMenu::showControlRetract()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1900 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1901 #ifdef FWRETRACT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1902 uint8_t line=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1903 clearIfNecessary();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1904 for(int8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1905 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1906 switch(i)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1907 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1908 case ItemR_exit:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1909 MENUITEM( lcdprintPGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1910 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1911
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1912 //float retract_length=2, retract_feedrate=1200, retract_zlift=0.4;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1913 //float retract_recover_length=0, retract_recover_feedrate=500;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1914 case ItemR_autoretract:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1915 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1916 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1917 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1918 lcd.setCursor(0,line);lcdprintPGM(MSG_AUTORETRACT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1919 lcd.setCursor(13,line);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1920 if(autoretract_enabled)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1921 lcdprintPGM(MSG_ON);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1922 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1923 lcdprintPGM(MSG_OFF);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1924 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1925
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1926 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1927 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1928
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1929 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1930 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1931 autoretract_enabled=!autoretract_enabled;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1932 lcd.setCursor(13,line);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1933 if(autoretract_enabled)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1934 lcdprintPGM(MSG_ON);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1935 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1936 lcdprintPGM(MSG_OFF);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1937 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1938 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1939
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1940 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1941
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1942 case ItemR_retract_length:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1943 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1944 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1945 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1946 lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1947 lcd.setCursor(13,line);lcd.print(ftostr52(retract_length));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1948 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1949
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1950 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1951 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1952
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1953 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1954 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1955 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1956 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1957 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1958 encoderpos=(long)(retract_length*100);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1959 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1960 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1961 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1962 retract_length= encoderpos/100.;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1963 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1964
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1965 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1966 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1967 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1968 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1969 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1970 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1971 if(encoderpos<1) encoderpos=1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1972 if(encoderpos>990) encoderpos=990;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1973 lcd.setCursor(13,line);lcd.print(ftostr52(encoderpos/100.));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1974 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1975
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1976 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1977 case ItemR_retract_feedrate:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1978 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1979 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1980 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1981 lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACTF);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1982 lcd.setCursor(13,line);lcd.print(itostr4(retract_feedrate));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1983 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1984
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1985 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1986 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1987
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1988 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1989 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1990 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1991 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1992 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1993 encoderpos=(long)(retract_feedrate/5);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1994 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1995 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1996 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1997 retract_feedrate= encoderpos*5.;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1998 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1999
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2000 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2001 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2002 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2003 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2004 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2005 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2006 if(encoderpos<1) encoderpos=1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2007 if(encoderpos>990) encoderpos=990;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2008 lcd.setCursor(13,line);lcd.print(itostr4(encoderpos*5));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2009 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2010
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2011 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2012 case ItemR_retract_zlift://float retract_acceleration = 7000;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2013 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2014 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2015 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2016 lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACT_ZLIFT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2017 lcd.setCursor(13,line);lcd.print(ftostr52(retract_zlift));;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2018 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2019
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2020 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2021 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2022
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2023 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2024 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2025 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2026 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2027 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2028 encoderpos=(long)(retract_zlift*10);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2029 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2030 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2031 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2032 retract_zlift= encoderpos/10.;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2033 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2034
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2035 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2036 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2037 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2038 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2039 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2040 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2041 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2042 if(encoderpos>990) encoderpos=990;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2043 lcd.setCursor(13,line);lcd.print(ftostr52(encoderpos/10.));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2044 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2045
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2046 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2047 case ItemR_unretract_length:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2048 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2049 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2050 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2051 lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACT_RECOVER);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2052 lcd.setCursor(13,line);lcd.print(ftostr52(retract_recover_length));;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2053 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2054
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2055 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2056 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2057
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2058 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2059 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2060 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2061 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2062 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2063 encoderpos=(long)(retract_recover_length*100);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2064 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2065 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2066 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2067 retract_recover_length= encoderpos/100.;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2068 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2069
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2070 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2071 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2072 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2073 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2074 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2075 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2076 if(encoderpos<0) encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2077 if(encoderpos>990) encoderpos=990;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2078 lcd.setCursor(13,line);lcd.print(ftostr52(encoderpos/100.));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2079 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2080
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2081 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2082
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2083 case ItemR_unretract_feedrate:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2084 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2085 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2086 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2087 lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACT_RECOVERF);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2088 lcd.setCursor(13,line);lcd.print(itostr4(retract_recover_feedrate));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2089 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2090
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2091 if((activeline!=line) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2092 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2093
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2094 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2095 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2096 linechanging=!linechanging;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2097 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2098 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2099 encoderpos=(long)retract_recover_feedrate/5;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2100 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2101 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2102 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2103 retract_recover_feedrate= encoderpos*5.;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2104 encoderpos=activeline*lcdslow;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2105
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2106 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2107 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2108 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2109 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2110 if(linechanging)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2111 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2112 if(encoderpos<1) encoderpos=1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2113 if(encoderpos>990) encoderpos=990;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2114 lcd.setCursor(13,line);lcd.print(itostr4(encoderpos*5));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2115 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2116
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2117 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2118
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2119 default:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2120 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2121 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2122 line++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2123 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2124 updateActiveLines(ItemR_unretract_feedrate,encoderpos);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2125 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2126 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2127
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2128
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2129
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2130 enum {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2131 ItemC_exit,ItemC_temp,ItemC_move,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2132 #ifdef FWRETRACT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2133 ItemC_rectract,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2134 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2135 ItemC_store, ItemC_load,ItemC_failsafe
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2136 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2137
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2138 void MainMenu::showControl()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2139 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2140 uint8_t line=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2141 clearIfNecessary();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2142 for(int8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2143 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2144 switch(i)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2145 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2146 case ItemC_exit:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2147 MENUITEM( lcdprintPGM(MSG_MAIN_WIDE) , BLOCK;status=Main_Menu;beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2148 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2149 case ItemC_temp:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2150 MENUITEM( lcdprintPGM(MSG_TEMPERATURE_WIDE) , BLOCK;status=Sub_TempControl;beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2151 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2152 case ItemC_move:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2153 MENUITEM( lcdprintPGM(MSG_MOTION_WIDE) , BLOCK;status=Sub_MotionControl;beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2154 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2155 #ifdef FWRETRACT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2156 case ItemC_rectract:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2157 MENUITEM( lcdprintPGM(MSG_RECTRACT_WIDE) , BLOCK;status=Sub_RetractControl;beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2158 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2159 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2160 case ItemC_store:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2161 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2162 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2163 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2164 lcd.setCursor(0,line);lcdprintPGM(MSG_STORE_EPROM);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2165 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2166 if((activeline==line) && CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2167 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2168 //enquecommand("M84");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2169 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2170 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2171 EEPROM_StoreSettings();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2172 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2173 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2174 case ItemC_load:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2175 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2176 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2177 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2178 lcd.setCursor(0,line);lcdprintPGM(MSG_LOAD_EPROM);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2179 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2180 if((activeline==line) && CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2181 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2182 //enquecommand("M84");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2183 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2184 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2185 EEPROM_RetrieveSettings();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2186 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2187 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2188 case ItemC_failsafe:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2189 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2190 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2191 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2192 lcd.setCursor(0,line);lcdprintPGM(MSG_RESTORE_FAILSAFE);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2193 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2194 if((activeline==line) && CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2195 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2196 //enquecommand("M84");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2197 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2198 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2199 EEPROM_RetrieveSettings(true);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2200 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2201 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2202 default:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2203 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2204 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2205 line++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2206 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2207 updateActiveLines(ItemC_failsafe,encoderpos);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2208 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2209
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2210
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2211
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2212
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2213
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2214 void MainMenu::showSD()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2215 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2216 #ifdef SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2217 uint8_t line=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2218
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2219 clearIfNecessary();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2220 static uint8_t nrfiles=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2221 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2222 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2223 if(card.cardOK)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2224 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2225 nrfiles=card.getnrfilenames();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2226 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2227 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2228 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2229 nrfiles=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2230 lineoffset=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2231 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2232 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2233 bool enforceupdate=false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2234 for(int8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2235 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2236 switch(i)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2237 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2238 case 0:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2239 MENUITEM( lcdprintPGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2240 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2241 // case 1:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2242 // {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2243 // if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2244 // {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2245 // lcd.setCursor(0,line);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2246 // #ifdef CARDINSERTED
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2247 // if(CARDINSERTED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2248 // #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2249 // if(true)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2250 // #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2251 // {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2252 // lcdprintPGM(" \004Refresh");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2253 // }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2254 // else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2255 // {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2256 // lcdprintPGM(" \004Insert Card");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2257 // }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2258 //
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2259 // }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2260 // if((activeline==line) && CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2261 // {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2262 // BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2263 // beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2264 // card.initsd();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2265 // force_lcd_update=true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2266 // nrfiles=card.getnrfilenames();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2267 // }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2268 // }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2269 case 1:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2270 MENUITEM( lcd.print(" ");card.getWorkDirName();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2271 if(card.filename[0]=='/') lcdprintPGM(MSG_REFRESH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2272 else {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2273 lcd.print("\005");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2274 lcd.print(card.filename);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2275 lcd.print("/..");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2276 } ,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2277 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2278 if(SDCARDDETECT == -1) card.initsd();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2279 card.updir();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2280 enforceupdate=true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2281 lineoffset=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2282 beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2283
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2284 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2285 default:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2286 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2287 #define FIRSTITEM 2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2288 if(i-FIRSTITEM<nrfiles)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2289 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2290 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2291 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2292 card.getfilename(i-FIRSTITEM);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2293 //Serial.print("Filenr:");Serial.println(i-2);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2294 lcd.setCursor(0,line);lcdprintPGM(" ");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2295 if(card.filenameIsDir) lcd.print("\005");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2296 lcd.print(card.filename);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2297 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2298 if((activeline==line) && CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2299 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2300 BLOCK
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2301 card.getfilename(i-FIRSTITEM);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2302 if(card.filenameIsDir)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2303 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2304 for(int8_t i=0;i<strlen(card.filename);i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2305 card.filename[i]=tolower(card.filename[i]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2306 card.chdir(card.filename);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2307 lineoffset=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2308 enforceupdate=true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2309 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2310 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2311 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2312 char cmd[30];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2313 for(int8_t i=0;i<strlen(card.filename);i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2314 card.filename[i]=tolower(card.filename[i]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2315 sprintf(cmd,"M23 %s",card.filename);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2316 //sprintf(cmd,"M115");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2317 enquecommand(cmd);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2318 enquecommand("M24");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2319 beep();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2320 status=Main_Status;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2321 lcd_status(card.filename);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2322 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2323 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2324 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2325
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2326 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2327 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2328 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2329 line++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2330 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2331 updateActiveLines(FIRSTITEM+nrfiles-1,encoderpos);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2332 if(enforceupdate)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2333 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2334 force_lcd_update=true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2335 enforceupdate=false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2336 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2337 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2338 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2339
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2340
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2341 enum {ItemM_watch, ItemM_prepare, ItemM_control, ItemM_file };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2342 void MainMenu::showMainMenu()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2343 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2344
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2345 #ifndef ULTIPANEL
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2346 force_lcd_update=false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2347 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2348 if(tune)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2349 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2350 if(!(movesplanned() || IS_SD_PRINTING))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2351 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2352 force_lcd_update=true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2353 tune=false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2354 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2355 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2356 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2357 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2358 if(movesplanned() || IS_SD_PRINTING)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2359 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2360 force_lcd_update=true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2361 tune=true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2362 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2363 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2364 clearIfNecessary();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2365 uint8_t line=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2366 for(int8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2367 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2368 switch(i)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2369 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2370 case ItemM_watch:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2371 MENUITEM( lcdprintPGM(MSG_WATCH) , BLOCK;status=Main_Status;beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2372 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2373 case ItemM_prepare:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2374 MENUITEM( if(!tune) lcdprintPGM(MSG_PREPARE);else lcdprintPGM(MSG_TUNE); , BLOCK;status=Main_Prepare;beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2375 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2376
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2377 case ItemM_control:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2378 MENUITEM( lcdprintPGM(MSG_CONTROL_ARROW) , BLOCK;status=Main_Control;beepshort(); ) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2379 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2380 #ifdef SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2381 case ItemM_file:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2382 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2383 if(force_lcd_update)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2384 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2385 lcd.setCursor(0,line);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2386 #ifdef CARDINSERTED
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2387 if(CARDINSERTED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2388 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2389 if(true)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2390 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2391 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2392 if(card.sdprinting)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2393 lcdprintPGM(MSG_STOP_PRINT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2394 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2395 lcdprintPGM(MSG_CARD_MENU);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2396 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2397 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2398 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2399 lcdprintPGM(MSG_NO_CARD);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2400 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2401 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2402 #ifdef CARDINSERTED
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2403 if(CARDINSERTED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2404 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2405 if((activeline==line)&&CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2406 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2407 card.printingHasFinished();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2408 BLOCK;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2409 status=Main_SD;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2410 beepshort();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2411 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2412 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2413 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2414 case ItemM_file:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2415 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2416 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2417 default:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2418 SERIAL_ERROR_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2419 SERIAL_ERRORLNPGM(MSG_SERIAL_ERROR_MENU_STRUCTURE);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2420 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2421 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2422 line++;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2423 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2424 updateActiveLines(3,encoderpos);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2425 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2426
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2427 void MainMenu::update()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2428 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2429 static MainStatus oldstatus=Main_Menu; //init automatically causes foce_lcd_update=true
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2430 static long timeoutToStatus=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2431 static bool oldcardstatus=false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2432 #ifdef CARDINSERTED
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2433 if((CARDINSERTED != oldcardstatus))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2434 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2435 force_lcd_update=true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2436 oldcardstatus=CARDINSERTED;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2437 lcd_init(); // to maybe revive the lcd if static electricty killed it.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2438 //Serial.println("echo: SD CHANGE");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2439 if(CARDINSERTED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2440 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2441 card.initsd();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2442 LCD_MESSAGEPGM(MSG_SD_INSERTED);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2443 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2444 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2445 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2446 card.release();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2447 LCD_MESSAGEPGM(MSG_SD_REMOVED);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2448 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2449 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2450 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2451
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2452 if(status!=oldstatus)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2453 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2454 force_lcd_update=true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2455 encoderpos=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2456 lineoffset=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2457
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2458 oldstatus=status;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2459 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2460 if( (encoderpos!=lastencoderpos) || CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2461 timeoutToStatus=millis()+STATUSTIMEOUT;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2462
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2463 switch(status)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2464 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2465 case Main_Status:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2466 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2467 showStatus();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2468 if(CLICKED)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2469 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2470 linechanging=false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2471 BLOCK
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2472 status=Main_Menu;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2473 timeoutToStatus=millis()+STATUSTIMEOUT;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2474 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2475 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2476 case Main_Menu:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2477 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2478 showMainMenu();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2479 linechanging=false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2480 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2481 case Main_Prepare:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2482 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2483 if(tune)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2484 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2485 showTune();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2486 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2487 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2488 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2489 showPrepare();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2490 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2491 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2492 case Sub_PrepareMove:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2493 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2494 showAxisMove();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2495 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2496 case Main_Control:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2497 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2498 showControl();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2499 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2500 case Sub_MotionControl:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2501 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2502 showControlMotion();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2503 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2504 case Sub_RetractControl:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2505 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2506 showControlRetract();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2507 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2508 case Sub_TempControl:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2509 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2510 showControlTemp();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2511 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2512 case Main_SD:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2513 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2514 showSD();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2515 }break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2516 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2517
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2518 if(timeoutToStatus<millis())
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2519 status=Main_Status;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2520 //force_lcd_update=false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2521 lastencoderpos=encoderpos;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2522 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2523
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2524
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2525
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2526
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2527
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2528
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2529 // convert float to string with +123.4 format
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2530 char *ftostr3(const float &x)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2531 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2532 //sprintf(conv,"%5.1f",x);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2533 int xx=x;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2534 conv[0]=(xx/100)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2535 conv[1]=(xx/10)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2536 conv[2]=(xx)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2537 conv[3]=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2538 return conv;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2539 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2540
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2541 char *itostr2(const uint8_t &x)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2542 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2543 //sprintf(conv,"%5.1f",x);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2544 int xx=x;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2545 conv[0]=(xx/10)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2546 conv[1]=(xx)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2547 conv[2]=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2548 return conv;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2549 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2550
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2551 // convert float to string with +123.4 format
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2552 char *ftostr31(const float &x)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2553 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2554 int xx=x*10;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2555 conv[0]=(xx>=0)?'+':'-';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2556 xx=abs(xx);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2557 conv[1]=(xx/1000)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2558 conv[2]=(xx/100)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2559 conv[3]=(xx/10)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2560 conv[4]='.';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2561 conv[5]=(xx)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2562 conv[6]=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2563 return conv;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2564 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2565
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2566 char *ftostr32(const float &x)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2567 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2568 int xx=x*100;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2569 conv[0]=(xx>=0)?'+':'-';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2570 xx=abs(xx);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2571 conv[1]=(xx/100)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2572 conv[2]='.';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2573 conv[3]=(xx/10)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2574 conv[4]=(xx)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2575 conv[6]=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2576 return conv;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2577 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2578
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2579 char *itostr31(const int &xx)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2580 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2581 conv[0]=(xx>=0)?'+':'-';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2582 conv[1]=(xx/1000)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2583 conv[2]=(xx/100)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2584 conv[3]=(xx/10)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2585 conv[4]='.';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2586 conv[5]=(xx)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2587 conv[6]=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2588 return conv;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2589 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2590
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2591 char *itostr3(const int &xx)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2592 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2593 conv[0]=(xx/100)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2594 conv[1]=(xx/10)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2595 conv[2]=(xx)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2596 conv[3]=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2597 return conv;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2598 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2599
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2600 char *itostr4(const int &xx)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2601 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2602 conv[0]=(xx/1000)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2603 conv[1]=(xx/100)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2604 conv[2]=(xx/10)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2605 conv[3]=(xx)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2606 conv[4]=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2607 return conv;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2608 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2609
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2610 // convert float to string with +1234.5 format
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2611 char *ftostr51(const float &x)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2612 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2613 int xx=x*10;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2614 conv[0]=(xx>=0)?'+':'-';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2615 xx=abs(xx);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2616 conv[1]=(xx/10000)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2617 conv[2]=(xx/1000)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2618 conv[3]=(xx/100)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2619 conv[4]=(xx/10)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2620 conv[5]='.';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2621 conv[6]=(xx)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2622 conv[7]=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2623 return conv;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2624 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2625
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2626 // convert float to string with +123.45 format
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2627 char *ftostr52(const float &x)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2628 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2629 int xx=x*100;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2630 conv[0]=(xx>=0)?'+':'-';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2631 xx=abs(xx);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2632 conv[1]=(xx/10000)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2633 conv[2]=(xx/1000)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2634 conv[3]=(xx/100)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2635 conv[4]='.';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2636 conv[5]=(xx/10)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2637 conv[6]=(xx)%10+'0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2638 conv[7]=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2639 return conv;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2640 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2641
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2642 #endif //ULTRA_LCD
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2643
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2644

mercurial