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

+ 5
- 0
Marlin/Conditionals_post.h View File

847
   // Add commands that need sub-codes to this list
847
   // Add commands that need sub-codes to this list
848
   #define USE_GCODE_SUBCODES ENABLED(G38_PROBE_TARGET)
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
 #endif // CONDITIONALS_POST_H
855
 #endif // CONDITIONALS_POST_H

+ 8
- 4
Marlin/SanityCheck.h View File

319
  * Advanced Pause
319
  * Advanced Pause
320
  */
320
  */
321
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
321
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
322
-  #if DISABLED(ULTIPANEL)
322
+  #if DISABLED(NEWPANEL)
323
     #error "ADVANCED_PAUSE_FEATURE currently requires an LCD controller."
323
     #error "ADVANCED_PAUSE_FEATURE currently requires an LCD controller."
324
   #elif ENABLED(EXTRUDER_RUNOUT_PREVENT)
324
   #elif ENABLED(EXTRUDER_RUNOUT_PREVENT)
325
     #error "EXTRUDER_RUNOUT_PREVENT is incompatible with ADVANCED_PAUSE_FEATURE."
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
     #error "PARK_HEAD_ON_PAUSE requires SDSUPPORT, EMERGENCY_PARSER, or an LCD controller."
327
     #error "PARK_HEAD_ON_PAUSE requires SDSUPPORT, EMERGENCY_PARSER, or an LCD controller."
328
   #endif
328
   #endif
329
 #endif
329
 #endif
598
 /**
598
 /**
599
  * LCD_BED_LEVELING requirements
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
 #endif
607
 #endif
604
 
608
 
605
 /**
609
 /**

+ 0
- 1
Marlin/macros.h View File

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)
131
 #define COUNT(a) (sizeof(a)/sizeof(*a))
130
 #define COUNT(a) (sizeof(a)/sizeof(*a))
132
 #define ZERO(a) memset(a,0,sizeof(a))
131
 #define ZERO(a) memset(a,0,sizeof(a))
133
 #define COPY(a,b) memcpy(a,b,min(sizeof(a),sizeof(b)))
132
 #define COPY(a,b) memcpy(a,b,min(sizeof(a),sizeof(b)))

+ 21
- 29
Marlin/ultralcd.cpp View File

3885
 int lcd_strlen(const char* s) {
3885
 int lcd_strlen(const char* s) {
3886
   int i = 0, j = 0;
3886
   int i = 0, j = 0;
3887
   while (s[i]) {
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
     i++;
3889
     i++;
3894
   }
3890
   }
3895
   return j;
3891
   return j;
3898
 int lcd_strlen_P(const char* s) {
3894
 int lcd_strlen_P(const char* s) {
3899
   int j = 0;
3895
   int j = 0;
3900
   while (pgm_read_byte(s)) {
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
     s++;
3898
     s++;
3907
   }
3899
   }
3908
   return j;
3900
   return j;
4162
   } // ELAPSED(ms, next_lcd_update_ms)
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
 void lcd_finishstatus(bool persist=false) {
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
   #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
4180
   #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
4189
     UNUSED(persist);
4181
     UNUSED(persist);

+ 6
- 8
Marlin/ultralcd_impl_DOGM.h View File

239
  * On DOGM all strings go through a filter for utf
239
  * On DOGM all strings go through a filter for utf
240
  * But only use lcd_print_utf and lcd_printPGM_utf for translated text
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
   char c;
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
   char c;
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
 // Initialize or re-initialize the LCD
255
 // Initialize or re-initialize the LCD

+ 6
- 8
Marlin/ultralcd_impl_HD44780.h View File

382
 
382
 
383
 void lcd_print(const char c) { charset_mapper(c); }
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
   char c;
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
   char c;
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
 #if ENABLED(SHOW_BOOTSCREEN)
398
 #if ENABLED(SHOW_BOOTSCREEN)

+ 7
- 2
Marlin/utf_mapper.h View File

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

Loading…
Cancel
Save