Browse Source

Merge branch 'tm2-utf-minus-kanji' into tm-utf-minus-kanji

Conflicts:
	Marlin/ultralcd_implementation_hitachi_HD44780.h

Cleaned!
AnHardt 9 years ago
parent
commit
08856d9615

+ 2
- 0
Marlin/Configuration.h View File

@@ -225,6 +225,8 @@ Here are some standard links for getting your machine calibrated:
225 225
 // so you shouldn't use it unless you are OK with PWM on your bed.  (see the comment on enabling PIDTEMPBED)
226 226
 #define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
227 227
 
228
+//#define PID_BED_DEBUG // Sends debug data to the serial port.
229
+
228 230
 #ifdef PIDTEMPBED
229 231
 //120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
230 232
 //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)

+ 2
- 2
Marlin/Marlin_main.cpp View File

@@ -2562,13 +2562,13 @@ inline void gcode_M17() {
2562 2562
    */
2563 2563
   inline void gcode_M28() {
2564 2564
     char* codepos = strchr_pointer + 4;
2565
-    char* starpos = strchr(strchr_pointer + 4, '*');
2565
+    char* starpos = strchr(codepos, '*');
2566 2566
     if (starpos) {
2567 2567
       char* npos = strchr(cmdbuffer[bufindr], 'N');
2568 2568
       strchr_pointer = strchr(npos, ' ') + 1;
2569 2569
       *(starpos) = '\0';
2570 2570
     }
2571
-    card.openFile(strchr_pointer + 4, false);
2571
+    card.openFile(codepos, false);
2572 2572
   }
2573 2573
 
2574 2574
   /**

+ 2
- 2
Marlin/SdBaseFile.h View File

@@ -171,9 +171,9 @@ static inline uint8_t FAT_SECOND(uint16_t fatTime) {
171 171
   return 2*(fatTime & 0X1F);
172 172
 }
173 173
 /** Default date for file timestamps is 1 Jan 2000 */
174
-uint16_t const FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | BIT(5) | 1;
174
+uint16_t const FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | (1 << 5) | 1;
175 175
 /** Default time for file timestamp is 1 am */
176
-uint16_t const FAT_DEFAULT_TIME = BIT(11);
176
+uint16_t const FAT_DEFAULT_TIME = (1 << 11);
177 177
 //------------------------------------------------------------------------------
178 178
 /**
179 179
  * \class SdBaseFile

+ 0
- 1
Marlin/cardreader.cpp View File

@@ -504,7 +504,6 @@ void CardReader::printingHasFinished() {
504 504
     startFileprint();
505 505
   }
506 506
   else {
507
-    quickStop();
508 507
     file.close();
509 508
     sdprinting = false;
510 509
     if (SD_FINISHED_STEPPERRELEASE) {

+ 2
- 0
Marlin/configurator/config/Configuration.h View File

@@ -234,6 +234,8 @@ Here are some standard links for getting your machine calibrated:
234 234
 // so you shouldn't use it unless you are OK with PWM on your bed.  (see the comment on enabling PIDTEMPBED)
235 235
 #define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
236 236
 
237
+//#define PID_BED_DEBUG // Sends debug data to the serial port.
238
+
237 239
 #ifdef PIDTEMPBED
238 240
 //120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
239 241
 //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)

+ 72
- 113
Marlin/dogm_lcd_implementation.h View File

@@ -74,12 +74,9 @@
74 74
   #endif
75 75
 #endif // SIMULATE_ROMFONT
76 76
 
77
-#define FONT_STATUSMENU_NAME FONT_MENU_NAME
78
-
79
-#define FONT_STATUSMENU 1
77
+#define FONT_MENU 1
80 78
 #define FONT_SPECIAL 2
81 79
 #define FONT_MENU_EDIT 3
82
-#define FONT_MENU 4
83 80
 
84 81
 // DOGM parameters (size in pixels)
85 82
 #define DOG_CHAR_WIDTH         6
@@ -137,7 +134,6 @@ char currentfont = 0;
137 134
 
138 135
 static void lcd_setFont(char font_nr) {
139 136
   switch(font_nr) {
140
-    case FONT_STATUSMENU : {u8g.setFont(FONT_STATUSMENU_NAME); currentfont = FONT_STATUSMENU;}; break;
141 137
     case FONT_MENU       : {u8g.setFont(FONT_MENU_NAME); currentfont = FONT_MENU;}; break;
142 138
     case FONT_SPECIAL    : {u8g.setFont(FONT_SPECIAL_NAME); currentfont = FONT_SPECIAL;}; break;
143 139
     case FONT_MENU_EDIT  : {u8g.setFont(FONT_MENU_EDIT_NAME); currentfont = FONT_MENU_EDIT;}; break;
@@ -218,7 +214,7 @@ static void lcd_implementation_init()
218 214
       u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT*3/2, STRING_SPLASH_LINE1);
219 215
       u8g.drawStr(txt2X, u8g.getHeight() - DOG_CHAR_HEIGHT*1/2, STRING_SPLASH_LINE2);
220 216
     #endif
221
-	} while(u8g.nextPage());
217
+	} while (u8g.nextPage());
222 218
 }
223 219
 
224 220
 static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
@@ -227,7 +223,7 @@ static void _draw_heater_status(int x, int heater) {
227 223
   bool isBed = heater < 0;
228 224
   int y = 17 + (isBed ? 1 : 0);
229 225
 
230
-  lcd_setFont(FONT_STATUSMENU);
226
+  lcd_setFont(FONT_MENU);
231 227
   u8g.setPrintPos(x,7);
232 228
   lcd_print(itostr3(int((heater >= 0 ? degTargetHotend(heater) : degTargetBed()) + 0.5)));
233 229
   lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
@@ -252,7 +248,8 @@ static void lcd_implementation_status_screen() {
252 248
 
253 249
   // Symbols menu graphics, animated fan
254 250
   u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT, (blink % 2) && fanSpeed ? status_screen0_bmp : status_screen1_bmp);
255
- 
251
+  lcd_setFont(FONT_MENU);
252
+
256 253
   #ifdef SDSUPPORT
257 254
     // SD Card Symbol
258 255
     u8g.drawBox(42,42,8,7);
@@ -264,14 +261,12 @@ static void lcd_implementation_status_screen() {
264 261
     u8g.drawFrame(54,49,73,4);
265 262
 
266 263
     // SD Card Progress bar and clock
267
-    lcd_setFont(FONT_STATUSMENU);
268
- 
269 264
     if (IS_SD_PRINTING) {
270 265
       // Progress bar solid part
271 266
       u8g.drawBox(55, 50, (unsigned int)(71.f * card.percentDone() / 100.f), 2);
272 267
     }
273 268
 
274
-    u8g.setPrintPos(80,47);
269
+    u8g.setPrintPos(80,48);
275 270
     if (starttime != 0) {
276 271
       uint16_t time = (millis() - starttime) / 60000;
277 272
       lcd_print(itostr2(time/60));
@@ -290,11 +285,11 @@ static void lcd_implementation_status_screen() {
290 285
   if (EXTRUDERS < 4) _draw_heater_status(81, -1);
291 286
  
292 287
   // Fan
293
-  lcd_setFont(FONT_STATUSMENU);
294 288
   u8g.setPrintPos(104,27);
295 289
   #if defined(FAN_PIN) && FAN_PIN > -1
296 290
     int per = ((fanSpeed + 1) * 100) / 256;
297 291
     if (per) {
292
+
298 293
       lcd_print(itostr3(per));
299 294
       lcd_print('%');
300 295
     }
@@ -305,50 +300,38 @@ static void lcd_implementation_status_screen() {
305 300
     }
306 301
 
307 302
   // X, Y, Z-Coordinates
308
-  lcd_setFont(FONT_STATUSMENU);
309
-  u8g.drawBox(0,29,128,10);
303
+  #define XYZ_BASELINE 38
304
+  u8g.drawBox(0,30,128,9);
310 305
   u8g.setColorIndex(0); // white on black
311
-  u8g.setPrintPos(2,37);
306
+  u8g.setPrintPos(2,XYZ_BASELINE);
312 307
   lcd_print('X');
313
-  u8g.drawPixel(8,33);
314
-  u8g.drawPixel(8,35);
315
-  u8g.setPrintPos(10,37);
308
+  u8g.drawPixel(8,XYZ_BASELINE - 5);
309
+  u8g.drawPixel(8,XYZ_BASELINE - 3);
310
+  u8g.setPrintPos(10,XYZ_BASELINE);
316 311
   lcd_print(ftostr31ns(current_position[X_AXIS]));
317
-  u8g.setPrintPos(43,37);
312
+  u8g.setPrintPos(43,XYZ_BASELINE);
318 313
   lcd_print('Y');
319
-  u8g.drawPixel(49,33);
320
-  u8g.drawPixel(49,35);
321
-  u8g.setPrintPos(51,37);
314
+  u8g.drawPixel(49,XYZ_BASELINE - 5);
315
+  u8g.drawPixel(49,XYZ_BASELINE - 3);
316
+  u8g.setPrintPos(51,XYZ_BASELINE);
322 317
   lcd_print(ftostr31ns(current_position[Y_AXIS]));
323
-  u8g.setPrintPos(83,37);
318
+  u8g.setPrintPos(83,XYZ_BASELINE);
324 319
   lcd_print('Z');
325
-  u8g.drawPixel(89,33);
326
-  u8g.drawPixel(89,35);
327
-  u8g.setPrintPos(91,37);
320
+  u8g.drawPixel(89,XYZ_BASELINE - 5);
321
+  u8g.drawPixel(89,XYZ_BASELINE - 3);
322
+  u8g.setPrintPos(91,XYZ_BASELINE);
328 323
   lcd_print(ftostr31(current_position[Z_AXIS]));
329 324
   u8g.setColorIndex(1); // black on white
330 325
  
331 326
   // Feedrate
332
-  lcd_setFont(FONT_MENU);
333 327
   u8g.setPrintPos(3,49);
334 328
   lcd_print(LCD_STR_FEEDRATE[0]);
335
-  lcd_setFont(FONT_STATUSMENU);
336
-  u8g.setPrintPos(12,48);
329
+  u8g.setPrintPos(12,49);
337 330
   lcd_print(itostr3(feedmultiply));
338 331
   lcd_print('%');
339 332
 
340 333
   // Status line
341
-/* The new fonts are small enough
342
-  #ifndef MAPPER_C2C3
343
-    lcd_setFont(FONT_MENU);
344
-  #else
345
-    lcd_setFont(FONT_STATUSMENU);
346
-  #endif
347
-*/
348
-  lcd_setFont(FONT_MENU);
349
-
350
-  u8g.setPrintPos(0,61);
351
-
334
+  u8g.setPrintPos(0,63);
352 335
   #ifndef FILAMENT_LCD_DISPLAY
353 336
     lcd_print(lcd_status_message);
354 337
   #else
@@ -365,10 +348,10 @@ static void lcd_implementation_status_screen() {
365 348
   #endif
366 349
 }
367 350
 
368
-static void lcd_implementation_mark_as_selected(uint8_t row, char pr_char) {
369
-  if ((pr_char == '>') || (pr_char == LCD_STR_UPLEVEL[0] )) {
351
+static void lcd_implementation_mark_as_selected(uint8_t row, bool isSelected) {
352
+  if (isSelected) {
370 353
     u8g.setColorIndex(1);  // black on white
371
-    u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT);
354
+    u8g.drawBox(0, row * DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT);
372 355
     u8g.setColorIndex(0);  // following text must be white on black
373 356
   }
374 357
   else {
@@ -377,96 +360,78 @@ static void lcd_implementation_mark_as_selected(uint8_t row, char pr_char) {
377 360
   u8g.setPrintPos(START_ROW * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
378 361
 }
379 362
 
380
-static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char) {
363
+static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, const char* pstr, char pre_char, char post_char) {
381 364
   char c;
382 365
   uint8_t n = LCD_WIDTH - 2;
383 366
 
384
-  lcd_implementation_mark_as_selected(row, pre_char);
367
+  lcd_implementation_mark_as_selected(row, isSelected);
385 368
 
386
-  while((c = pgm_read_byte(pstr))) {
369
+  while (c = pgm_read_byte(pstr)) {
387 370
     n -= lcd_print(c);
388 371
     pstr++;
389 372
   }
390
-  while(n--) lcd_print(' ');
373
+  while (n--) lcd_print(' ');
391 374
   lcd_print(post_char);
392 375
   lcd_print(' ');
393 376
 }
394 377
 
395
-static void _drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, const char* data, bool pgm) {
378
+static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const char* pstr, const char* data, bool pgm) {
396 379
   char c;
397 380
   uint8_t n = LCD_WIDTH - 2 - (pgm ? lcd_strlen_P(data) : (lcd_strlen((char*)data)));
398 381
 
399
-  lcd_implementation_mark_as_selected(row, pre_char);
382
+  lcd_implementation_mark_as_selected(row, isSelected);
400 383
 
401
-  while( (c = pgm_read_byte(pstr))) {
384
+  while (c = pgm_read_byte(pstr)) {
402 385
     n -= lcd_print(c);
403 386
     pstr++;
404 387
   }
405 388
   lcd_print(':');
406
-  while(n--) lcd_print(' ');
389
+  while (n--) lcd_print(' ');
407 390
   if (pgm) { lcd_printPGM(data); } else { lcd_print((char *)data); }
408 391
 }
409 392
 
410
-#define lcd_implementation_drawmenu_setting_edit_generic(row, pstr, pre_char, data) _drawmenu_setting_edit_generic(row, pstr, pre_char, data, false)
411
-#define lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, pre_char, data) _drawmenu_setting_edit_generic(row, pstr, pre_char, data, true)
412
-
413
-#define lcd_implementation_drawmenu_setting_edit_int3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data)))
414
-#define lcd_implementation_drawmenu_setting_edit_int3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data)))
415
-#define lcd_implementation_drawmenu_setting_edit_float3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data)))
416
-#define lcd_implementation_drawmenu_setting_edit_float3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data)))
417
-#define lcd_implementation_drawmenu_setting_edit_float32_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data)))
418
-#define lcd_implementation_drawmenu_setting_edit_float32(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
419
-#define lcd_implementation_drawmenu_setting_edit_float43_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr43(*(data)))
420
-#define lcd_implementation_drawmenu_setting_edit_float43(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr43(*(data)))
421
-#define lcd_implementation_drawmenu_setting_edit_float5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
422
-#define lcd_implementation_drawmenu_setting_edit_float5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
423
-#define lcd_implementation_drawmenu_setting_edit_float52_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data)))
424
-#define lcd_implementation_drawmenu_setting_edit_float52(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data)))
425
-#define lcd_implementation_drawmenu_setting_edit_float51_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data)))
426
-#define lcd_implementation_drawmenu_setting_edit_float51(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data)))
427
-#define lcd_implementation_drawmenu_setting_edit_long5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
428
-#define lcd_implementation_drawmenu_setting_edit_long5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
429
-#define lcd_implementation_drawmenu_setting_edit_bool_selected(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
430
-#define lcd_implementation_drawmenu_setting_edit_bool(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
393
+#define lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, data) _drawmenu_setting_edit_generic(sel, row, pstr, data, false)
394
+#define lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, data) _drawmenu_setting_edit_generic(sel, row, pstr, data, true)
395
+
396
+#define lcd_implementation_drawmenu_setting_edit_int3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, itostr3(*(data)))
397
+#define lcd_implementation_drawmenu_setting_edit_float3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr3(*(data)))
398
+#define lcd_implementation_drawmenu_setting_edit_float32(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr32(*(data)))
399
+#define lcd_implementation_drawmenu_setting_edit_float43(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr43(*(data)))
400
+#define lcd_implementation_drawmenu_setting_edit_float5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5(*(data)))
401
+#define lcd_implementation_drawmenu_setting_edit_float52(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr52(*(data)))
402
+#define lcd_implementation_drawmenu_setting_edit_float51(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr51(*(data)))
403
+#define lcd_implementation_drawmenu_setting_edit_long5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5(*(data)))
404
+#define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
431 405
 
432 406
 //Add version for callback functions
433
-#define lcd_implementation_drawmenu_setting_edit_callback_int3_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data)))
434
-#define lcd_implementation_drawmenu_setting_edit_callback_int3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data)))
435
-#define lcd_implementation_drawmenu_setting_edit_callback_float3_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data)))
436
-#define lcd_implementation_drawmenu_setting_edit_callback_float3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data)))
437
-#define lcd_implementation_drawmenu_setting_edit_callback_float32_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data)))
438
-#define lcd_implementation_drawmenu_setting_edit_callback_float32(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
439
-#define lcd_implementation_drawmenu_setting_edit_callback_float43_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr43(*(data)))
440
-#define lcd_implementation_drawmenu_setting_edit_callback_float43(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr43(*(data)))
441
-#define lcd_implementation_drawmenu_setting_edit_callback_float5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
442
-#define lcd_implementation_drawmenu_setting_edit_callback_float5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
443
-#define lcd_implementation_drawmenu_setting_edit_callback_float52_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data)))
444
-#define lcd_implementation_drawmenu_setting_edit_callback_float52(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data)))
445
-#define lcd_implementation_drawmenu_setting_edit_callback_float51_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data)))
446
-#define lcd_implementation_drawmenu_setting_edit_callback_float51(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data)))
447
-#define lcd_implementation_drawmenu_setting_edit_callback_long5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
448
-#define lcd_implementation_drawmenu_setting_edit_callback_long5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
449
-#define lcd_implementation_drawmenu_setting_edit_callback_bool_selected(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
450
-#define lcd_implementation_drawmenu_setting_edit_callback_bool(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
407
+#define lcd_implementation_drawmenu_setting_edit_callback_int3(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, itostr3(*(data)))
408
+#define lcd_implementation_drawmenu_setting_edit_callback_float3(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr3(*(data)))
409
+#define lcd_implementation_drawmenu_setting_edit_callback_float32(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr32(*(data)))
410
+#define lcd_implementation_drawmenu_setting_edit_callback_float43(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr43(*(data)))
411
+#define lcd_implementation_drawmenu_setting_edit_callback_float5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5(*(data)))
412
+#define lcd_implementation_drawmenu_setting_edit_callback_float52(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr52(*(data)))
413
+#define lcd_implementation_drawmenu_setting_edit_callback_float51(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr51(*(data)))
414
+#define lcd_implementation_drawmenu_setting_edit_callback_long5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5(*(data)))
415
+#define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
451 416
 
452 417
 void lcd_implementation_drawedit(const char* pstr, char* value) {
453 418
   uint8_t rows = 1;
454
-  uint8_t lcd_width = LCD_WIDTH;
455
-  uint8_t char_width = DOG_CHAR_WIDTH;
419
+  uint8_t lcd_width = LCD_WIDTH, char_width = DOG_CHAR_WIDTH;
420
+  uint8_t vallen = lcd_strlen(value);
456 421
 
457 422
   #ifdef USE_BIG_EDIT_FONT
458 423
     if (lcd_strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) {
459 424
       lcd_setFont(FONT_MENU_EDIT);
460 425
       lcd_width = LCD_WIDTH_EDIT + 1;
461 426
       char_width = DOG_CHAR_WIDTH_EDIT;
462
-      if (lcd_strlen_P(pstr) >= LCD_WIDTH_EDIT - lcd_strlen(value)) rows = 2;
427
+      if (lcd_strlen_P(pstr) >= LCD_WIDTH_EDIT - vallen) rows = 2;
463 428
     }
464 429
     else {
465 430
       lcd_setFont(FONT_MENU);
466 431
     }
467 432
   #endif
468 433
 
469
-  if (lcd_strlen_P(pstr) > LCD_WIDTH - 2 - lcd_strlen(value)) rows = 2;
434
+  if (lcd_strlen_P(pstr) > LCD_WIDTH - 2 - vallen) rows = 2;
470 435
 
471 436
   const float kHalfChar = DOG_CHAR_HEIGHT_EDIT / 2;
472 437
   float rowHeight = u8g.getHeight() / (rows + 1); // 1/(rows+1) = 1/2 or 1/3
@@ -474,42 +439,36 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
474 439
   u8g.setPrintPos(0, rowHeight + kHalfChar);
475 440
   lcd_printPGM(pstr);
476 441
   lcd_print(':');
477
-  u8g.setPrintPos((lcd_width-1-lcd_strlen(value)) * char_width, rows * rowHeight + kHalfChar);
442
+  u8g.setPrintPos((lcd_width - 1 - vallen) * char_width, rows * rowHeight + kHalfChar);
478 443
   lcd_print(value);
479 444
 }
480 445
 
481
-static void _drawmenu_sd(uint8_t row, const char* pstr, const char* filename, char * const longFilename, bool isDir, bool isSelected) {
446
+static void _drawmenu_sd(bool isSelected, uint8_t row, const char* pstr, const char* filename, char * const longFilename, bool isDir) {
482 447
   char c;
483 448
   uint8_t n = LCD_WIDTH - 1;
484 449
 
485
-  if (longFilename[0] != '\0') {
450
+  if (longFilename[0]) {
486 451
     filename = longFilename;
487 452
     longFilename[n] = '\0';
488 453
   }
489 454
 
490
-  lcd_implementation_mark_as_selected(row, ((isSelected) ? '>' : ' '));
455
+  lcd_implementation_mark_as_selected(row, isSelected);
491 456
 
492 457
   if (isDir) lcd_print(LCD_STR_FOLDER[0]);
493
-  while((c = *filename) != '\0') {
458
+  while (c = *filename) {
494 459
     n -= lcd_print(c);
495 460
     filename++;
496 461
   }
497
-  while(n--) lcd_print(' ');
462
+  while (n--) lcd_print(' ');
498 463
 }
499 464
 
500
-#define lcd_implementation_drawmenu_sdfile_selected(row, pstr, filename, longFilename) _drawmenu_sd(row, pstr, filename, longFilename, false, true)
501
-#define lcd_implementation_drawmenu_sdfile(row, pstr, filename, longFilename) _drawmenu_sd(row, pstr, filename, longFilename, false, false)
502
-#define lcd_implementation_drawmenu_sddirectory_selected(row, pstr, filename, longFilename) _drawmenu_sd(row, pstr, filename, longFilename, true, true)
503
-#define lcd_implementation_drawmenu_sddirectory(row, pstr, filename, longFilename) _drawmenu_sd(row, pstr, filename, longFilename, true, false)
504
-
505
-#define lcd_implementation_drawmenu_back_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
506
-#define lcd_implementation_drawmenu_back(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_UPLEVEL[0])
507
-#define lcd_implementation_drawmenu_submenu_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
508
-#define lcd_implementation_drawmenu_submenu(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_ARROW_RIGHT[0])
509
-#define lcd_implementation_drawmenu_gcode_selected(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
510
-#define lcd_implementation_drawmenu_gcode(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
511
-#define lcd_implementation_drawmenu_function_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
512
-#define lcd_implementation_drawmenu_function(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
465
+#define lcd_implementation_drawmenu_sdfile(sel, row, pstr, filename, longFilename) _drawmenu_sd(sel, row, pstr, filename, longFilename, false)
466
+#define lcd_implementation_drawmenu_sddirectory(sel, row, pstr, filename, longFilename) _drawmenu_sd(sel, row, pstr, filename, longFilename, true)
467
+
468
+#define lcd_implementation_drawmenu_back(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
469
+#define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
470
+#define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
471
+#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
513 472
 
514 473
 static void lcd_implementation_quick_feedback() {
515 474
   #if BEEPER > -1

+ 2
- 0
Marlin/example_configurations/Felix/Configuration.h View File

@@ -215,6 +215,8 @@ Here are some standard links for getting your machine calibrated:
215 215
 // so you shouldn't use it unless you are OK with PWM on your bed.  (see the comment on enabling PIDTEMPBED)
216 216
 #define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
217 217
 
218
+//#define PID_BED_DEBUG // Sends debug data to the serial port.
219
+
218 220
 #ifdef PIDTEMPBED
219 221
 // Felix Foil Heater
220 222
    #define DEFAULT_bedKp 103.37

+ 2
- 0
Marlin/example_configurations/Felix/Configuration_DUAL.h View File

@@ -215,6 +215,8 @@ Here are some standard links for getting your machine calibrated:
215 215
 // so you shouldn't use it unless you are OK with PWM on your bed.  (see the comment on enabling PIDTEMPBED)
216 216
 #define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
217 217
 
218
+//#define PID_BED_DEBUG // Sends debug data to the serial port.
219
+
218 220
 #ifdef PIDTEMPBED
219 221
 // Felix Foil Heater
220 222
    #define DEFAULT_bedKp 103.37

+ 2
- 0
Marlin/example_configurations/Hephestos/Configuration.h View File

@@ -231,6 +231,8 @@ Here are some standard links for getting your machine calibrated:
231 231
 // so you shouldn't use it unless you are OK with PWM on your bed.  (see the comment on enabling PIDTEMPBED)
232 232
 #define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
233 233
 
234
+//#define PID_BED_DEBUG // Sends debug data to the serial port.
235
+
234 236
 #ifdef PIDTEMPBED
235 237
 //120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
236 238
 //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)

+ 2
- 0
Marlin/example_configurations/K8200/Configuration.h View File

@@ -230,6 +230,8 @@ Here are some standard links for getting your machine calibrated:
230 230
 // so you shouldn't use it unless you are OK with PWM on your bed.  (see the comment on enabling PIDTEMPBED)
231 231
 #define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
232 232
 
233
+//#define PID_BED_DEBUG // Sends debug data to the serial port.
234
+
233 235
 #ifdef PIDTEMPBED
234 236
 //120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
235 237
 //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)

+ 2
- 0
Marlin/example_configurations/SCARA/Configuration.h View File

@@ -254,6 +254,8 @@ Here are some standard links for getting your machine calibrated:
254 254
 // so you shouldn't use it unless you are OK with PWM on your bed.  (see the comment on enabling PIDTEMPBED)
255 255
 #define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
256 256
 
257
+//#define PID_BED_DEBUG // Sends debug data to the serial port.
258
+
257 259
 #ifdef PIDTEMPBED
258 260
 //120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
259 261
 //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)

+ 2
- 0
Marlin/example_configurations/WITBOX/Configuration.h View File

@@ -230,6 +230,8 @@ Here are some standard links for getting your machine calibrated:
230 230
 // so you shouldn't use it unless you are OK with PWM on your bed.  (see the comment on enabling PIDTEMPBED)
231 231
 #define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
232 232
 
233
+//#define PID_BED_DEBUG // Sends debug data to the serial port.
234
+
233 235
 #ifdef PIDTEMPBED
234 236
 //120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
235 237
 //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)

+ 2
- 0
Marlin/example_configurations/delta/generic/Configuration.h View File

@@ -258,6 +258,8 @@ Here are some standard links for getting your machine calibrated:
258 258
 // so you shouldn't use it unless you are OK with PWM on your bed.  (see the comment on enabling PIDTEMPBED)
259 259
 #define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
260 260
 
261
+//#define PID_BED_DEBUG // Sends debug data to the serial port.
262
+
261 263
 #ifdef PIDTEMPBED
262 264
 //120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
263 265
 //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)

+ 2
- 0
Marlin/example_configurations/delta/kossel_mini/Configuration.h View File

@@ -259,6 +259,8 @@ Here are some standard links for getting your machine calibrated:
259 259
 // so you shouldn't use it unless you are OK with PWM on your bed.  (see the comment on enabling PIDTEMPBED)
260 260
 #define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
261 261
 
262
+//#define PID_BED_DEBUG // Sends debug data to the serial port.
263
+
262 264
 #ifdef PIDTEMPBED
263 265
 //120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
264 266
 //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)

+ 2
- 0
Marlin/example_configurations/makibox/Configuration.h View File

@@ -228,6 +228,8 @@ Here are some standard links for getting your machine calibrated:
228 228
 // to increase the heat up rate. However, if changed, user must be aware of the safety concerns
229 229
 // of drawing too much current from the power supply.
230 230
 
231
+//#define PID_BED_DEBUG // Sends debug data to the serial port.
232
+
231 233
 #ifdef PIDTEMPBED
232 234
 //120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
233 235
 //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)

+ 2
- 0
Marlin/example_configurations/tvrrug/Round2/Configuration.h View File

@@ -230,6 +230,8 @@ Here are some standard links for getting your machine calibrated:
230 230
 // so you shouldn't use it unless you are OK with PWM on your bed.  (see the comment on enabling PIDTEMPBED)
231 231
 #define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
232 232
 
233
+//#define PID_BED_DEBUG // Sends debug data to the serial port.
234
+
233 235
 #ifdef PIDTEMPBED
234 236
 //120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
235 237
 //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)

+ 13
- 0
Marlin/stepper.cpp View File

@@ -46,6 +46,7 @@ block_t *current_block;  // A pointer to the block currently being traced
46 46
 
47 47
 // Variables used by The Stepper Driver Interrupt
48 48
 static unsigned char out_bits;        // The next stepping-bits to be output
49
+static unsigned int cleaning_buffer_counter;  
49 50
 
50 51
 // Counter variables for the bresenham line tracer
51 52
 static long counter_x, counter_y, counter_z, counter_e;
@@ -346,6 +347,17 @@ FORCE_INLINE void trapezoid_generator_reset() {
346 347
 // "The Stepper Driver Interrupt" - This timer interrupt is the workhorse.
347 348
 // It pops blocks from the block_buffer and executes them by pulsing the stepper pins appropriately.
348 349
 ISR(TIMER1_COMPA_vect) {
350
+
351
+  if(cleaning_buffer_counter)
352
+  {
353
+    current_block = NULL;
354
+    plan_discard_current_block();
355
+    if ((cleaning_buffer_counter == 1) && (SD_FINISHED_STEPPERRELEASE)) enquecommands_P(PSTR(SD_FINISHED_RELEASECOMMAND));
356
+    cleaning_buffer_counter--;
357
+    OCR1A = 200;
358
+    return;
359
+  }
360
+  
349 361
   // If there is no current block, attempt to pop one from the buffer
350 362
   if (!current_block) {
351 363
     // Anything in the buffer?
@@ -972,6 +984,7 @@ void finishAndDisableSteppers() {
972 984
 }
973 985
 
974 986
 void quickStop() {
987
+  cleaning_buffer_counter = 5000;
975 988
   DISABLE_STEPPER_DRIVER_INTERRUPT();
976 989
   while (blocks_queued()) plan_discard_current_block();
977 990
   current_block = NULL;

+ 15
- 0
Marlin/temperature.cpp View File

@@ -636,6 +636,21 @@ float get_pid_output(int e) {
636 636
       pid_output = constrain(target_temperature_bed, 0, MAX_BED_POWER);
637 637
     #endif // PID_OPENLOOP
638 638
 
639
+    #ifdef PID_BED_DEBUG
640
+      SERIAL_ECHO_START;
641
+      SERIAL_ECHO(" PID_BED_DEBUG ");
642
+      SERIAL_ECHO(": Input ");
643
+      SERIAL_ECHO(current_temperature_bed);
644
+      SERIAL_ECHO(" Output ");
645
+      SERIAL_ECHO(pid_output);
646
+      SERIAL_ECHO(" pTerm ");
647
+      SERIAL_ECHO(pTerm_bed);
648
+      SERIAL_ECHO(" iTerm ");
649
+      SERIAL_ECHO(iTerm_bed);
650
+      SERIAL_ECHO(" dTerm ");
651
+      SERIAL_ECHOLN(dTerm_bed);
652
+    #endif //PID_BED_DEBUG
653
+
639 654
     return pid_output;
640 655
   }
641 656
 #endif

+ 65
- 50
Marlin/ultralcd.cpp View File

@@ -118,64 +118,84 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
118 118
 
119 119
 
120 120
 /* Helper macros for menus */
121
+
122
+/**
123
+ * START_MENU generates the init code for a menu function
124
+ */
121 125
 #define START_MENU() do { \
122
-	encoderRateMultiplierEnabled = false; \
123
-    if (encoderPosition > 0x8000) encoderPosition = 0; \
124
-    if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM < currentMenuViewOffset) currentMenuViewOffset = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM;\
125
-    uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
126
-    bool wasClicked = LCD_CLICKED;\
127
-    for(uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \
128
-        _menuItemNr = 0;
126
+  encoderRateMultiplierEnabled = false; \
127
+  if (encoderPosition > 0x8000) encoderPosition = 0; \
128
+  uint8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \
129
+  if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \
130
+  uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
131
+  bool wasClicked = LCD_CLICKED, itemSelected; \
132
+  if (wasClicked) lcd_quick_feedback(); \
133
+  for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \
134
+    _menuItemNr = 0;
135
+
136
+/**
137
+ * MENU_ITEM generates draw & handler code for a menu item, potentially calling:
138
+ *
139
+ *   lcd_implementation_drawmenu_[type](sel, row, label, arg3...)
140
+ *   menu_action_[type](arg3...)
141
+ *
142
+ * Examples:
143
+ *   MENU_ITEM(back, MSG_WATCH, lcd_status_screen)
144
+ *     lcd_implementation_drawmenu_back(sel, row, PSTR(MSG_WATCH), lcd_status_screen)
145
+ *     menu_action_back(lcd_status_screen)
146
+ *
147
+ *   MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause)
148
+ *     lcd_implementation_drawmenu_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause)
149
+ *     menu_action_function(lcd_sdcard_pause)
150
+ *
151
+ *   MENU_ITEM_EDIT(int3, MSG_SPEED, &feedmultiply, 10, 999)
152
+ *   MENU_ITEM(setting_edit_int3, MSG_SPEED, PSTR(MSG_SPEED), &feedmultiply, 10, 999)
153
+ *     lcd_implementation_drawmenu_setting_edit_int3(sel, row, PSTR(MSG_SPEED), PSTR(MSG_SPEED), &feedmultiply, 10, 999)
154
+ *     menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedmultiply, 10, 999)
155
+ *
156
+ */
129 157
 #define MENU_ITEM(type, label, args...) do { \
130
-    if (_menuItemNr == _lineNr) { \
131
-        if (lcdDrawUpdate) { \
132
-            const char* _label_pstr = PSTR(label); \
133
-            if ((encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) { \
134
-                lcd_implementation_drawmenu_ ## type ## _selected (_drawLineNr, _label_pstr , ## args ); \
135
-            }else{\
136
-                lcd_implementation_drawmenu_ ## type (_drawLineNr, _label_pstr , ## args ); \
137
-            }\
138
-        }\
139
-        if (wasClicked && (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) {\
140
-            lcd_quick_feedback(); \
141
-            menu_action_ ## type ( args ); \
142
-            return;\
143
-        }\
144
-    }\
145
-    _menuItemNr++;\
158
+  if (_menuItemNr == _lineNr) { \
159
+    itemSelected = encoderLine == _menuItemNr; \
160
+    if (lcdDrawUpdate) \
161
+      lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \
162
+    if (wasClicked && itemSelected) { \
163
+      menu_action_ ## type(args); \
164
+      return; \
165
+    } \
166
+  } \
167
+  _menuItemNr++; \
146 168
 } while(0)
169
+
147 170
 #ifdef ENCODER_RATE_MULTIPLIER
171
+  /**
172
+   * MENU_MULTIPLIER_ITEM generates drawing and handling code for a multiplier menu item
173
+   */
148 174
   #define MENU_MULTIPLIER_ITEM(type, label, args...) do { \
149 175
     if (_menuItemNr == _lineNr) { \
150
-      if (lcdDrawUpdate) { \
151
-        const char* _label_pstr = PSTR(label); \
152
-        if ((encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) { \
153
-          lcd_implementation_drawmenu_ ## type ## _selected (_drawLineNr, _label_pstr , ## args ); \
154
-        } \
155
-        else { \
156
-          lcd_implementation_drawmenu_ ## type (_drawLineNr, _label_pstr , ## args ); \
157
-        } \
158
-      } \
159
-      if (wasClicked && (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) { \
160
-        lcd_quick_feedback(); \
176
+      itemSelected = encoderLine == _menuItemNr; \
177
+      if (lcdDrawUpdate) \
178
+        lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \
179
+      if (wasClicked && itemSelected) { \
161 180
         encoderRateMultiplierEnabled = true; \
162 181
         lastEncoderMovementMillis = 0; \
163
-        menu_action_ ## type ( args ); \
182
+        menu_action_ ## type(args); \
164 183
         return; \
165 184
       } \
166 185
     } \
167 186
     _menuItemNr++; \
168 187
   } while(0)
169 188
 #endif //ENCODER_RATE_MULTIPLIER
189
+
170 190
 #define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0)
171
-#define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
172
-#define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
191
+#define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
192
+#define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
173 193
 #ifdef ENCODER_RATE_MULTIPLIER
174
-  #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
175
-  #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
194
+  #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
195
+  #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
176 196
 #else //!ENCODER_RATE_MULTIPLIER
177
-  #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
178
-  #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
197
+  #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
198
+  #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
179 199
 #endif //!ENCODER_RATE_MULTIPLIER
180 200
 #define END_MENU() \
181 201
     if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM >= _menuItemNr) encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; \
@@ -349,16 +369,11 @@ static void lcd_sdcard_pause() { card.pauseSDPrint(); }
349 369
 static void lcd_sdcard_resume() { card.startFileprint(); }
350 370
 
351 371
 static void lcd_sdcard_stop() {
372
+  quickStop();
352 373
   card.sdprinting = false;
353 374
   card.closefile();
354
-  quickStop();
355
-  if (SD_FINISHED_STEPPERRELEASE) {
356
-    enquecommands_P(PSTR(SD_FINISHED_RELEASECOMMAND));
357
-  }
358 375
   autotempShutdown();
359
-
360 376
   cancel_heatup = true;
361
-
362 377
   lcd_setstatus(MSG_PRINT_ABORTED);
363 378
 }
364 379
 
@@ -463,9 +478,9 @@ static void lcd_tune_menu() {
463 478
   #if TEMP_SENSOR_BED != 0
464 479
     MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
465 480
   #endif
466
-    MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
467
-    MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999);
468
-    MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F0, &extruder_multiply[0], 10, 999);
481
+  MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
482
+  MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999);
483
+  MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F0, &extruder_multiply[0], 10, 999);
469 484
   #if TEMP_SENSOR_1 != 0
470 485
     MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F1, &extruder_multiply[1], 10, 999);
471 486
   #endif

+ 83
- 180
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

@@ -413,9 +413,8 @@ char lcd_printPGM(const char* str) {
413 413
 }
414 414
 
415 415
 char lcd_print(char* str) {
416
-  char c;
416
+  char c, n = 0;;
417 417
   unsigned char i = 0;
418
-  char n = 0;
419 418
   while((c = str[i++])) {
420 419
       n += charset_mapper(c);
421 420
   }
@@ -623,200 +622,104 @@ static void lcd_implementation_status_screen()
623 622
   lcd_print(lcd_status_message);
624 623
 }
625 624
 
626
-static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char)
627
-{
628
-    char c;
629
-    //Use all characters in narrow LCDs
630
-  #if LCD_WIDTH < 20
631
-      uint8_t n = LCD_WIDTH - 1 - 1;
632
-    #else
633
-      uint8_t n = LCD_WIDTH - 1 - 2;
634
-  #endif
635
-    lcd.setCursor(0, row);
636
-    lcd.print(pre_char);
637
-    while( ((c = pgm_read_byte(pstr)) != '\0') && (n>0) )
638
-    {
639
-        n -= lcd_print(c);
640
-        pstr++;
641
-    }
642
-    while(n--) {
643
-      lcd.print(' ');
644
-    }
645
-    lcd.print(post_char);
646
-    lcd.print(' ');
647
-}
648
-static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, char* data)
649
-{
650
-    char c;
651
-    //Use all characters in narrow LCDs
652
-  #if LCD_WIDTH < 20
653
-      uint8_t n = LCD_WIDTH - 1 - 1 - lcd_strlen(data);
654
-    #else
655
-      uint8_t n = LCD_WIDTH - 1 - 2 - lcd_strlen(data);
656
-  #endif
657
-    lcd.setCursor(0, row);
658
-    lcd.print(pre_char);
659
-    while( ((c = pgm_read_byte(pstr)) != '\0') && (n>0) ) {
660
-      n -= lcd_print(c);
661
-      pstr++;
662
-    }
663
-    lcd.print(':');
664
-    while(n--)
665
-      lcd.print(' ');
666
-    lcd_print(data);
667
-}
668
-static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, const char* pstr, char pre_char, const char* data)
669
-{
670
-    char c;
671
-    //Use all characters in narrow LCDs
672
-  #if LCD_WIDTH < 20
673
-      uint8_t n = LCD_WIDTH - 1 - 1 - lcd_strlen_P(data);
674
-    #else
675
-      uint8_t n = LCD_WIDTH - 1 - 2 - lcd_strlen_P(data);
676
-  #endif
677
-    lcd.setCursor(0, row);
678
-    lcd.print(pre_char);
679
-    while( ((c = pgm_read_byte(pstr)) != '\0') && (n>0) ) {
680
-      n -= lcd_print(c);
681
-      pstr++;
682
-    }
683
-    lcd.print(':');
684
-    while(n--)
685
-      lcd.print(' ');
686
-    lcd_printPGM(data);
625
+static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) {
626
+  char c;
627
+  uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2);
628
+  lcd.setCursor(0, row);
629
+  lcd.print(sel ? pre_char : ' ');
630
+  while ((c = pgm_read_byte(pstr)) && n > 0) {
631
+    n -= lcd_print(c);
632
+    pstr++;
633
+  }
634
+  while(n--) lcd.print(' ');
635
+  lcd.print(post_char);
636
+  lcd.print(' ');
687 637
 }
688
-#define lcd_implementation_drawmenu_setting_edit_int3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data)))
689
-#define lcd_implementation_drawmenu_setting_edit_int3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data)))
690
-#define lcd_implementation_drawmenu_setting_edit_float3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data)))
691
-#define lcd_implementation_drawmenu_setting_edit_float3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data)))
692
-#define lcd_implementation_drawmenu_setting_edit_float32_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data)))
693
-#define lcd_implementation_drawmenu_setting_edit_float32(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
694
-#define lcd_implementation_drawmenu_setting_edit_float43_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr43(*(data)))
695
-#define lcd_implementation_drawmenu_setting_edit_float43(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr43(*(data)))
696
-#define lcd_implementation_drawmenu_setting_edit_float5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
697
-#define lcd_implementation_drawmenu_setting_edit_float5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
698
-#define lcd_implementation_drawmenu_setting_edit_float52_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data)))
699
-#define lcd_implementation_drawmenu_setting_edit_float52(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data)))
700
-#define lcd_implementation_drawmenu_setting_edit_float51_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data)))
701
-#define lcd_implementation_drawmenu_setting_edit_float51(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data)))
702
-#define lcd_implementation_drawmenu_setting_edit_long5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
703
-#define lcd_implementation_drawmenu_setting_edit_long5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
704
-#define lcd_implementation_drawmenu_setting_edit_bool_selected(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
705
-#define lcd_implementation_drawmenu_setting_edit_bool(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
706 638
 
707
-//Add version for callback functions
708
-#define lcd_implementation_drawmenu_setting_edit_callback_int3_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data)))
709
-#define lcd_implementation_drawmenu_setting_edit_callback_int3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data)))
710
-#define lcd_implementation_drawmenu_setting_edit_callback_float3_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data)))
711
-#define lcd_implementation_drawmenu_setting_edit_callback_float3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data)))
712
-#define lcd_implementation_drawmenu_setting_edit_callback_float32_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data)))
713
-#define lcd_implementation_drawmenu_setting_edit_callback_float32(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
714
-#define lcd_implementation_drawmenu_setting_edit_callback_float43_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr43(*(data)))
715
-#define lcd_implementation_drawmenu_setting_edit_callback_float43(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr43(*(data)))
716
-#define lcd_implementation_drawmenu_setting_edit_callback_float5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
717
-#define lcd_implementation_drawmenu_setting_edit_callback_float5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
718
-#define lcd_implementation_drawmenu_setting_edit_callback_float52_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data)))
719
-#define lcd_implementation_drawmenu_setting_edit_callback_float52(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data)))
720
-#define lcd_implementation_drawmenu_setting_edit_callback_float51_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data)))
721
-#define lcd_implementation_drawmenu_setting_edit_callback_float51(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data)))
722
-#define lcd_implementation_drawmenu_setting_edit_callback_long5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
723
-#define lcd_implementation_drawmenu_setting_edit_callback_long5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
724
-#define lcd_implementation_drawmenu_setting_edit_callback_bool_selected(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
725
-#define lcd_implementation_drawmenu_setting_edit_callback_bool(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
726
-
727
-
728
-void lcd_implementation_drawedit(const char* pstr, char* value)
729
-{
730
-    lcd.setCursor(1, 1);
731
-    lcd_printPGM(pstr);
732
-    lcd.print(':');
733
-   #if LCD_WIDTH < 20
734
-      lcd.setCursor(LCD_WIDTH - lcd_strlen(value), 1);
735
-    #else
736
-      lcd.setCursor(LCD_WIDTH -1 - lcd_strlen(value), 1);
737
-   #endif
738
-    lcd_print(value);
739
-}
740
-static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)
741
-{
742
-    char c;
743
-    uint8_t n = LCD_WIDTH - 1;
744
-    lcd.setCursor(0, row);
745
-    lcd.print('>');
746
-    if (longFilename[0] != '\0')
747
-    {
748
-        filename = longFilename;
749
-        longFilename[LCD_WIDTH-1] = '\0';
750
-    }
751
-    while( ((c = *filename) != '\0') && (n>0) )
752
-    {
753
-        n -= lcd_print(c);
754
-        filename++;
755
-    }
756
-    while(n--)
757
-        lcd.print(' ');
758
-}
759
-static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* pstr, const char* filename, char* longFilename)
760
-{
761
-    char c;
762
-    uint8_t n = LCD_WIDTH - 1;
763
-    lcd.setCursor(0, row);
764
-    lcd.print(' ');
765
-    if (longFilename[0] != '\0')
766
-    {
767
-        filename = longFilename;
768
-        longFilename[LCD_WIDTH-1] = '\0';
769
-    }
770
-    while( ((c = *filename) != '\0') && (n>0) )
771
-    {
772
-        n -= lcd_print(c);
773
-        filename++;
774
-    }
775
-    while(n--)
776
-        lcd.print(' ');
777
-}
778
-static void lcd_implementation_drawmenu_sddirectory_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename) {
639
+static void lcd_implementation_drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char* data) {
779 640
   char c;
780
-  uint8_t n = LCD_WIDTH - 2;
641
+  uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2) - lcd_strlen(data);
781 642
   lcd.setCursor(0, row);
782
-  lcd.print('>');
783
-  lcd.print(LCD_STR_FOLDER[0]);
784
-  if (longFilename[0] != '\0') {
785
-    filename = longFilename;
786
-    longFilename[LCD_WIDTH-2] = '\0';
643
+  lcd.print(sel ? pre_char : ' ');
644
+  while ((c = pgm_read_byte(pstr)) && n > 0) {
645
+    n -= lcd_print(c);
646
+    pstr++;
787 647
   }
788
-  while( ((c = *filename) != '\0') && (n>0) ) {
648
+  lcd.print(':');
649
+  while (n--) lcd.print(' ');
650
+  lcd_print(data);
651
+}
652
+static void lcd_implementation_drawmenu_setting_edit_generic_P(bool sel, uint8_t row, const char* pstr, char pre_char, const char* data) {
653
+  char c;
654
+  uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2) - lcd_strlen_P(data);
655
+  lcd.setCursor(0, row);
656
+  lcd.print(sel ? pre_char : ' ');
657
+  while ((c = pgm_read_byte(pstr)) && n > 0) {
789 658
     n -= lcd_print(c);
790
-    filename++;
659
+    pstr++;
791 660
   }
792
-  while(n--)
793
-    lcd.print(' ');
661
+  lcd.print(':');
662
+  while (n--) lcd.print(' ');
663
+  lcd_printPGM(data);
664
+}
665
+
666
+#define lcd_implementation_drawmenu_setting_edit_int3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', itostr3(*(data)))
667
+#define lcd_implementation_drawmenu_setting_edit_float3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr3(*(data)))
668
+#define lcd_implementation_drawmenu_setting_edit_float32(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr32(*(data)))
669
+#define lcd_implementation_drawmenu_setting_edit_float43(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr43(*(data)))
670
+#define lcd_implementation_drawmenu_setting_edit_float5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5(*(data)))
671
+#define lcd_implementation_drawmenu_setting_edit_float52(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr52(*(data)))
672
+#define lcd_implementation_drawmenu_setting_edit_float51(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr51(*(data)))
673
+#define lcd_implementation_drawmenu_setting_edit_long5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5(*(data)))
674
+#define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
675
+
676
+//Add version for callback functions
677
+#define lcd_implementation_drawmenu_setting_edit_callback_int3(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', itostr3(*(data)))
678
+#define lcd_implementation_drawmenu_setting_edit_callback_float3(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr3(*(data)))
679
+#define lcd_implementation_drawmenu_setting_edit_callback_float32(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr32(*(data)))
680
+#define lcd_implementation_drawmenu_setting_edit_callback_float43(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr43(*(data)))
681
+#define lcd_implementation_drawmenu_setting_edit_callback_float5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5(*(data)))
682
+#define lcd_implementation_drawmenu_setting_edit_callback_float52(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr52(*(data)))
683
+#define lcd_implementation_drawmenu_setting_edit_callback_float51(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr51(*(data)))
684
+#define lcd_implementation_drawmenu_setting_edit_callback_long5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5(*(data)))
685
+#define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
686
+
687
+void lcd_implementation_drawedit(const char* pstr, char* value) {
688
+  lcd.setCursor(1, 1);
689
+  lcd_printPGM(pstr);
690
+  lcd.print(':');
691
+  lcd.setCursor(LCD_WIDTH - (LCD_WIDTH < 20 ? 0 : 1) - lcd_strlen(value), 1);
692
+  lcd_print(value);
794 693
 }
795
-static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pstr, const char* filename, char* longFilename) {
694
+
695
+static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename, uint8_t concat) {
796 696
   char c;
797
-  uint8_t n = LCD_WIDTH - 2;
697
+  uint8_t n = LCD_WIDTH - concat;
798 698
   lcd.setCursor(0, row);
799
-  lcd.print(' ');
800
-  lcd.print(LCD_STR_FOLDER[0]);
801
-  if (longFilename[0] != '\0') {
699
+  lcd.print(sel ? '>' : ' ');
700
+  if (longFilename[0]) {
802 701
     filename = longFilename;
803
-    longFilename[LCD_WIDTH-2] = '\0';
702
+    longFilename[n] = '\0';
804 703
   }
805
-  while( ((c = *filename) != '\0') && (n>0) ) {
704
+  while ((c = *filename) && n > 0) {
806 705
     n -= lcd_print(c);
807 706
     filename++;
808 707
   }
809
-  while(n--)
810
-    lcd.print(' ');
708
+  while (n--) lcd.print(' ');
709
+}
710
+
711
+static void lcd_implementation_drawmenu_sdfile(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
712
+  lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 1);
811 713
 }
812
-#define lcd_implementation_drawmenu_back_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
813
-#define lcd_implementation_drawmenu_back(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_UPLEVEL[0])
814
-#define lcd_implementation_drawmenu_submenu_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
815
-#define lcd_implementation_drawmenu_submenu(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_ARROW_RIGHT[0])
816
-#define lcd_implementation_drawmenu_gcode_selected(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
817
-#define lcd_implementation_drawmenu_gcode(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
818
-#define lcd_implementation_drawmenu_function_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
819
-#define lcd_implementation_drawmenu_function(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
714
+
715
+static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
716
+  lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2);
717
+}
718
+
719
+#define lcd_implementation_drawmenu_back(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
720
+#define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
721
+#define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
722
+#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
820 723
 
821 724
 static void lcd_implementation_quick_feedback()
822 725
 {

Loading…
Cancel
Save