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) \
|| ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) \
|| ENABLED(G3D_PANEL) \
|| ENABLED(RIGIDBOT_PANEL) \
|| ENABLED(REPRAPWORLD_KEYPAD)
|| ENABLED(RIGIDBOT_PANEL)
#define ULTIPANEL
#define NEWPANEL
#endif
#if ENABLED(REPRAPWORLD_KEYPAD)
#define NEWPANEL
#endif
#if ENABLED(RA_CONTROL_PANEL)
#define LCD_I2C_TYPE_PCA8574
#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
#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

View File

@ -319,11 +319,11 @@
* Advanced Pause
*/
#if ENABLED(ADVANCED_PAUSE_FEATURE)
#if DISABLED(ULTIPANEL)
#if DISABLED(NEWPANEL)
#error "ADVANCED_PAUSE_FEATURE currently requires an LCD controller."
#elif ENABLED(EXTRUDER_RUNOUT_PREVENT)
#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."
#endif
#endif
@ -598,8 +598,12 @@ static_assert(1 >= 0
/**
* 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."
#endif
#endif
/**

View File

@ -127,7 +127,6 @@
#define DECIMAL(a) (NUMERIC(a) || a == '.')
#define NUMERIC_SIGNED(a) (NUMERIC(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 ZERO(a) memset(a,0,sizeof(a))
#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 i = 0, j = 0;
while (s[i]) {
#if ENABLED(MAPPER_NON)
j++;
#else
if (PRINTABLE(s[i])) j++;
#endif
i++;
}
return j;
@ -3898,11 +3894,7 @@ int lcd_strlen(const char* s) {
int lcd_strlen_P(const char* s) {
int j = 0;
while (pgm_read_byte(s)) {
#if ENABLED(MAPPER_NON)
j++;
#else
if (PRINTABLE(pgm_read_byte(s))) j++;
#endif
s++;
}
return j;
@ -4162,28 +4154,28 @@ void lcd_update() {
} // ELAPSED(ms, next_lcd_update_ms)
}
#if DISABLED(STATUS_MESSAGE_SCROLLING)
void set_utf_strlen(char* s, uint8_t n) {
void pad_message_string() {
uint8_t i = 0, j = 0;
while (s[i] && (j < n)) {
#if ENABLED(MAPPER_NON)
j++;
#else
if (PRINTABLE(s[i])) j++;
#endif
char c;
while ((c = lcd_status_message[i]) && j < LCD_WIDTH) {
if (PRINTABLE(c)) j++;
i++;
}
while (j++ < n) s[i++] = ' ';
s[i] = '\0';
if (true
#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) {
#if DISABLED(STATUS_MESSAGE_SCROLLING)
set_utf_strlen(lcd_status_message, LCD_WIDTH);
#endif
pad_message_string();
#if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
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
* 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_printPGM(const char* str) { for (; char c = pgm_read_byte(str); ++str) lcd_print(c); }
void lcd_print(const char *str) { while (*str) lcd_print(*str++); }
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;
for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
n -= charset_mapper(c);
while (n && (c = *str)) n -= charset_mapper(c), ++str;
}
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;
for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
n -= charset_mapper(c);
while (n && (c = pgm_read_byte(str))) n -= charset_mapper(c), ++str;
}
// 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 * const str) { for (uint8_t i = 0; char c = str[i]; ++i) lcd.print(c); }
void lcd_printPGM(const char* str) { for (; char c = pgm_read_byte(str); ++str) lcd.print(c); }
void lcd_print(const char *str) { while (*str) lcd.print(*str++); }
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;
for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
n -= charset_mapper(c);
while (n && (c = *str)) n -= charset_mapper(c), ++str;
}
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;
for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
n -= charset_mapper(c);
while (n && (c = pgm_read_byte(str))) n -= charset_mapper(c), ++str;
}
#if ENABLED(SHOW_BOOTSCREEN)

View File

@ -144,6 +144,8 @@
#endif // DISPLAY_CHARSET_HD44780
#endif // SIMULATE_ROMFONT
#define PRINTABLE(C) (((C) & 0xC0u) != 0x80u)
#if ENABLED(MAPPER_C2C3)
char charset_mapper(const char c) {
@ -466,8 +468,11 @@
#define MAPPER_NON
#undef PRINTABLE
#define PRINTABLE(C) true
char charset_mapper(const char c) {
HARDWARE_CHAR_OUT( c );
HARDWARE_CHAR_OUT(c);
return 1;
}