Browse Source

Merge pull request #6922 from thinkyhead/bf_probe_options

Prevent illegal leveling combinations
Scott Lahteine 7 years ago
parent
commit
ac33a378c0

+ 5
- 2
Marlin/Conditionals_LCD.h View File

@@ -101,12 +101,15 @@
101 101
   #if ENABLED(ULTIMAKERCONTROLLER)              \
102 102
    || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) \
103 103
    || ENABLED(G3D_PANEL)                        \
104
-   || ENABLED(RIGIDBOT_PANEL)                   \
105
-   || ENABLED(REPRAPWORLD_KEYPAD)
104
+   || ENABLED(RIGIDBOT_PANEL)
106 105
     #define ULTIPANEL
107 106
     #define NEWPANEL
108 107
   #endif
109 108
 
109
+  #if ENABLED(REPRAPWORLD_KEYPAD)
110
+    #define NEWPANEL
111
+  #endif
112
+
110 113
   #if ENABLED(RA_CONTROL_PANEL)
111 114
     #define LCD_I2C_TYPE_PCA8574
112 115
     #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander

+ 5
- 0
Marlin/Conditionals_post.h View File

@@ -847,4 +847,9 @@
847 847
   // Add commands that need sub-codes to this list
848 848
   #define USE_GCODE_SUBCODES ENABLED(G38_PROBE_TARGET)
849 849
 
850
+  // MESH_BED_LEVELING overrides PROBE_MANUALLY
851
+  #if ENABLED(MESH_BED_LEVELING)
852
+    #undef PROBE_MANUALLY
853
+  #endif
854
+
850 855
 #endif // CONDITIONALS_POST_H

+ 8
- 4
Marlin/SanityCheck.h View File

@@ -319,11 +319,11 @@
319 319
  * Advanced Pause
320 320
  */
321 321
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
322
-  #if DISABLED(ULTIPANEL)
322
+  #if DISABLED(NEWPANEL)
323 323
     #error "ADVANCED_PAUSE_FEATURE currently requires an LCD controller."
324 324
   #elif ENABLED(EXTRUDER_RUNOUT_PREVENT)
325 325
     #error "EXTRUDER_RUNOUT_PREVENT is incompatible with ADVANCED_PAUSE_FEATURE."
326
-  #elif ENABLED(PARK_HEAD_ON_PAUSE) && DISABLED(SDSUPPORT) && DISABLED(ULTIPANEL) && DISABLED(EMERGENCY_PARSER)
326
+  #elif ENABLED(PARK_HEAD_ON_PAUSE) && DISABLED(SDSUPPORT) && DISABLED(NEWPANEL) && DISABLED(EMERGENCY_PARSER)
327 327
     #error "PARK_HEAD_ON_PAUSE requires SDSUPPORT, EMERGENCY_PARSER, or an LCD controller."
328 328
   #endif
329 329
 #endif
@@ -598,8 +598,12 @@ static_assert(1 >= 0
598 598
 /**
599 599
  * LCD_BED_LEVELING requirements
600 600
  */
601
-#if ENABLED(LCD_BED_LEVELING) && DISABLED(MESH_BED_LEVELING) && !(HAS_ABL && ENABLED(PROBE_MANUALLY))
602
-  #error "LCD_BED_LEVELING requires MESH_BED_LEVELING or PROBE_MANUALLY."
601
+#if ENABLED(LCD_BED_LEVELING)
602
+  #if DISABLED(ULTIPANEL)
603
+    #error "LCD_BED_LEVELING requires an LCD controller."
604
+  #elif DISABLED(MESH_BED_LEVELING) && !(HAS_ABL && ENABLED(PROBE_MANUALLY))
605
+    #error "LCD_BED_LEVELING requires MESH_BED_LEVELING or PROBE_MANUALLY."
606
+  #endif
603 607
 #endif
604 608
 
605 609
 /**

+ 0
- 1
Marlin/macros.h View File

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

+ 21
- 29
Marlin/ultralcd.cpp View File

@@ -3885,11 +3885,7 @@ void lcd_init() {
3885 3885
 int lcd_strlen(const char* s) {
3886 3886
   int i = 0, j = 0;
3887 3887
   while (s[i]) {
3888
-    #if ENABLED(MAPPER_NON)
3889
-      j++;
3890
-    #else
3891
-      if (PRINTABLE(s[i])) j++;
3892
-    #endif
3888
+    if (PRINTABLE(s[i])) j++;
3893 3889
     i++;
3894 3890
   }
3895 3891
   return j;
@@ -3898,11 +3894,7 @@ int lcd_strlen(const char* s) {
3898 3894
 int lcd_strlen_P(const char* s) {
3899 3895
   int j = 0;
3900 3896
   while (pgm_read_byte(s)) {
3901
-    #if ENABLED(MAPPER_NON)
3902
-      j++;
3903
-    #else
3904
-      if (PRINTABLE(pgm_read_byte(s))) j++;
3905
-    #endif
3897
+    if (PRINTABLE(pgm_read_byte(s))) j++;
3906 3898
     s++;
3907 3899
   }
3908 3900
   return j;
@@ -4162,28 +4154,28 @@ void lcd_update() {
4162 4154
   } // ELAPSED(ms, next_lcd_update_ms)
4163 4155
 }
4164 4156
 
4165
-#if DISABLED(STATUS_MESSAGE_SCROLLING)
4166
-
4167
-  void set_utf_strlen(char* s, uint8_t n) {
4168
-    uint8_t i = 0, j = 0;
4169
-    while (s[i] && (j < n)) {
4170
-      #if ENABLED(MAPPER_NON)
4171
-        j++;
4172
-      #else
4173
-        if (PRINTABLE(s[i])) j++;
4174
-      #endif
4175
-      i++;
4176
-    }
4177
-    while (j++ < n) s[i++] = ' ';
4178
-    s[i] = '\0';
4157
+void pad_message_string() {
4158
+  uint8_t i = 0, j = 0;
4159
+  char c;
4160
+  while ((c = lcd_status_message[i]) && j < LCD_WIDTH) {
4161
+    if (PRINTABLE(c)) j++;
4162
+    i++;
4179 4163
   }
4180
-
4181
-#endif // !STATUS_MESSAGE_SCROLLING
4164
+  if (true
4165
+    #if ENABLED(STATUS_MESSAGE_SCROLLING)
4166
+      && j < LCD_WIDTH
4167
+    #endif
4168
+  ) {
4169
+    // pad with spaces to fill up the line
4170
+    while (j++ < LCD_WIDTH) lcd_status_message[i++] = ' ';
4171
+    // chop off at the edge
4172
+    lcd_status_message[i] = '\0';
4173
+  }
4174
+}
4182 4175
 
4183 4176
 void lcd_finishstatus(bool persist=false) {
4184
-  #if DISABLED(STATUS_MESSAGE_SCROLLING)
4185
-    set_utf_strlen(lcd_status_message, LCD_WIDTH);
4186
-  #endif
4177
+
4178
+  pad_message_string();
4187 4179
 
4188 4180
   #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
4189 4181
     UNUSED(persist);

+ 6
- 8
Marlin/ultralcd_impl_DOGM.h View File

@@ -239,19 +239,17 @@ char lcd_print_and_count(const char c) {
239 239
  * On DOGM all strings go through a filter for utf
240 240
  * But only use lcd_print_utf and lcd_printPGM_utf for translated text
241 241
  */
242
-void lcd_print(const char* const str) { for (uint8_t i = 0; char c = str[i]; ++i) lcd_print(c); }
243
-void lcd_printPGM(const char* str) { for (; char c = pgm_read_byte(str); ++str) lcd_print(c); }
242
+void lcd_print(const char *str) { while (*str) lcd_print(*str++); }
243
+void lcd_printPGM(const char *str) { while (const char c = pgm_read_byte(str)) lcd_print(c), ++str; }
244 244
 
245
-void lcd_print_utf(const char* const str, const uint8_t maxLength=LCD_WIDTH) {
245
+void lcd_print_utf(const char *str, uint8_t n=LCD_WIDTH) {
246 246
   char c;
247
-  for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
248
-    n -= charset_mapper(c);
247
+  while (n && (c = *str)) n -= charset_mapper(c), ++str;
249 248
 }
250 249
 
251
-void lcd_printPGM_utf(const char* str, const uint8_t maxLength=LCD_WIDTH) {
250
+void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) {
252 251
   char c;
253
-  for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
254
-    n -= charset_mapper(c);
252
+  while (n && (c = pgm_read_byte(str))) n -= charset_mapper(c), ++str;
255 253
 }
256 254
 
257 255
 // Initialize or re-initialize the LCD

+ 6
- 8
Marlin/ultralcd_impl_HD44780.h View File

@@ -382,19 +382,17 @@ void lcd_implementation_clear() { lcd.clear(); }
382 382
 
383 383
 void lcd_print(const char c) { charset_mapper(c); }
384 384
 
385
-void lcd_print(const char * const str) { for (uint8_t i = 0; char c = str[i]; ++i) lcd.print(c); }
386
-void lcd_printPGM(const char* str) { for (; char c = pgm_read_byte(str); ++str) lcd.print(c); }
385
+void lcd_print(const char *str) { while (*str) lcd.print(*str++); }
386
+void lcd_printPGM(const char *str) { while (const char c = pgm_read_byte(str)) lcd.print(c), ++str; }
387 387
 
388
-void lcd_print_utf(const char * const str, const uint8_t maxLength=LCD_WIDTH) {
388
+void lcd_print_utf(const char *str, uint8_t n=LCD_WIDTH) {
389 389
   char c;
390
-  for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
391
-    n -= charset_mapper(c);
390
+  while (n && (c = *str)) n -= charset_mapper(c), ++str;
392 391
 }
393 392
 
394
-void lcd_printPGM_utf(const char* str, const uint8_t maxLength=LCD_WIDTH) {
393
+void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) {
395 394
   char c;
396
-  for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
397
-    n -= charset_mapper(c);
395
+  while (n && (c = pgm_read_byte(str))) n -= charset_mapper(c), ++str;
398 396
 }
399 397
 
400 398
 #if ENABLED(SHOW_BOOTSCREEN)

+ 7
- 2
Marlin/utf_mapper.h View File

@@ -23,7 +23,7 @@
23 23
 #ifndef UTF_MAPPER_H
24 24
 #define UTF_MAPPER_H
25 25
 
26
-#include  "language.h"
26
+#include "language.h"
27 27
 
28 28
 #if ENABLED(DOGLCD)
29 29
   #define HARDWARE_CHAR_OUT u8g.print
@@ -144,6 +144,8 @@
144 144
   #endif // DISPLAY_CHARSET_HD44780
145 145
 #endif // SIMULATE_ROMFONT
146 146
 
147
+#define PRINTABLE(C) (((C) & 0xC0u) != 0x80u)
148
+
147 149
 #if ENABLED(MAPPER_C2C3)
148 150
 
149 151
   char charset_mapper(const char c) {
@@ -466,8 +468,11 @@
466 468
 
467 469
   #define MAPPER_NON
468 470
 
471
+  #undef PRINTABLE
472
+  #define PRINTABLE(C) true
473
+
469 474
   char charset_mapper(const char c) {
470
-    HARDWARE_CHAR_OUT( c );
475
+    HARDWARE_CHAR_OUT(c);
471 476
     return 1;
472 477
   }
473 478
 

Loading…
Cancel
Save