|
|
@ -789,7 +789,9 @@ static void lcd_implementation_status_screen() { |
|
|
|
lcd_print(lcd_status_message); |
|
|
|
} |
|
|
|
|
|
|
|
#if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE) |
|
|
|
#if ENABLED(ULTIPANEL) |
|
|
|
|
|
|
|
#if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE) |
|
|
|
|
|
|
|
static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, bool center=true, bool invert=false, const char *valstr=NULL) { |
|
|
|
UNUSED(invert); |
|
|
@ -811,9 +813,9 @@ static void lcd_implementation_status_screen() { |
|
|
|
while (n-- > 0) lcd.print(' '); |
|
|
|
} |
|
|
|
|
|
|
|
#endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
|
|
|
|
#endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
|
|
|
|
|
|
|
|
static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) { |
|
|
|
static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) { |
|
|
|
char c; |
|
|
|
uint8_t n = LCD_WIDTH - 2; |
|
|
|
lcd.setCursor(0, row); |
|
|
@ -824,9 +826,9 @@ static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const cha |
|
|
|
} |
|
|
|
while (n--) lcd.print(' '); |
|
|
|
lcd.print(post_char); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static void lcd_implementation_drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char* data) { |
|
|
|
static void lcd_implementation_drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char* data) { |
|
|
|
char c; |
|
|
|
uint8_t n = LCD_WIDTH - 2 - lcd_strlen(data); |
|
|
|
lcd.setCursor(0, row); |
|
|
@ -838,8 +840,8 @@ static void lcd_implementation_drawmenu_setting_edit_generic(bool sel, uint8_t r |
|
|
|
lcd.print(':'); |
|
|
|
while (n--) lcd.print(' '); |
|
|
|
lcd_print(data); |
|
|
|
} |
|
|
|
static void lcd_implementation_drawmenu_setting_edit_generic_P(bool sel, uint8_t row, const char* pstr, char pre_char, const char* data) { |
|
|
|
} |
|
|
|
static void lcd_implementation_drawmenu_setting_edit_generic_P(bool sel, uint8_t row, const char* pstr, char pre_char, const char* data) { |
|
|
|
char c; |
|
|
|
uint8_t n = LCD_WIDTH - 2 - lcd_strlen_P(data); |
|
|
|
lcd.setCursor(0, row); |
|
|
@ -851,30 +853,30 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(bool sel, uint8_t |
|
|
|
lcd.print(':'); |
|
|
|
while (n--) lcd.print(' '); |
|
|
|
lcd_printPGM(data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#define lcd_implementation_drawmenu_setting_edit_int3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', itostr3(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_float3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr3(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_float32(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr32(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_float43(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr43sign(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_float5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_float52(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr52sign(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_float51(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr51sign(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_long5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) |
|
|
|
|
|
|
|
//Add version for callback functions
|
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_int3(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', itostr3(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_float3(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr3(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_float32(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr32(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_float43(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr43sign(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_float5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_float52(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr52sign(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_float51(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr51sign(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_long5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) |
|
|
|
|
|
|
|
void lcd_implementation_drawedit(const char* pstr, const char* value=NULL) { |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_int3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', itostr3(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_float3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr3(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_float32(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr32(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_float43(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr43sign(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_float5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_float52(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr52sign(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_float51(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr51sign(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_long5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) |
|
|
|
|
|
|
|
//Add version for callback functions
|
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_int3(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', itostr3(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_float3(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr3(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_float32(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr32(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_float43(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr43sign(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_float5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_float52(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr52sign(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_float51(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr51sign(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_long5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data))) |
|
|
|
#define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) |
|
|
|
|
|
|
|
void lcd_implementation_drawedit(const char* pstr, const char* value=NULL) { |
|
|
|
lcd.setCursor(1, 1); |
|
|
|
lcd_printPGM(pstr); |
|
|
|
if (value != NULL) { |
|
|
@ -882,9 +884,9 @@ void lcd_implementation_drawedit(const char* pstr, const char* value=NULL) { |
|
|
|
lcd.setCursor(LCD_WIDTH - lcd_strlen(value), 1); |
|
|
|
lcd_print(value); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#if ENABLED(SDSUPPORT) |
|
|
|
#if ENABLED(SDSUPPORT) |
|
|
|
|
|
|
|
static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename, uint8_t concat, char post_char) { |
|
|
|
UNUSED(pstr); |
|
|
@ -912,12 +914,33 @@ void lcd_implementation_drawedit(const char* pstr, const char* value=NULL) { |
|
|
|
lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, LCD_STR_FOLDER[0]); |
|
|
|
} |
|
|
|
|
|
|
|
#endif //SDSUPPORT
|
|
|
|
#endif // SDSUPPORT
|
|
|
|
|
|
|
|
#define lcd_implementation_drawmenu_back(sel, row, pstr) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]) |
|
|
|
#define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0]) |
|
|
|
#define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') |
|
|
|
#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') |
|
|
|
|
|
|
|
#if ENABLED(LCD_HAS_SLOW_BUTTONS) |
|
|
|
|
|
|
|
#define lcd_implementation_drawmenu_back(sel, row, pstr) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]) |
|
|
|
#define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0]) |
|
|
|
#define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') |
|
|
|
#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') |
|
|
|
extern millis_t next_button_update_ms; |
|
|
|
|
|
|
|
static uint8_t lcd_implementation_read_slow_buttons() { |
|
|
|
#if ENABLED(LCD_I2C_TYPE_MCP23017) |
|
|
|
// Reading these buttons this is likely to be too slow to call inside interrupt context
|
|
|
|
// so they are called during normal lcd_update
|
|
|
|
uint8_t slow_bits = lcd.readButtons() << B_I2C_BTN_OFFSET; |
|
|
|
#if ENABLED(LCD_I2C_VIKI) |
|
|
|
if ((slow_bits & (B_MI | B_RI)) && PENDING(millis(), next_button_update_ms)) // LCD clicked
|
|
|
|
slow_bits &= ~(B_MI | B_RI); // Disable LCD clicked buttons if screen is updated
|
|
|
|
#endif // LCD_I2C_VIKI
|
|
|
|
return slow_bits; |
|
|
|
#endif // LCD_I2C_TYPE_MCP23017
|
|
|
|
} |
|
|
|
|
|
|
|
#endif // LCD_HAS_SLOW_BUTTONS
|
|
|
|
|
|
|
|
#endif // ULTIPANEL
|
|
|
|
|
|
|
|
#if ENABLED(LCD_HAS_STATUS_INDICATORS) |
|
|
|
|
|
|
@ -957,23 +980,4 @@ void lcd_implementation_drawedit(const char* pstr, const char* value=NULL) { |
|
|
|
|
|
|
|
#endif // LCD_HAS_STATUS_INDICATORS
|
|
|
|
|
|
|
|
#if ENABLED(LCD_HAS_SLOW_BUTTONS) |
|
|
|
|
|
|
|
extern millis_t next_button_update_ms; |
|
|
|
|
|
|
|
static uint8_t lcd_implementation_read_slow_buttons() { |
|
|
|
#if ENABLED(LCD_I2C_TYPE_MCP23017) |
|
|
|
// Reading these buttons this is likely to be too slow to call inside interrupt context
|
|
|
|
// so they are called during normal lcd_update
|
|
|
|
uint8_t slow_bits = lcd.readButtons() << B_I2C_BTN_OFFSET; |
|
|
|
#if ENABLED(LCD_I2C_VIKI) |
|
|
|
if ((slow_bits & (B_MI | B_RI)) && PENDING(millis(), next_button_update_ms)) // LCD clicked
|
|
|
|
slow_bits &= ~(B_MI | B_RI); // Disable LCD clicked buttons if screen is updated
|
|
|
|
#endif // LCD_I2C_VIKI
|
|
|
|
return slow_bits; |
|
|
|
#endif // LCD_I2C_TYPE_MCP23017
|
|
|
|
} |
|
|
|
|
|
|
|
#endif // LCD_HAS_SLOW_BUTTONS
|
|
|
|
|
|
|
|
#endif // ULTRALCD_IMPL_HD44780_H
|
|
|
|