瀏覽代碼

Merge pull request #6897 from thinkyhead/bf_fix_lcd_scrolling

Fix LCD scrolling character counting
Scott Lahteine 8 年之前
父節點
當前提交
d33ae33103
共有 4 個檔案被更改,包括 14 行新增13 行删除
  1. 1
    0
      Marlin/macros.h
  2. 3
    3
      Marlin/ultralcd.cpp
  3. 1
    1
      Marlin/ultralcd_impl_DOGM.h
  4. 9
    9
      Marlin/ultralcd_impl_HD44780.h

+ 1
- 0
Marlin/macros.h 查看文件

127
 #define DECIMAL(a) (NUMERIC(a) || a == '.')
127
 #define DECIMAL(a) (NUMERIC(a) || a == '.')
128
 #define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-' || (a) == '+')
128
 #define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-' || (a) == '+')
129
 #define DECIMAL_SIGNED(a) (DECIMAL(a) || (a) == '-' || (a) == '+')
129
 #define DECIMAL_SIGNED(a) (DECIMAL(a) || (a) == '-' || (a) == '+')
130
+#define PRINTABLE(C) (((C) & 0xC0u) != 0x80u)
130
 #define COUNT(a) (sizeof(a)/sizeof(*a))
131
 #define COUNT(a) (sizeof(a)/sizeof(*a))
131
 #define ZERO(a) memset(a,0,sizeof(a))
132
 #define ZERO(a) memset(a,0,sizeof(a))
132
 #define COPY(a,b) memcpy(a,b,min(sizeof(a),sizeof(b)))
133
 #define COPY(a,b) memcpy(a,b,min(sizeof(a),sizeof(b)))

+ 3
- 3
Marlin/ultralcd.cpp 查看文件

3814
     #if ENABLED(MAPPER_NON)
3814
     #if ENABLED(MAPPER_NON)
3815
       j++;
3815
       j++;
3816
     #else
3816
     #else
3817
-      if ((s[i] & 0xC0u) != 0x80u) j++;
3817
+      if (PRINTABLE(s[i])) j++;
3818
     #endif
3818
     #endif
3819
     i++;
3819
     i++;
3820
   }
3820
   }
3827
     #if ENABLED(MAPPER_NON)
3827
     #if ENABLED(MAPPER_NON)
3828
       j++;
3828
       j++;
3829
     #else
3829
     #else
3830
-      if ((pgm_read_byte(s) & 0xC0u) != 0x80u) j++;
3830
+      if (PRINTABLE(pgm_read_byte(s))) j++;
3831
     #endif
3831
     #endif
3832
     s++;
3832
     s++;
3833
   }
3833
   }
4096
       #if ENABLED(MAPPER_NON)
4096
       #if ENABLED(MAPPER_NON)
4097
         j++;
4097
         j++;
4098
       #else
4098
       #else
4099
-        if ((s[i] & 0xC0u) != 0x80u) j++;
4099
+        if (PRINTABLE(s[i])) j++;
4100
       #endif
4100
       #endif
4101
       i++;
4101
       i++;
4102
     }
4102
     }

+ 1
- 1
Marlin/ultralcd_impl_DOGM.h 查看文件

412
     const uint8_t slen = lcd_strlen(lcd_status_message);
412
     const uint8_t slen = lcd_strlen(lcd_status_message);
413
     if (slen > LCD_WIDTH) {
413
     if (slen > LCD_WIDTH) {
414
       // Skip any non-printing bytes
414
       // Skip any non-printing bytes
415
-      while (!charset_mapper(lcd_status_message[status_scroll_pos])) ++status_scroll_pos;
415
+      while (!PRINTABLE(lcd_status_message[status_scroll_pos])) ++status_scroll_pos;
416
       if (++status_scroll_pos > slen - LCD_WIDTH) status_scroll_pos = 0;
416
       if (++status_scroll_pos > slen - LCD_WIDTH) status_scroll_pos = 0;
417
     }
417
     }
418
   #else
418
   #else

+ 9
- 9
Marlin/ultralcd_impl_HD44780.h 查看文件

582
 FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, const bool blink) {
582
 FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, const bool blink) {
583
   const bool isBed = heater < 0;
583
   const bool isBed = heater < 0;
584
 
584
 
585
-  const float t1 = (isBed ? thermalManager.degBed() : thermalManager.degHotend(heater));
586
-  const float t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater));
585
+  const float t1 = (isBed ? thermalManager.degBed()       : thermalManager.degHotend(heater)),
586
+              t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater));
587
 
587
 
588
   if (prefix >= 0) lcd.print(prefix);
588
   if (prefix >= 0) lcd.print(prefix);
589
 
589
 
592
 
592
 
593
   #if ENABLED(ADVANCED_PAUSE_FEATURE)
593
   #if ENABLED(ADVANCED_PAUSE_FEATURE)
594
     const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) :
594
     const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) :
595
-    #if HAS_TEMP_BED
596
-      thermalManager.is_bed_idle()
597
-    #else
598
-      false
599
-    #endif
595
+      #if HAS_TEMP_BED
596
+        thermalManager.is_bed_idle()
597
+      #else
598
+        false
599
+      #endif
600
     );
600
     );
601
 
601
 
602
     if (!blink && is_idle) {
602
     if (!blink && is_idle) {
606
     }
606
     }
607
     else
607
     else
608
   #endif
608
   #endif
609
-  lcd.print(itostr3left(t2 + 0.5));
609
+      lcd.print(itostr3left(t2 + 0.5));
610
 
610
 
611
   if (prefix >= 0) {
611
   if (prefix >= 0) {
612
     lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
612
     lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
831
     const uint8_t slen = lcd_strlen(lcd_status_message);
831
     const uint8_t slen = lcd_strlen(lcd_status_message);
832
     if (slen > LCD_WIDTH) {
832
     if (slen > LCD_WIDTH) {
833
       // Skip any non-printing bytes
833
       // Skip any non-printing bytes
834
-      while (!charset_mapper(lcd_status_message[status_scroll_pos])) ++status_scroll_pos;
834
+      while (!PRINTABLE(lcd_status_message[status_scroll_pos])) ++status_scroll_pos;
835
       if (++status_scroll_pos > slen - LCD_WIDTH) status_scroll_pos = 0;
835
       if (++status_scroll_pos > slen - LCD_WIDTH) status_scroll_pos = 0;
836
     }
836
     }
837
   #else
837
   #else

Loading…
取消
儲存