ソースを参照

Merge pull request #4243 from thinkyhead/rc_fix_static_scrolling

Improve STATIC_ITEM implementation
Scott Lahteine 8年前
コミット
6e68dd292b
4個のファイルの変更125行の追加103行の削除
  1. 1
    6
      Marlin/Conditionals.h
  2. 16
    14
      Marlin/dogm_lcd_implementation.h
  3. 102
    78
      Marlin/ultralcd.cpp
  4. 6
    5
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 1
- 6
Marlin/Conditionals.h ファイルの表示

@@ -118,12 +118,7 @@
118 118
     #define REPRAP_DISCOUNT_SMART_CONTROLLER
119 119
   #endif
120 120
 
121
-  #if ENABLED(ULTIMAKERCONTROLLER) || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) || ENABLED(G3D_PANEL) || ENABLED(RIGIDBOT_PANEL)
122
-    #define ULTIPANEL
123
-    #define NEWPANEL
124
-  #endif
125
-
126
-  #if ENABLED(REPRAPWORLD_KEYPAD)
121
+  #if ENABLED(ULTIMAKERCONTROLLER) || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) || ENABLED(G3D_PANEL) || ENABLED(RIGIDBOT_PANEL) || ENABLED(REPRAPWORLD_KEYPAD)
127 122
     #define ULTIPANEL
128 123
     #define NEWPANEL
129 124
   #endif

+ 16
- 14
Marlin/dogm_lcd_implementation.h ファイルの表示

@@ -138,7 +138,7 @@
138 138
   #define TALL_FONT_CORRECTION 0
139 139
 #endif
140 140
 
141
-#define START_ROW              0
141
+#define START_COL              0
142 142
 
143 143
 // LCD selection
144 144
 #if ENABLED(U8GLIB_ST7920)
@@ -483,27 +483,29 @@ static void lcd_implementation_mark_as_selected(uint8_t row, bool isSelected) {
483 483
   else {
484 484
     u8g.setColorIndex(1); // unmarked text is black on white
485 485
   }
486
-  u8g.setPrintPos((START_ROW) * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT));
486
+  u8g.setPrintPos((START_COL) * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT));
487 487
 }
488 488
 
489 489
 #if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE)
490 490
 
491
-  static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, const char* valstr=NULL, bool center=true) {
491
+  static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, bool center=true, bool invert=false, const char* valstr=NULL) {
492
+
493
+    lcd_implementation_mark_as_selected(row, invert);
494
+
492 495
     char c;
493
-    int8_t n = LCD_WIDTH;
494
-    u8g.setPrintPos(0, (row + 1) * (DOG_CHAR_HEIGHT));
495
-    u8g.setColorIndex(1); // normal text
496
+    int8_t n = LCD_WIDTH - (START_COL);
497
+
496 498
     if (center && !valstr) {
497 499
       int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
498 500
       while (--pad >= 0) { lcd_print(' '); n--; }
499 501
     }
500
-    while (c = pgm_read_byte(pstr)) {
502
+    while (n > 0 && (c = pgm_read_byte(pstr))) {
501 503
       n -= lcd_print(c);
502 504
       pstr++;
503 505
     }
504
-    if (valstr) {
505
-      lcd_print(valstr);
506
-      n -= lcd_strlen(valstr);
506
+    if (valstr) while (n > 0 && (c = *valstr)) {
507
+      n -= lcd_print(c);
508
+      valstr++;
507 509
     }
508 510
     while (n-- > 0) lcd_print(' ');
509 511
   }
@@ -514,7 +516,7 @@ static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, co
514 516
   UNUSED(pre_char);
515 517
 
516 518
   char c;
517
-  uint8_t n = LCD_WIDTH - 2;
519
+  uint8_t n = LCD_WIDTH - (START_COL) - 2;
518 520
 
519 521
   lcd_implementation_mark_as_selected(row, isSelected);
520 522
 
@@ -531,7 +533,7 @@ static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, co
531 533
 static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const char* pstr, const char* data, bool pgm) {
532 534
   char c;
533 535
   uint8_t vallen = (pgm ? lcd_strlen_P(data) : (lcd_strlen((char*)data)));
534
-  uint8_t n = LCD_WIDTH - 2 - vallen;
536
+  uint8_t n = LCD_WIDTH - (START_COL) - 2 - vallen;
535 537
 
536 538
   lcd_implementation_mark_as_selected(row, isSelected);
537 539
 
@@ -571,7 +573,7 @@ static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const c
571 573
 
572 574
 void lcd_implementation_drawedit(const char* pstr, const char* value=NULL) {
573 575
   uint8_t rows = 1;
574
-  uint8_t lcd_width = LCD_WIDTH, char_width = DOG_CHAR_WIDTH;
576
+  uint8_t lcd_width = LCD_WIDTH - (START_COL), char_width = DOG_CHAR_WIDTH;
575 577
   uint8_t vallen = lcd_strlen(value);
576 578
 
577 579
   #if ENABLED(USE_BIG_EDIT_FONT)
@@ -605,7 +607,7 @@ void lcd_implementation_drawedit(const char* pstr, const char* value=NULL) {
605 607
   static void _drawmenu_sd(bool isSelected, uint8_t row, const char* pstr, const char* filename, char* const longFilename, bool isDir) {
606 608
     UNUSED(pstr);
607 609
     char c;
608
-    uint8_t n = LCD_WIDTH - 1;
610
+    uint8_t n = LCD_WIDTH - (START_COL) - 1;
609 611
 
610 612
     if (longFilename[0]) {
611 613
       filename = longFilename;

+ 102
- 78
Marlin/ultralcd.cpp ファイルの表示

@@ -214,21 +214,21 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
214 214
    * START_SCREEN generates the init code for a screen function
215 215
    *
216 216
    *   encoderLine is the position based on the encoder
217
-   *   currentMenuViewOffset is the top menu line to display
218
-   *   _drawLineNr is the index of the LCD line (0-3)
219
-   *   _lineNr is the menu item to draw and process
220
-   *   _menuItemNr is the index of each MENU_ITEM
217
+   *   encoderTopLine is the top menu line to display
218
+   *   _lcdLineNr is the index of the LCD line (e.g., 0-3)
219
+   *   _menuLineNr is the menu item to draw and process
220
+   *   _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM
221 221
    */
222
-  #define _START_SCREEN(CODE) do { \
222
+  #define _START_SCREEN(CODE) \
223 223
     ENCODER_DIRECTION_MENUS(); \
224 224
     encoderRateMultiplierEnabled = false; \
225 225
     if (encoderPosition > 0x8000) encoderPosition = 0; \
226
-    uint8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \
227
-    NOMORE(currentMenuViewOffset, encoderLine); \
228
-    uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
226
+    int8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \
227
+    NOMORE(encoderTopLine, encoderLine); \
228
+    int8_t _menuLineNr = encoderTopLine, _thisItemNr; \
229 229
     CODE; \
230
-    for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \
231
-      _menuItemNr = 0;
230
+    for (int8_t _lcdLineNr = 0; _lcdLineNr < LCD_HEIGHT; _lcdLineNr++, _menuLineNr++) { \
231
+      _thisItemNr = 0;
232 232
 
233 233
   #define START_SCREEN() _START_SCREEN(0)
234 234
 
@@ -260,49 +260,71 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
260 260
    *     menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedrate_multiplier, 10, 999)
261 261
    *
262 262
    */
263
-  #define _MENU_ITEM_PART_1(type, label, args...) \
264
-    if (_menuItemNr == _lineNr) { \
263
+  #define _MENU_ITEM_PART_1(TYPE, LABEL, ARGS...) \
264
+    if (_menuLineNr == _thisItemNr) { \
265 265
       if (lcdDrawUpdate) \
266
-        lcd_implementation_drawmenu_ ## type(encoderLine == _menuItemNr, _drawLineNr, PSTR(label), ## args); \
267
-      if (wasClicked && encoderLine == _menuItemNr) { \
266
+        lcd_implementation_drawmenu_ ## TYPE(encoderLine == _thisItemNr, _lcdLineNr, PSTR(LABEL), ## ARGS); \
267
+      if (wasClicked && encoderLine == _thisItemNr) { \
268 268
         lcd_quick_feedback()
269 269
 
270
-  #define _MENU_ITEM_PART_2(type, args...) \
271
-        menu_action_ ## type(args); \
270
+  #define _MENU_ITEM_PART_2(TYPE, ARGS...) \
271
+        menu_action_ ## TYPE(ARGS); \
272 272
         return; \
273 273
       } \
274 274
     } \
275
-    _menuItemNr++
275
+    _thisItemNr++
276 276
 
277
-  #define MENU_ITEM(type, label, args...) do { \
278
-      _MENU_ITEM_PART_1(type, label, ## args); \
279
-      _MENU_ITEM_PART_2(type, ## args); \
277
+  #define MENU_ITEM(TYPE, LABEL, ARGS...) do { \
278
+      _MENU_ITEM_PART_1(TYPE, LABEL, ## ARGS); \
279
+      _MENU_ITEM_PART_2(TYPE, ## ARGS); \
280 280
     } while(0)
281 281
 
282 282
   // Used to print static text with no visible cursor.
283
-  #define STATIC_ITEM(label, args...) \
284
-    if (_menuItemNr == _lineNr) { \
285
-      if (encoderLine == _menuItemNr && _menuItemNr < LCD_HEIGHT - 1) \
283
+  #define STATIC_ITEM(LABEL, ARGS...) \
284
+    if (_menuLineNr == _thisItemNr) { \
285
+      if (encoderLine == _thisItemNr && _thisItemNr < LCD_HEIGHT - 1) { \
286 286
         encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
287
+        lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
288
+      } \
287 289
       if (lcdDrawUpdate) \
288
-        lcd_implementation_drawmenu_static(_drawLineNr, PSTR(label), ## args); \
290
+        lcd_implementation_drawmenu_static(_lcdLineNr, PSTR(LABEL), ## ARGS); \
289 291
     } \
290
-    _menuItemNr++
292
+    _thisItemNr++
291 293
 
294
+  /**
295
+   *
296
+   * END_SCREEN  Closing code for a screen having only static items.
297
+   *             Do simplified scrolling of the entire screen.
298
+   *
299
+   * END_MENU    Closing code for a screen with menu items.
300
+   *             Scroll as-needed to keep the selected line in view.
301
+   *
302
+   * At this point _thisItemNr equals the total number of items.
303
+   * 
304
+   */
305
+
306
+  // Simple-scroll by using encoderLine as encoderTopLine
292 307
   #define END_SCREEN() \
293
-      if (encoderLine >= _menuItemNr) { \
294
-        encoderPosition = _menuItemNr * (ENCODER_STEPS_PER_MENU_ITEM) - 1; \
295
-        encoderLine = _menuItemNr - 1; \
296
-      } \
297
-      if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { \
298
-        currentMenuViewOffset = encoderLine - (LCD_HEIGHT) + 1; \
299
-        lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
300
-        _lineNr = currentMenuViewOffset - 1; \
301
-        _drawLineNr = -1; \
302
-      } \
303
-    } } while(0)
308
+    } \
309
+    NOMORE(encoderLine, _thisItemNr - LCD_HEIGHT); \
310
+    NOLESS(encoderLine, 0); \
311
+    encoderPosition = encoderLine * (ENCODER_STEPS_PER_MENU_ITEM); \
312
+    if (encoderTopLine != encoderLine) { \
313
+      encoderTopLine = encoderLine; \
314
+      lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
315
+    }
304 316
 
305
-  #define END_MENU() END_SCREEN()
317
+  // Scroll through menu items, scrolling as-needed to stay in view
318
+  #define END_MENU() \
319
+    } \
320
+    if (encoderLine >= _thisItemNr) { \
321
+      encoderLine = _thisItemNr - 1; \
322
+      encoderPosition = encoderLine * (ENCODER_STEPS_PER_MENU_ITEM); \
323
+    } \
324
+    if (encoderLine >= encoderTopLine + LCD_HEIGHT) { \
325
+      encoderTopLine = encoderLine - (LCD_HEIGHT - 1); \
326
+      lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
327
+    }
306 328
 
307 329
   #if ENABLED(ENCODER_RATE_MULTIPLIER)
308 330
 
@@ -320,7 +342,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
320 342
 
321 343
   #endif //ENCODER_RATE_MULTIPLIER
322 344
 
323
-  #define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0)
345
+  #define MENU_ITEM_DUMMY() do { _thisItemNr++; } while(0)
324 346
   #define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
325 347
   #define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
326 348
   #if ENABLED(ENCODER_RATE_MULTIPLIER)
@@ -340,7 +362,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
340 362
   #if ENABLED(LCD_HAS_SLOW_BUTTONS)
341 363
     volatile uint8_t slow_buttons; // Bits of the pressed buttons.
342 364
   #endif
343
-  uint8_t currentMenuViewOffset;              /* scroll offset in the current menu */
365
+  int8_t encoderTopLine;              /* scroll offset in the current menu */
344 366
   millis_t next_button_update_ms;
345 367
   uint8_t lastEncoderBits;
346 368
   uint32_t encoderPosition;
@@ -376,6 +398,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
376 398
     if (currentScreen != screen) {
377 399
       currentScreen = screen;
378 400
       lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
401
+      encoderTopLine = 0;
379 402
       #if ENABLED(NEWPANEL)
380 403
         encoderPosition = encoder;
381 404
         if (feedback) lcd_quick_feedback();
@@ -654,6 +677,7 @@ void kill_screen(const char* lcd_msg) {
654 677
     long babysteps_done = 0;
655 678
 
656 679
     static void _lcd_babystep(const AxisEnum axis, const char* msg) {
680
+      if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
657 681
       ENCODER_DIRECTION_NORMAL();
658 682
       if (encoderPosition) {
659 683
         int babystep_increment = (int32_t)encoderPosition * BABYSTEP_MULTIPLICATOR;
@@ -666,7 +690,6 @@ void kill_screen(const char* lcd_msg) {
666 690
         lcd_implementation_drawedit(msg, ftostr43sign(
667 691
           ((1000 * babysteps_done) / planner.axis_steps_per_mm[axis]) * 0.001f
668 692
         ));
669
-      if (LCD_CLICKED) lcd_goto_previous_menu(true);
670 693
     }
671 694
 
672 695
     #if ENABLED(BABYSTEP_XY)
@@ -1321,6 +1344,7 @@ void kill_screen(const char* lcd_msg) {
1321 1344
   float move_menu_scale;
1322 1345
 
1323 1346
   static void _lcd_move_xyz(const char* name, AxisEnum axis, float min, float max) {
1347
+    if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
1324 1348
     ENCODER_DIRECTION_NORMAL();
1325 1349
     if (encoderPosition) {
1326 1350
       refresh_cmd_timeout();
@@ -1332,7 +1356,6 @@ void kill_screen(const char* lcd_msg) {
1332 1356
       lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
1333 1357
     }
1334 1358
     if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr41sign(current_position[axis]));
1335
-    if (LCD_CLICKED) lcd_goto_previous_menu(true);
1336 1359
   }
1337 1360
   #if ENABLED(DELTA)
1338 1361
     static float delta_clip_radius_2 =  (DELTA_PRINTABLE_RADIUS) * (DELTA_PRINTABLE_RADIUS);
@@ -1349,6 +1372,7 @@ void kill_screen(const char* lcd_msg) {
1349 1372
       int8_t eindex = -1
1350 1373
     #endif
1351 1374
   ) {
1375
+    if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
1352 1376
     ENCODER_DIRECTION_NORMAL();
1353 1377
     if (encoderPosition) {
1354 1378
       current_position[E_AXIS] += float((int32_t)encoderPosition) * move_menu_scale;
@@ -1378,7 +1402,6 @@ void kill_screen(const char* lcd_msg) {
1378 1402
       #endif //EXTRUDERS > 1
1379 1403
       lcd_implementation_drawedit(pos_label, ftostr41sign(current_position[E_AXIS]));
1380 1404
     }
1381
-    if (LCD_CLICKED) lcd_goto_previous_menu(true);
1382 1405
   }
1383 1406
 
1384 1407
   #if EXTRUDERS > 1
@@ -1837,6 +1860,7 @@ void kill_screen(const char* lcd_msg) {
1837 1860
    */
1838 1861
   #if HAS_LCD_CONTRAST
1839 1862
     static void lcd_set_contrast() {
1863
+      if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
1840 1864
       ENCODER_DIRECTION_NORMAL();
1841 1865
       if (encoderPosition) {
1842 1866
         set_lcd_contrast(lcd_contrast + encoderPosition);
@@ -1852,7 +1876,6 @@ void kill_screen(const char* lcd_msg) {
1852 1876
           #endif
1853 1877
         );
1854 1878
       }
1855
-      if (LCD_CLICKED) lcd_goto_previous_menu(true);
1856 1879
     }
1857 1880
   #endif // HAS_LCD_CONTRAST
1858 1881
 
@@ -1886,13 +1909,13 @@ void kill_screen(const char* lcd_msg) {
1886 1909
     #if !PIN_EXISTS(SD_DETECT)
1887 1910
       static void lcd_sd_refresh() {
1888 1911
         card.initsd();
1889
-        currentMenuViewOffset = 0;
1912
+        encoderTopLine = 0;
1890 1913
       }
1891 1914
     #endif
1892 1915
 
1893 1916
     static void lcd_sd_updir() {
1894 1917
       card.updir();
1895
-      currentMenuViewOffset = 0;
1918
+      encoderTopLine = 0;
1896 1919
     }
1897 1920
 
1898 1921
     /**
@@ -1917,7 +1940,7 @@ void kill_screen(const char* lcd_msg) {
1917 1940
       }
1918 1941
 
1919 1942
       for (uint16_t i = 0; i < fileCnt; i++) {
1920
-        if (_menuItemNr == _lineNr) {
1943
+        if (_menuLineNr == _thisItemNr) {
1921 1944
           card.getfilename(
1922 1945
              #if ENABLED(SDCARD_RATHERRECENTFIRST)
1923 1946
                fileCnt-1 -
@@ -1944,10 +1967,12 @@ void kill_screen(const char* lcd_msg) {
1944 1967
     #if ENABLED(PRINTCOUNTER)
1945 1968
       /**
1946 1969
        *
1947
-       * About Printer > Stastics submenu
1970
+       * About Printer > Statistics submenu
1948 1971
        *
1949 1972
        */
1950 1973
       static void lcd_info_stats_menu() {
1974
+        if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
1975
+
1951 1976
         PrintCounter print_job_counter = PrintCounter();
1952 1977
         print_job_counter.loadStats();
1953 1978
         printStatistics stats = print_job_counter.getStats();
@@ -1955,11 +1980,10 @@ void kill_screen(const char* lcd_msg) {
1955 1980
         char printTime[6];
1956 1981
         sprintf(printTime, "%02d:%02d", int(stats.printTime / 3600), int(stats.printTime / 60) % 60);
1957 1982
 
1958
-        if (LCD_CLICKED) lcd_goto_previous_menu(true);
1959 1983
         START_SCREEN();
1960
-        STATIC_ITEM(MSG_INFO_PRINT_COUNT ": ", itostr3left(stats.totalPrints));        // Print Count : 999
1961
-        STATIC_ITEM(MSG_INFO_FINISHED_PRINTS ": ", itostr3left(stats.finishedPrints)); // Finished    : 666
1962
-        STATIC_ITEM(MSG_INFO_PRINT_TIME ": ", printTime);                              // Total Time  : 12:34
1984
+        STATIC_ITEM(MSG_INFO_PRINT_COUNT ": ", false, false, itostr3left(stats.totalPrints));        // Print Count : 999
1985
+        STATIC_ITEM(MSG_INFO_FINISHED_PRINTS ": ", false, false, itostr3left(stats.finishedPrints)); // Finished    : 666
1986
+        STATIC_ITEM(MSG_INFO_PRINT_TIME ": ", false, false, printTime);                              // Total Time  : 12:34
1963 1987
         END_SCREEN();
1964 1988
       }
1965 1989
     #endif // PRINTCOUNTER
@@ -1970,48 +1994,48 @@ void kill_screen(const char* lcd_msg) {
1970 1994
      *
1971 1995
      */
1972 1996
     static void lcd_info_thermistors_menu() {
1973
-      if (LCD_CLICKED) lcd_goto_previous_menu(true);
1997
+      if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
1974 1998
       START_SCREEN();
1975 1999
       #define THERMISTOR_ID TEMP_SENSOR_0
1976 2000
       #include "thermistornames.h"
1977
-      STATIC_ITEM("T0: " THERMISTOR_NAME);
1978
-      STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_0_MINTEMP));
1979
-      STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_0_MAXTEMP));
2001
+      STATIC_ITEM("T0: " THERMISTOR_NAME, false, true);
2002
+      STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_0_MINTEMP), false);
2003
+      STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_0_MAXTEMP), false);
1980 2004
 
1981 2005
       #if TEMP_SENSOR_1 != 0
1982 2006
         #undef THERMISTOR_ID
1983 2007
         #define THERMISTOR_ID TEMP_SENSOR_1
1984 2008
         #include "thermistornames.h"
1985
-        STATIC_ITEM("T1: " THERMISTOR_NAME);
1986
-        STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_1_MINTEMP));
1987
-        STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_1_MAXTEMP));
2009
+        STATIC_ITEM("T1: " THERMISTOR_NAME, false, true);
2010
+        STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_1_MINTEMP), false);
2011
+        STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_1_MAXTEMP), false);
1988 2012
       #endif
1989 2013
 
1990 2014
       #if TEMP_SENSOR_2 != 0
1991 2015
         #undef THERMISTOR_ID
1992 2016
         #define THERMISTOR_ID TEMP_SENSOR_2
1993 2017
         #include "thermistornames.h"
1994
-        STATIC_ITEM("T2: " THERMISTOR_NAME);
1995
-        STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_2_MINTEMP));
1996
-        STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_2_MAXTEMP));
2018
+        STATIC_ITEM("T2: " THERMISTOR_NAME, false, true);
2019
+        STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_2_MINTEMP), false);
2020
+        STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_2_MAXTEMP), false);
1997 2021
       #endif
1998 2022
 
1999 2023
       #if TEMP_SENSOR_3 != 0
2000 2024
         #undef THERMISTOR_ID
2001 2025
         #define THERMISTOR_ID TEMP_SENSOR_3
2002 2026
         #include "thermistornames.h"
2003
-        STATIC_ITEM("T3: " THERMISTOR_NAME);
2004
-        STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_3_MINTEMP));
2005
-        STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_3_MAXTEMP));
2027
+        STATIC_ITEM("T3: " THERMISTOR_NAME, false, true);
2028
+        STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_3_MINTEMP), false);
2029
+        STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_3_MAXTEMP), false);
2006 2030
       #endif
2007 2031
 
2008 2032
       #if TEMP_SENSOR_BED != 0
2009 2033
         #undef THERMISTOR_ID
2010 2034
         #define THERMISTOR_ID TEMP_SENSOR_BED
2011 2035
         #include "thermistornames.h"
2012
-        STATIC_ITEM("TBed:" THERMISTOR_NAME);
2013
-        STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(BED_MINTEMP));
2014
-        STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(BED_MAXTEMP));
2036
+        STATIC_ITEM("TBed:" THERMISTOR_NAME, false, true);
2037
+        STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(BED_MINTEMP), false);
2038
+        STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(BED_MAXTEMP), false);
2015 2039
       #endif
2016 2040
       END_SCREEN();
2017 2041
     }
@@ -2022,9 +2046,9 @@ void kill_screen(const char* lcd_msg) {
2022 2046
      *
2023 2047
      */
2024 2048
     static void lcd_info_board_menu() {
2025
-      if (LCD_CLICKED) lcd_goto_previous_menu(true);
2049
+      if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
2026 2050
       START_SCREEN();
2027
-      STATIC_ITEM(BOARD_NAME);                                 // MyPrinterController
2051
+      STATIC_ITEM(BOARD_NAME, true, true);                     // MyPrinterController
2028 2052
       STATIC_ITEM(MSG_INFO_BAUDRATE ": " STRINGIFY(BAUDRATE)); // Baud: 250000
2029 2053
       STATIC_ITEM(MSG_INFO_PROTOCOL ": " PROTOCOL_VERSION);    // Protocol: 1.0
2030 2054
       #ifdef POWER_SUPPLY
@@ -2043,9 +2067,9 @@ void kill_screen(const char* lcd_msg) {
2043 2067
      *
2044 2068
      */
2045 2069
     static void lcd_info_printer_menu() {
2046
-      if (LCD_CLICKED) lcd_goto_previous_menu(true);
2070
+      if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
2047 2071
       START_SCREEN();
2048
-      STATIC_ITEM(MSG_MARLIN);                                   // Marlin
2072
+      STATIC_ITEM(MSG_MARLIN, true, true);                       // Marlin
2049 2073
       STATIC_ITEM(SHORT_BUILD_VERSION);                          // x.x.x-Branch
2050 2074
       STATIC_ITEM(STRING_DISTRIBUTION_DATE);                     // YYYY-MM-DD HH:MM
2051 2075
       STATIC_ITEM(MACHINE_NAME);                                 // My3DPrinter
@@ -2087,7 +2111,7 @@ void kill_screen(const char* lcd_msg) {
2087 2111
     static void lcd_filament_change_option_menu() {
2088 2112
       START_MENU();
2089 2113
       #if LCD_HEIGHT > 2
2090
-        STATIC_ITEM(MSG_FILAMENT_CHANGE_OPTION_HEADER);
2114
+        STATIC_ITEM(MSG_FILAMENT_CHANGE_OPTION_HEADER, true, false);
2091 2115
       #endif
2092 2116
       MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_RESUME, lcd_filament_change_resume_print);
2093 2117
       MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_EXTRUDE, lcd_filament_change_extrude_more);
@@ -2096,7 +2120,7 @@ void kill_screen(const char* lcd_msg) {
2096 2120
 
2097 2121
     static void lcd_filament_change_init_message() {
2098 2122
       START_SCREEN();
2099
-      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
2123
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER, true, true);
2100 2124
       STATIC_ITEM(MSG_FILAMENT_CHANGE_INIT_1);
2101 2125
       #ifdef MSG_FILAMENT_CHANGE_INIT_2
2102 2126
         STATIC_ITEM(MSG_FILAMENT_CHANGE_INIT_2);
@@ -2109,7 +2133,7 @@ void kill_screen(const char* lcd_msg) {
2109 2133
 
2110 2134
     static void lcd_filament_change_unload_message() {
2111 2135
       START_SCREEN();
2112
-      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
2136
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER, true, true);
2113 2137
       STATIC_ITEM(MSG_FILAMENT_CHANGE_UNLOAD_1);
2114 2138
       #ifdef MSG_FILAMENT_CHANGE_UNLOAD_2
2115 2139
         STATIC_ITEM(MSG_FILAMENT_CHANGE_UNLOAD_2);
@@ -2122,7 +2146,7 @@ void kill_screen(const char* lcd_msg) {
2122 2146
 
2123 2147
     static void lcd_filament_change_insert_message() {
2124 2148
       START_SCREEN();
2125
-      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
2149
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER, true, true);
2126 2150
       STATIC_ITEM(MSG_FILAMENT_CHANGE_INSERT_1);
2127 2151
       #ifdef MSG_FILAMENT_CHANGE_INSERT_2
2128 2152
         STATIC_ITEM(MSG_FILAMENT_CHANGE_INSERT_2);
@@ -2135,7 +2159,7 @@ void kill_screen(const char* lcd_msg) {
2135 2159
 
2136 2160
     static void lcd_filament_change_load_message() {
2137 2161
       START_SCREEN();
2138
-      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
2162
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER, true, true);
2139 2163
       STATIC_ITEM(MSG_FILAMENT_CHANGE_LOAD_1);
2140 2164
       #ifdef MSG_FILAMENT_CHANGE_LOAD_2
2141 2165
         STATIC_ITEM(MSG_FILAMENT_CHANGE_LOAD_2);
@@ -2148,7 +2172,7 @@ void kill_screen(const char* lcd_msg) {
2148 2172
 
2149 2173
     static void lcd_filament_change_extrude_message() {
2150 2174
       START_SCREEN();
2151
-      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
2175
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER, true, true);
2152 2176
       STATIC_ITEM(MSG_FILAMENT_CHANGE_EXTRUDE_1);
2153 2177
       #ifdef MSG_FILAMENT_CHANGE_EXTRUDE_2
2154 2178
         STATIC_ITEM(MSG_FILAMENT_CHANGE_EXTRUDE_2);
@@ -2161,7 +2185,7 @@ void kill_screen(const char* lcd_msg) {
2161 2185
 
2162 2186
     static void lcd_filament_change_resume_message() {
2163 2187
       START_SCREEN();
2164
-      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
2188
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER, true, true);
2165 2189
       STATIC_ITEM(MSG_FILAMENT_CHANGE_RESUME_1);
2166 2190
       #ifdef MSG_FILAMENT_CHANGE_RESUME_2
2167 2191
         STATIC_ITEM(MSG_FILAMENT_CHANGE_RESUME_2);

+ 6
- 5
Marlin/ultralcd_implementation_hitachi_HD44780.h ファイルの表示

@@ -830,7 +830,8 @@ static void lcd_implementation_status_screen() {
830 830
 
831 831
 #if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE)
832 832
 
833
-  static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, const char *valstr=NULL, bool center=true) {
833
+  static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, bool center=true, bool invert=false, const char *valstr=NULL) {
834
+    UNUSED(invert);
834 835
     char c;
835 836
     int8_t n = LCD_WIDTH;
836 837
     lcd.setCursor(0, row);
@@ -838,13 +839,13 @@ static void lcd_implementation_status_screen() {
838 839
       int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
839 840
       while (--pad >= 0) { lcd.print(' '); n--; }
840 841
     }
841
-    while ((c = pgm_read_byte(pstr)) && n > 0) {
842
+    while (n > 0 && (c = pgm_read_byte(pstr))) {
842 843
       n -= lcd_print(c);
843 844
       pstr++;
844 845
     }
845
-    if (valstr) {
846
-      lcd_print(valstr);
847
-      n -= lcd_strlen(valstr);
846
+    if (valstr) while (n > 0 && (c = *valstr)) {
847
+      n -= lcd_print(c);
848
+      valstr++;
848 849
     }
849 850
     while (n-- > 0) lcd.print(' ');
850 851
   }

読み込み中…
キャンセル
保存