Browse Source

Apply const to LCD arguments and locals

Scott Lahteine 8 years ago
parent
commit
71842b6a17
5 changed files with 56 additions and 56 deletions
  1. 5
    5
      Marlin/ultralcd.cpp
  2. 3
    3
      Marlin/ultralcd.h
  3. 25
    25
      Marlin/ultralcd_impl_DOGM.h
  4. 16
    16
      Marlin/ultralcd_impl_HD44780.h
  5. 7
    7
      Marlin/utf_mapper.h

+ 5
- 5
Marlin/ultralcd.cpp View File

2250
       END_SCREEN();
2250
       END_SCREEN();
2251
     }
2251
     }
2252
 
2252
 
2253
-    void lcd_filament_change_show_message(FilamentChangeMessage message) {
2253
+    void lcd_filament_change_show_message(const FilamentChangeMessage message) {
2254
       switch (message) {
2254
       switch (message) {
2255
         case FILAMENT_CHANGE_MESSAGE_INIT:
2255
         case FILAMENT_CHANGE_MESSAGE_INIT:
2256
           defer_return_to_status = true;
2256
           defer_return_to_status = true;
2849
 
2849
 
2850
 bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); }
2850
 bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); }
2851
 
2851
 
2852
-void lcd_setstatus(const char* message, bool persist) {
2852
+void lcd_setstatus(const char* const message, bool persist) {
2853
   if (lcd_status_message_level > 0) return;
2853
   if (lcd_status_message_level > 0) return;
2854
   strncpy(lcd_status_message, message, 3 * (LCD_WIDTH));
2854
   strncpy(lcd_status_message, message, 3 * (LCD_WIDTH));
2855
   lcd_finishstatus(persist);
2855
   lcd_finishstatus(persist);
2856
 }
2856
 }
2857
 
2857
 
2858
-void lcd_setstatuspgm(const char* message, uint8_t level) {
2858
+void lcd_setstatuspgm(const char* const message, uint8_t level) {
2859
   if (level < lcd_status_message_level) return;
2859
   if (level < lcd_status_message_level) return;
2860
   lcd_status_message_level = level;
2860
   lcd_status_message_level = level;
2861
   strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH));
2861
   strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH));
2862
   lcd_finishstatus(level > 0);
2862
   lcd_finishstatus(level > 0);
2863
 }
2863
 }
2864
 
2864
 
2865
-void lcd_setalertstatuspgm(const char* message) {
2865
+void lcd_setalertstatuspgm(const char* const message) {
2866
   lcd_setstatuspgm(message, 1);
2866
   lcd_setstatuspgm(message, 1);
2867
   #if ENABLED(ULTIPANEL)
2867
   #if ENABLED(ULTIPANEL)
2868
     lcd_return_to_status();
2868
     lcd_return_to_status();
2872
 void lcd_reset_alert_level() { lcd_status_message_level = 0; }
2872
 void lcd_reset_alert_level() { lcd_status_message_level = 0; }
2873
 
2873
 
2874
 #if HAS_LCD_CONTRAST
2874
 #if HAS_LCD_CONTRAST
2875
-  void set_lcd_contrast(int value) {
2875
+  void set_lcd_contrast(const int value) {
2876
     lcd_contrast = constrain(value, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX);
2876
     lcd_contrast = constrain(value, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX);
2877
     u8g.setContrast(lcd_contrast);
2877
     u8g.setContrast(lcd_contrast);
2878
   }
2878
   }

+ 3
- 3
Marlin/ultralcd.h View File

88
     void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
88
     void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
89
 
89
 
90
     #if ENABLED(FILAMENT_CHANGE_FEATURE)
90
     #if ENABLED(FILAMENT_CHANGE_FEATURE)
91
-      void lcd_filament_change_show_message(FilamentChangeMessage message);
91
+      void lcd_filament_change_show_message(const FilamentChangeMessage message);
92
     #endif // FILAMENT_CHANGE_FEATURE
92
     #endif // FILAMENT_CHANGE_FEATURE
93
 
93
 
94
   #else
94
   #else
156
   inline void lcd_update() {}
156
   inline void lcd_update() {}
157
   inline void lcd_init() {}
157
   inline void lcd_init() {}
158
   inline bool lcd_hasstatus() { return false; }
158
   inline bool lcd_hasstatus() { return false; }
159
-  inline void lcd_setstatus(const char* message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
160
-  inline void lcd_setstatuspgm(const char* message, const uint8_t level=0) { UNUSED(message); UNUSED(level); }
159
+  inline void lcd_setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
160
+  inline void lcd_setstatuspgm(const char* const message, const uint8_t level=0) { UNUSED(message); UNUSED(level); }
161
   inline void lcd_buttons_update() {}
161
   inline void lcd_buttons_update() {}
162
   inline void lcd_reset_alert_level() {}
162
   inline void lcd_reset_alert_level() {}
163
   inline bool lcd_detected() { return true; }
163
   inline bool lcd_detected() { return true; }

+ 25
- 25
Marlin/ultralcd_impl_DOGM.h View File

191
 #define PAGE_UNDER(yb) (u8g.getU8g()->current_page.y0 <= (yb))
191
 #define PAGE_UNDER(yb) (u8g.getU8g()->current_page.y0 <= (yb))
192
 #define PAGE_CONTAINS(ya, yb) (PAGE_UNDER(yb) && u8g.getU8g()->current_page.y1 >= (ya))
192
 #define PAGE_CONTAINS(ya, yb) (PAGE_UNDER(yb) && u8g.getU8g()->current_page.y1 >= (ya))
193
 
193
 
194
-static void lcd_setFont(char font_nr) {
195
-  switch(font_nr) {
194
+static void lcd_setFont(const char font_nr) {
195
+  switch (font_nr) {
196
     case FONT_STATUSMENU : {u8g.setFont(FONT_STATUSMENU_NAME); currentfont = FONT_STATUSMENU;}; break;
196
     case FONT_STATUSMENU : {u8g.setFont(FONT_STATUSMENU_NAME); currentfont = FONT_STATUSMENU;}; break;
197
     case FONT_MENU       : {u8g.setFont(FONT_MENU_NAME); currentfont = FONT_MENU;}; break;
197
     case FONT_MENU       : {u8g.setFont(FONT_MENU_NAME); currentfont = FONT_MENU;}; break;
198
     case FONT_SPECIAL    : {u8g.setFont(FONT_SPECIAL_NAME); currentfont = FONT_SPECIAL;}; break;
198
     case FONT_SPECIAL    : {u8g.setFont(FONT_SPECIAL_NAME); currentfont = FONT_SPECIAL;}; break;
201
   }
201
   }
202
 }
202
 }
203
 
203
 
204
-void lcd_print(char c) {
204
+void lcd_print(const char c) {
205
   if ((c > 0) && (c <= LCD_STR_SPECIAL_MAX)) {
205
   if ((c > 0) && (c <= LCD_STR_SPECIAL_MAX)) {
206
     u8g.setFont(FONT_SPECIAL_NAME);
206
     u8g.setFont(FONT_SPECIAL_NAME);
207
     u8g.print(c);
207
     u8g.print(c);
210
   else charset_mapper(c);
210
   else charset_mapper(c);
211
 }
211
 }
212
 
212
 
213
-char lcd_print_and_count(char c) {
213
+char lcd_print_and_count(const char c) {
214
   if ((c > 0) && (c <= LCD_STR_SPECIAL_MAX)) {
214
   if ((c > 0) && (c <= LCD_STR_SPECIAL_MAX)) {
215
     u8g.setFont(FONT_SPECIAL_NAME);
215
     u8g.setFont(FONT_SPECIAL_NAME);
216
     u8g.print(c);
216
     u8g.print(c);
220
   else return charset_mapper(c);
220
   else return charset_mapper(c);
221
 }
221
 }
222
 
222
 
223
-void lcd_print(const char* str) {
223
+void lcd_print(const char* const str) {
224
   for (uint8_t i = 0; char c = str[i]; ++i) lcd_print(c);
224
   for (uint8_t i = 0; char c = str[i]; ++i) lcd_print(c);
225
 }
225
 }
226
 
226
 
268
       }
268
       }
269
     #endif // SHOW_CUSTOM_BOOTSCREEN
269
     #endif // SHOW_CUSTOM_BOOTSCREEN
270
 
270
 
271
-    int offx = (u8g.getWidth() - (START_BMPWIDTH)) / 2;
271
+    const uint8_t offx = (u8g.getWidth() - (START_BMPWIDTH)) / 2;
272
 
272
 
273
     #if ENABLED(START_BMPHIGH)
273
     #if ENABLED(START_BMPHIGH)
274
-      int offy = 0;
274
+      constexpr uint8_t offy = 0;
275
     #else
275
     #else
276
-      int offy = DOG_CHAR_HEIGHT;
276
+      constexpr uint8_t offy = DOG_CHAR_HEIGHT;
277
     #endif
277
     #endif
278
 
278
 
279
-    int txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1) * (DOG_CHAR_WIDTH)) / 2;
279
+    const uint8_t txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1) * (DOG_CHAR_WIDTH)) / 2;
280
 
280
 
281
     if (show_bootscreen) {
281
     if (show_bootscreen) {
282
       u8g.firstPage();
282
       u8g.firstPage();
286
         #ifndef STRING_SPLASH_LINE2
286
         #ifndef STRING_SPLASH_LINE2
287
           u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT), STRING_SPLASH_LINE1);
287
           u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT), STRING_SPLASH_LINE1);
288
         #else
288
         #else
289
-          int txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1) * (DOG_CHAR_WIDTH)) / 2;
289
+          const uint8_t txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1) * (DOG_CHAR_WIDTH)) / 2;
290
           u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 3 / 2, STRING_SPLASH_LINE1);
290
           u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 3 / 2, STRING_SPLASH_LINE1);
291
           u8g.drawStr(txt2X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 1 / 2, STRING_SPLASH_LINE2);
291
           u8g.drawStr(txt2X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 1 / 2, STRING_SPLASH_LINE2);
292
         #endif
292
         #endif
315
 // Status Screen
315
 // Status Screen
316
 //
316
 //
317
 
317
 
318
-FORCE_INLINE void _draw_centered_temp(int temp, int x, int y) {
319
-  int degsize = 6 * (temp >= 100 ? 3 : temp >= 10 ? 2 : 1); // number's pixel width
318
+FORCE_INLINE void _draw_centered_temp(const int temp, const uint8_t x, const uint8_t y) {
319
+  const uint8_t degsize = 6 * (temp >= 100 ? 3 : temp >= 10 ? 2 : 1); // number's pixel width
320
   u8g.setPrintPos(x - (18 - degsize) / 2, y); // move left if shorter
320
   u8g.setPrintPos(x - (18 - degsize) / 2, y); // move left if shorter
321
   lcd_print(itostr3(temp));
321
   lcd_print(itostr3(temp));
322
   lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
322
   lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
323
 }
323
 }
324
 
324
 
325
-FORCE_INLINE void _draw_heater_status(int x, int heater) {
325
+FORCE_INLINE void _draw_heater_status(const uint8_t x, const int8_t heater) {
326
   #if HAS_TEMP_BED
326
   #if HAS_TEMP_BED
327
     bool isBed = heater < 0;
327
     bool isBed = heater < 0;
328
   #else
328
   #else
336
     _draw_centered_temp((isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)) + 0.5, x, 28);
336
     _draw_centered_temp((isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)) + 0.5, x, 28);
337
 
337
 
338
   if (PAGE_CONTAINS(17, 20)) {
338
   if (PAGE_CONTAINS(17, 20)) {
339
-    uint8_t h = isBed ? 7 : 8,
340
-            y = isBed ? 18 : 17;
339
+    const uint8_t h = isBed ? 7 : 8,
340
+                  y = isBed ? 18 : 17;
341
     if (isBed ? thermalManager.isHeatingBed() : thermalManager.isHeatingHotend(heater)) {
341
     if (isBed ? thermalManager.isHeatingBed() : thermalManager.isHeatingHotend(heater)) {
342
       u8g.setColorIndex(0); // white on black
342
       u8g.setColorIndex(0); // white on black
343
       u8g.drawBox(x + h, y, 2, 2);
343
       u8g.drawBox(x + h, y, 2, 2);
349
   }
349
   }
350
 }
350
 }
351
 
351
 
352
-FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink) {
352
+FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr, const bool blink) {
353
   if (blink)
353
   if (blink)
354
     lcd_printPGM(pstr);
354
     lcd_printPGM(pstr);
355
   else {
355
   else {
611
   uint8_t row_y1, row_y2;
611
   uint8_t row_y1, row_y2;
612
 
612
 
613
   // Set the colors for a menu item based on whether it is selected
613
   // Set the colors for a menu item based on whether it is selected
614
-  static void lcd_implementation_mark_as_selected(uint8_t row, bool isSelected) {
614
+  static void lcd_implementation_mark_as_selected(const uint8_t row, const bool isSelected) {
615
 
615
 
616
     row_y1 = row * (DOG_CHAR_HEIGHT) + 1;
616
     row_y1 = row * (DOG_CHAR_HEIGHT) + 1;
617
     row_y2 = row_y1 + (DOG_CHAR_HEIGHT) - 1;
617
     row_y2 = row_y1 + (DOG_CHAR_HEIGHT) - 1;
632
   #if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE)
632
   #if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE)
633
 
633
 
634
     // Draw a static line of text in the same idiom as a menu item
634
     // Draw a static line of text in the same idiom as a menu item
635
-    static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, bool center=true, bool invert=false, const char* valstr=NULL) {
635
+    static void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char* valstr=NULL) {
636
 
636
 
637
       lcd_implementation_mark_as_selected(row, invert);
637
       lcd_implementation_mark_as_selected(row, invert);
638
 
638
 
659
   #endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
659
   #endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
660
 
660
 
661
   // Draw a generic menu item
661
   // Draw a generic menu item
662
-  static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, const char* pstr, char pre_char, char post_char) {
662
+  static void lcd_implementation_drawmenu_generic(const bool isSelected, const uint8_t row, const char* pstr, const char pre_char, const char post_char) {
663
     UNUSED(pre_char);
663
     UNUSED(pre_char);
664
 
664
 
665
     lcd_implementation_mark_as_selected(row, isSelected);
665
     lcd_implementation_mark_as_selected(row, isSelected);
684
   #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
684
   #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
685
 
685
 
686
   // Draw a menu item with an editable value
686
   // Draw a menu item with an editable value
687
-  static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const char* pstr, const char* data, bool pgm) {
687
+  static void _drawmenu_setting_edit_generic(const bool isSelected, const uint8_t row, const char* pstr, const char* const data, const bool pgm) {
688
 
688
 
689
     lcd_implementation_mark_as_selected(row, isSelected);
689
     lcd_implementation_mark_as_selected(row, isSelected);
690
 
690
 
729
   #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, ftostr5rj(*(data)))
729
   #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, ftostr5rj(*(data)))
730
   #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))
730
   #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))
731
 
731
 
732
-  void lcd_implementation_drawedit(const char* pstr, const char* value=NULL) {
732
+  void lcd_implementation_drawedit(const char* const pstr, const char* const value=NULL) {
733
+    const uint8_t labellen = lcd_strlen_P(pstr), vallen = lcd_strlen(value);
733
     uint8_t lcd_width, char_width,
734
     uint8_t lcd_width, char_width,
734
-            labellen = lcd_strlen_P(pstr), vallen = lcd_strlen(value),
735
             rows = (labellen > LCD_WIDTH - 2 - vallen) ? 2 : 1;
735
             rows = (labellen > LCD_WIDTH - 2 - vallen) ? 2 : 1;
736
 
736
 
737
     #if ENABLED(USE_BIG_EDIT_FONT)
737
     #if ENABLED(USE_BIG_EDIT_FONT)
752
     #endif
752
     #endif
753
 
753
 
754
     // Center either one or two rows
754
     // Center either one or two rows
755
-    uint8_t segmentHeight = u8g.getHeight() / (rows + 1), // 1 / (rows+1) = 1/2 or 1/3
756
-            baseline = segmentHeight + (DOG_CHAR_HEIGHT_EDIT + 1) / 2;
755
+    const uint8_t segmentHeight = u8g.getHeight() / (rows + 1); // 1 / (rows+1) = 1/2 or 1/3
756
+    uint8_t baseline = segmentHeight + (DOG_CHAR_HEIGHT_EDIT + 1) / 2;
757
 
757
 
758
     if (PAGE_CONTAINS(baseline + 1 - (DOG_CHAR_HEIGHT_EDIT), baseline)) {
758
     if (PAGE_CONTAINS(baseline + 1 - (DOG_CHAR_HEIGHT_EDIT), baseline)) {
759
       u8g.setPrintPos(0, baseline);
759
       u8g.setPrintPos(0, baseline);
772
 
772
 
773
   #if ENABLED(SDSUPPORT)
773
   #if ENABLED(SDSUPPORT)
774
 
774
 
775
-    static void _drawmenu_sd(bool isSelected, uint8_t row, const char* pstr, const char* filename, char* const longFilename, bool isDir) {
775
+    static void _drawmenu_sd(const bool isSelected, const uint8_t row, const char* const pstr, const char* filename, char* const longFilename, const bool isDir) {
776
       UNUSED(pstr);
776
       UNUSED(pstr);
777
 
777
 
778
       lcd_implementation_mark_as_selected(row, isSelected);
778
       lcd_implementation_mark_as_selected(row, isSelected);

+ 16
- 16
Marlin/ultralcd_impl_HD44780.h View File

195
 
195
 
196
 static void lcd_set_custom_characters(
196
 static void lcd_set_custom_characters(
197
   #if ENABLED(LCD_PROGRESS_BAR)
197
   #if ENABLED(LCD_PROGRESS_BAR)
198
-    bool info_screen_charset = true
198
+    const bool info_screen_charset = true
199
   #endif
199
   #endif
200
 ) {
200
 ) {
201
   static byte bedTemp[8] = {
201
   static byte bedTemp[8] = {
341
 
341
 
342
 static void lcd_implementation_init(
342
 static void lcd_implementation_init(
343
   #if ENABLED(LCD_PROGRESS_BAR)
343
   #if ENABLED(LCD_PROGRESS_BAR)
344
-    bool info_screen_charset = true
344
+    const bool info_screen_charset = true
345
   #endif
345
   #endif
346
 ) {
346
 ) {
347
 
347
 
385
   for (; char c = pgm_read_byte(str); ++str) charset_mapper(c);
385
   for (; char c = pgm_read_byte(str); ++str) charset_mapper(c);
386
 }
386
 }
387
 
387
 
388
-void lcd_print(const char* str) {
388
+void lcd_print(const char* const str) {
389
   for (uint8_t i = 0; char c = str[i]; ++i) charset_mapper(c);
389
   for (uint8_t i = 0; char c = str[i]; ++i) charset_mapper(c);
390
 }
390
 }
391
 
391
 
393
 
393
 
394
 #if ENABLED(SHOW_BOOTSCREEN)
394
 #if ENABLED(SHOW_BOOTSCREEN)
395
 
395
 
396
-  void lcd_erase_line(int line) {
396
+  void lcd_erase_line(const int line) {
397
     lcd.setCursor(0, line);
397
     lcd.setCursor(0, line);
398
-    for (int i = 0; i < LCD_WIDTH; i++)
398
+    for (uint8_t i = LCD_WIDTH + 1; --i;)
399
       lcd_print(' ');
399
       lcd_print(' ');
400
   }
400
   }
401
 
401
 
402
   // Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
402
   // Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
403
-  void lcd_scroll(int col, int line, const char* text, int len, int time) {
403
+  void lcd_scroll(const int col, const int line, const char* const text, const int len, const int time) {
404
     char tmp[LCD_WIDTH + 1] = {0};
404
     char tmp[LCD_WIDTH + 1] = {0};
405
     int n = max(lcd_strlen_P(text) - len, 0);
405
     int n = max(lcd_strlen_P(text) - len, 0);
406
     for (int i = 0; i <= n; i++) {
406
     for (int i = 0; i <= n; i++) {
411
     }
411
     }
412
   }
412
   }
413
 
413
 
414
-  static void logo_lines(const char *extra) {
414
+  static void logo_lines(const char* const extra) {
415
     int indent = (LCD_WIDTH - 8 - lcd_strlen_P(extra)) / 2;
415
     int indent = (LCD_WIDTH - 8 - lcd_strlen_P(extra)) / 2;
416
     lcd.setCursor(indent, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------" ));  lcd.print('\x01');
416
     lcd.setCursor(indent, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------" ));  lcd.print('\x01');
417
     lcd.setCursor(indent, 1);                    lcd_printPGM(PSTR("|Marlin|"));  lcd_printPGM(extra);
417
     lcd.setCursor(indent, 1);                    lcd_printPGM(PSTR("|Marlin|"));  lcd_printPGM(extra);
552
   lcd_printPGM(PSTR(MSG_PLEASE_RESET));
552
   lcd_printPGM(PSTR(MSG_PLEASE_RESET));
553
 }
553
 }
554
 
554
 
555
-FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink) {
555
+FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr, const bool blink) {
556
   if (blink)
556
   if (blink)
557
     lcd_printPGM(pstr);
557
     lcd_printPGM(pstr);
558
   else {
558
   else {
794
 
794
 
795
   #if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE)
795
   #if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE)
796
 
796
 
797
-    static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, bool center=true, bool invert=false, const char *valstr=NULL) {
797
+    static void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char *valstr=NULL) {
798
       UNUSED(invert);
798
       UNUSED(invert);
799
       char c;
799
       char c;
800
       int8_t n = LCD_WIDTH;
800
       int8_t n = LCD_WIDTH;
816
 
816
 
817
   #endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
817
   #endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
818
 
818
 
819
-  static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) {
819
+  static void lcd_implementation_drawmenu_generic(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char post_char) {
820
     char c;
820
     char c;
821
     uint8_t n = LCD_WIDTH - 2;
821
     uint8_t n = LCD_WIDTH - 2;
822
     lcd.setCursor(0, row);
822
     lcd.setCursor(0, row);
829
     lcd.print(post_char);
829
     lcd.print(post_char);
830
   }
830
   }
831
 
831
 
832
-  static void lcd_implementation_drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char* data) {
832
+  static void lcd_implementation_drawmenu_setting_edit_generic(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char* const data) {
833
     char c;
833
     char c;
834
     uint8_t n = LCD_WIDTH - 2 - lcd_strlen(data);
834
     uint8_t n = LCD_WIDTH - 2 - lcd_strlen(data);
835
     lcd.setCursor(0, row);
835
     lcd.setCursor(0, row);
842
     while (n--) lcd.print(' ');
842
     while (n--) lcd.print(' ');
843
     lcd_print(data);
843
     lcd_print(data);
844
   }
844
   }
845
-  static void lcd_implementation_drawmenu_setting_edit_generic_P(bool sel, uint8_t row, const char* pstr, char pre_char, const char* data) {
845
+  static void lcd_implementation_drawmenu_setting_edit_generic_P(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char* const data) {
846
     char c;
846
     char c;
847
     uint8_t n = LCD_WIDTH - 2 - lcd_strlen_P(data);
847
     uint8_t n = LCD_WIDTH - 2 - lcd_strlen_P(data);
848
     lcd.setCursor(0, row);
848
     lcd.setCursor(0, row);
879
   #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, '>', ftostr5rj(*(data)))
879
   #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, '>', ftostr5rj(*(data)))
880
   #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))
880
   #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))
881
 
881
 
882
-  void lcd_implementation_drawedit(const char* pstr, const char* value=NULL) {
882
+  void lcd_implementation_drawedit(const char* pstr, const char* const value=NULL) {
883
     lcd.setCursor(1, 1);
883
     lcd.setCursor(1, 1);
884
     lcd_printPGM(pstr);
884
     lcd_printPGM(pstr);
885
     if (value != NULL) {
885
     if (value != NULL) {
891
 
891
 
892
   #if ENABLED(SDSUPPORT)
892
   #if ENABLED(SDSUPPORT)
893
 
893
 
894
-    static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename, uint8_t concat, char post_char) {
894
+    static void lcd_implementation_drawmenu_sd(const bool sel, const uint8_t row, const char* const pstr, const char* filename, char* const longFilename, const uint8_t concat, const char post_char) {
895
       UNUSED(pstr);
895
       UNUSED(pstr);
896
       char c;
896
       char c;
897
       uint8_t n = LCD_WIDTH - concat;
897
       uint8_t n = LCD_WIDTH - concat;
909
       lcd.print(post_char);
909
       lcd.print(post_char);
910
     }
910
     }
911
 
911
 
912
-    static void lcd_implementation_drawmenu_sdfile(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
912
+    static void lcd_implementation_drawmenu_sdfile(const bool sel, const uint8_t row, const char* pstr, const char* filename, char* const longFilename) {
913
       lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, ' ');
913
       lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, ' ');
914
     }
914
     }
915
 
915
 
916
-    static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
916
+    static void lcd_implementation_drawmenu_sddirectory(const bool sel, const uint8_t row, const char* pstr, const char* filename, char* const longFilename) {
917
       lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, LCD_STR_FOLDER[0]);
917
       lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, LCD_STR_FOLDER[0]);
918
     }
918
     }
919
 
919
 

+ 7
- 7
Marlin/utf_mapper.h View File

150
 
150
 
151
 #if ENABLED(MAPPER_C2C3)
151
 #if ENABLED(MAPPER_C2C3)
152
 
152
 
153
-  char charset_mapper(char c) {
153
+  char charset_mapper(const char c) {
154
     static uint8_t utf_hi_char; // UTF-8 high part
154
     static uint8_t utf_hi_char; // UTF-8 high part
155
     static bool seen_c2 = false;
155
     static bool seen_c2 = false;
156
     uint8_t d = c;
156
     uint8_t d = c;
181
 
181
 
182
 #elif ENABLED(MAPPER_CECF)
182
 #elif ENABLED(MAPPER_CECF)
183
 
183
 
184
-  char charset_mapper(char c) {
184
+  char charset_mapper(const char c) {
185
     static uint8_t utf_hi_char; // UTF-8 high part
185
     static uint8_t utf_hi_char; // UTF-8 high part
186
     static bool seen_ce = false;
186
     static bool seen_ce = false;
187
     uint8_t d = c;
187
     uint8_t d = c;
212
 
212
 
213
 #elif ENABLED(MAPPER_CECF)
213
 #elif ENABLED(MAPPER_CECF)
214
 
214
 
215
-  char charset_mapper(char c) {
215
+  char charset_mapper(const char c) {
216
     static uint8_t utf_hi_char; // UTF-8 high part
216
     static uint8_t utf_hi_char; // UTF-8 high part
217
     static bool seen_ce = false;
217
     static bool seen_ce = false;
218
     uint8_t d = c;
218
     uint8_t d = c;
243
 
243
 
244
 #elif ENABLED(MAPPER_D0D1_MOD)
244
 #elif ENABLED(MAPPER_D0D1_MOD)
245
 
245
 
246
-  char charset_mapper(char c) {
246
+  char charset_mapper(const char c) {
247
     // it is a Russian alphabet translation
247
     // it is a Russian alphabet translation
248
     // except 0401 --> 0xa2 = Ё, 0451 --> 0xb5 = ё
248
     // except 0401 --> 0xa2 = Ё, 0451 --> 0xb5 = ё
249
     static uint8_t utf_hi_char; // UTF-8 high part
249
     static uint8_t utf_hi_char; // UTF-8 high part
280
 
280
 
281
 #elif ENABLED(MAPPER_D0D1)
281
 #elif ENABLED(MAPPER_D0D1)
282
 
282
 
283
-  char charset_mapper(char c) {
283
+  char charset_mapper(const char c) {
284
     static uint8_t utf_hi_char; // UTF-8 high part
284
     static uint8_t utf_hi_char; // UTF-8 high part
285
     static bool seen_d5 = false;
285
     static bool seen_d5 = false;
286
     uint8_t d = c;
286
     uint8_t d = c;
311
 
311
 
312
 #elif ENABLED(MAPPER_E382E383)
312
 #elif ENABLED(MAPPER_E382E383)
313
 
313
 
314
-  char charset_mapper(char c) {
314
+  char charset_mapper(const char c) {
315
     static uint8_t utf_hi_char; // UTF-8 high part
315
     static uint8_t utf_hi_char; // UTF-8 high part
316
     static bool seen_e3 = false;
316
     static bool seen_e3 = false;
317
     static bool seen_82_83 = false;
317
     static bool seen_82_83 = false;
350
 
350
 
351
   #define MAPPER_NON
351
   #define MAPPER_NON
352
 
352
 
353
-  char charset_mapper(char c) {
353
+  char charset_mapper(const char c) {
354
     HARDWARE_CHAR_OUT( c );
354
     HARDWARE_CHAR_OUT( c );
355
     return 1;
355
     return 1;
356
   }
356
   }

Loading…
Cancel
Save