Merge pull request #6922 from thinkyhead/bf_probe_options

Prevent illegal leveling combinations
master
Scott Lahteine 8 years ago committed by GitHub
commit ac33a378c0

@ -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

@ -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

@ -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)
#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." #error "LCD_BED_LEVELING requires MESH_BED_LEVELING or PROBE_MANUALLY."
#endif
#endif #endif
/** /**

@ -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)))

@ -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)
j++;
#else
if (PRINTABLE(s[i])) j++; 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)
j++;
#else
if (PRINTABLE(pgm_read_byte(s))) j++; 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() {
void set_utf_strlen(char* s, uint8_t n) {
uint8_t i = 0, j = 0; uint8_t i = 0, j = 0;
while (s[i] && (j < n)) { char c;
#if ENABLED(MAPPER_NON) while ((c = lcd_status_message[i]) && j < LCD_WIDTH) {
j++; if (PRINTABLE(c)) j++;
#else
if (PRINTABLE(s[i])) j++;
#endif
i++; i++;
} }
while (j++ < n) s[i++] = ' '; if (true
s[i] = '\0'; #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';
} }
}
#endif // !STATUS_MESSAGE_SCROLLING
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);

@ -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

@ -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)

@ -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;
} }

Loading…
Cancel
Save