Merge pull request #6922 from thinkyhead/bf_probe_options

Prevent illegal leveling combinations
This commit is contained in:
Scott Lahteine 2017-06-01 11:12:02 -05:00 committed by GitHub
commit ac33a378c0
8 changed files with 58 additions and 54 deletions

View File

@ -101,12 +101,15 @@
#if ENABLED(ULTIMAKERCONTROLLER) \ #if ENABLED(ULTIMAKERCONTROLLER) \
|| ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) \ || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) \
|| ENABLED(G3D_PANEL) \ || ENABLED(G3D_PANEL) \
|| ENABLED(RIGIDBOT_PANEL) \ || ENABLED(RIGIDBOT_PANEL)
|| ENABLED(REPRAPWORLD_KEYPAD)
#define ULTIPANEL #define ULTIPANEL
#define NEWPANEL #define NEWPANEL
#endif #endif
#if ENABLED(REPRAPWORLD_KEYPAD)
#define NEWPANEL
#endif
#if ENABLED(RA_CONTROL_PANEL) #if ENABLED(RA_CONTROL_PANEL)
#define LCD_I2C_TYPE_PCA8574 #define LCD_I2C_TYPE_PCA8574
#define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander

View File

@ -847,4 +847,9 @@
// Add commands that need sub-codes to this list // Add commands that need sub-codes to this list
#define USE_GCODE_SUBCODES ENABLED(G38_PROBE_TARGET) #define USE_GCODE_SUBCODES ENABLED(G38_PROBE_TARGET)
// MESH_BED_LEVELING overrides PROBE_MANUALLY
#if ENABLED(MESH_BED_LEVELING)
#undef PROBE_MANUALLY
#endif
#endif // CONDITIONALS_POST_H #endif // CONDITIONALS_POST_H

View File

@ -319,11 +319,11 @@
* Advanced Pause * Advanced Pause
*/ */
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
#if DISABLED(ULTIPANEL) #if DISABLED(NEWPANEL)
#error "ADVANCED_PAUSE_FEATURE currently requires an LCD controller." #error "ADVANCED_PAUSE_FEATURE currently requires an LCD controller."
#elif ENABLED(EXTRUDER_RUNOUT_PREVENT) #elif ENABLED(EXTRUDER_RUNOUT_PREVENT)
#error "EXTRUDER_RUNOUT_PREVENT is incompatible with ADVANCED_PAUSE_FEATURE." #error "EXTRUDER_RUNOUT_PREVENT is incompatible with ADVANCED_PAUSE_FEATURE."
#elif ENABLED(PARK_HEAD_ON_PAUSE) && DISABLED(SDSUPPORT) && DISABLED(ULTIPANEL) && DISABLED(EMERGENCY_PARSER) #elif ENABLED(PARK_HEAD_ON_PAUSE) && DISABLED(SDSUPPORT) && DISABLED(NEWPANEL) && DISABLED(EMERGENCY_PARSER)
#error "PARK_HEAD_ON_PAUSE requires SDSUPPORT, EMERGENCY_PARSER, or an LCD controller." #error "PARK_HEAD_ON_PAUSE requires SDSUPPORT, EMERGENCY_PARSER, or an LCD controller."
#endif #endif
#endif #endif
@ -598,8 +598,12 @@ static_assert(1 >= 0
/** /**
* LCD_BED_LEVELING requirements * LCD_BED_LEVELING requirements
*/ */
#if ENABLED(LCD_BED_LEVELING) && DISABLED(MESH_BED_LEVELING) && !(HAS_ABL && ENABLED(PROBE_MANUALLY)) #if ENABLED(LCD_BED_LEVELING)
#error "LCD_BED_LEVELING requires MESH_BED_LEVELING or PROBE_MANUALLY." #if DISABLED(ULTIPANEL)
#error "LCD_BED_LEVELING requires an LCD controller."
#elif DISABLED(MESH_BED_LEVELING) && !(HAS_ABL && ENABLED(PROBE_MANUALLY))
#error "LCD_BED_LEVELING requires MESH_BED_LEVELING or PROBE_MANUALLY."
#endif
#endif #endif
/** /**

View File

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

View File

@ -3885,11 +3885,7 @@ void lcd_init() {
int lcd_strlen(const char* s) { int lcd_strlen(const char* s) {
int i = 0, j = 0; int i = 0, j = 0;
while (s[i]) { while (s[i]) {
#if ENABLED(MAPPER_NON) if (PRINTABLE(s[i])) j++;
j++;
#else
if (PRINTABLE(s[i])) j++;
#endif
i++; i++;
} }
return j; return j;
@ -3898,11 +3894,7 @@ int lcd_strlen(const char* s) {
int lcd_strlen_P(const char* s) { int lcd_strlen_P(const char* s) {
int j = 0; int j = 0;
while (pgm_read_byte(s)) { while (pgm_read_byte(s)) {
#if ENABLED(MAPPER_NON) if (PRINTABLE(pgm_read_byte(s))) j++;
j++;
#else
if (PRINTABLE(pgm_read_byte(s))) j++;
#endif
s++; s++;
} }
return j; return j;
@ -4162,28 +4154,28 @@ void lcd_update() {
} // ELAPSED(ms, next_lcd_update_ms) } // ELAPSED(ms, next_lcd_update_ms)
} }
#if DISABLED(STATUS_MESSAGE_SCROLLING) void pad_message_string() {
uint8_t i = 0, j = 0;
void set_utf_strlen(char* s, uint8_t n) { char c;
uint8_t i = 0, j = 0; while ((c = lcd_status_message[i]) && j < LCD_WIDTH) {
while (s[i] && (j < n)) { if (PRINTABLE(c)) j++;
#if ENABLED(MAPPER_NON) i++;
j++;
#else
if (PRINTABLE(s[i])) j++;
#endif
i++;
}
while (j++ < n) s[i++] = ' ';
s[i] = '\0';
} }
if (true
#endif // !STATUS_MESSAGE_SCROLLING #if ENABLED(STATUS_MESSAGE_SCROLLING)
&& j < LCD_WIDTH
#endif
) {
// pad with spaces to fill up the line
while (j++ < LCD_WIDTH) lcd_status_message[i++] = ' ';
// chop off at the edge
lcd_status_message[i] = '\0';
}
}
void lcd_finishstatus(bool persist=false) { void lcd_finishstatus(bool persist=false) {
#if DISABLED(STATUS_MESSAGE_SCROLLING)
set_utf_strlen(lcd_status_message, LCD_WIDTH); pad_message_string();
#endif
#if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0)) #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
UNUSED(persist); UNUSED(persist);

View File

@ -239,19 +239,17 @@ char lcd_print_and_count(const char c) {
* On DOGM all strings go through a filter for utf * On DOGM all strings go through a filter for utf
* But only use lcd_print_utf and lcd_printPGM_utf for translated text * But only use lcd_print_utf and lcd_printPGM_utf for translated text
*/ */
void lcd_print(const char* const str) { for (uint8_t i = 0; char c = str[i]; ++i) lcd_print(c); } void lcd_print(const char *str) { while (*str) lcd_print(*str++); }
void lcd_printPGM(const char* str) { for (; char c = pgm_read_byte(str); ++str) lcd_print(c); } void lcd_printPGM(const char *str) { while (const char c = pgm_read_byte(str)) lcd_print(c), ++str; }
void lcd_print_utf(const char* const str, const uint8_t maxLength=LCD_WIDTH) { void lcd_print_utf(const char *str, uint8_t n=LCD_WIDTH) {
char c; char c;
for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i) while (n && (c = *str)) n -= charset_mapper(c), ++str;
n -= charset_mapper(c);
} }
void lcd_printPGM_utf(const char* str, const uint8_t maxLength=LCD_WIDTH) { void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) {
char c; char c;
for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i) while (n && (c = pgm_read_byte(str))) n -= charset_mapper(c), ++str;
n -= charset_mapper(c);
} }
// Initialize or re-initialize the LCD // Initialize or re-initialize the LCD

View File

@ -382,19 +382,17 @@ void lcd_implementation_clear() { lcd.clear(); }
void lcd_print(const char c) { charset_mapper(c); } void lcd_print(const char c) { charset_mapper(c); }
void lcd_print(const char * const str) { for (uint8_t i = 0; char c = str[i]; ++i) lcd.print(c); } void lcd_print(const char *str) { while (*str) lcd.print(*str++); }
void lcd_printPGM(const char* str) { for (; char c = pgm_read_byte(str); ++str) lcd.print(c); } void lcd_printPGM(const char *str) { while (const char c = pgm_read_byte(str)) lcd.print(c), ++str; }
void lcd_print_utf(const char * const str, const uint8_t maxLength=LCD_WIDTH) { void lcd_print_utf(const char *str, uint8_t n=LCD_WIDTH) {
char c; char c;
for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i) while (n && (c = *str)) n -= charset_mapper(c), ++str;
n -= charset_mapper(c);
} }
void lcd_printPGM_utf(const char* str, const uint8_t maxLength=LCD_WIDTH) { void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) {
char c; char c;
for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i) while (n && (c = pgm_read_byte(str))) n -= charset_mapper(c), ++str;
n -= charset_mapper(c);
} }
#if ENABLED(SHOW_BOOTSCREEN) #if ENABLED(SHOW_BOOTSCREEN)

View File

@ -23,7 +23,7 @@
#ifndef UTF_MAPPER_H #ifndef UTF_MAPPER_H
#define UTF_MAPPER_H #define UTF_MAPPER_H
#include "language.h" #include "language.h"
#if ENABLED(DOGLCD) #if ENABLED(DOGLCD)
#define HARDWARE_CHAR_OUT u8g.print #define HARDWARE_CHAR_OUT u8g.print
@ -144,6 +144,8 @@
#endif // DISPLAY_CHARSET_HD44780 #endif // DISPLAY_CHARSET_HD44780
#endif // SIMULATE_ROMFONT #endif // SIMULATE_ROMFONT
#define PRINTABLE(C) (((C) & 0xC0u) != 0x80u)
#if ENABLED(MAPPER_C2C3) #if ENABLED(MAPPER_C2C3)
char charset_mapper(const char c) { char charset_mapper(const char c) {
@ -466,8 +468,11 @@
#define MAPPER_NON #define MAPPER_NON
#undef PRINTABLE
#define PRINTABLE(C) true
char charset_mapper(const char c) { char charset_mapper(const char c) {
HARDWARE_CHAR_OUT( c ); HARDWARE_CHAR_OUT(c);
return 1; return 1;
} }