Merge pull request #4243 from thinkyhead/rc_fix_static_scrolling

Improve STATIC_ITEM implementation
master
Scott Lahteine 8 years ago committed by GitHub
commit 6e68dd292b

@ -118,12 +118,7 @@
#define REPRAP_DISCOUNT_SMART_CONTROLLER
#endif
#if ENABLED(ULTIMAKERCONTROLLER) || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) || ENABLED(G3D_PANEL) || ENABLED(RIGIDBOT_PANEL)
#define ULTIPANEL
#define NEWPANEL
#endif
#if ENABLED(REPRAPWORLD_KEYPAD)
#if ENABLED(ULTIMAKERCONTROLLER) || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) || ENABLED(G3D_PANEL) || ENABLED(RIGIDBOT_PANEL) || ENABLED(REPRAPWORLD_KEYPAD)
#define ULTIPANEL
#define NEWPANEL
#endif

@ -138,7 +138,7 @@
#define TALL_FONT_CORRECTION 0
#endif
#define START_ROW 0
#define START_COL 0
// LCD selection
#if ENABLED(U8GLIB_ST7920)
@ -483,27 +483,29 @@ static void lcd_implementation_mark_as_selected(uint8_t row, bool isSelected) {
else {
u8g.setColorIndex(1); // unmarked text is black on white
}
u8g.setPrintPos((START_ROW) * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT));
u8g.setPrintPos((START_COL) * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT));
}
#if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE)
static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, const char* valstr=NULL, bool center=true) {
static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, bool center=true, bool invert=false, const char* valstr=NULL) {
lcd_implementation_mark_as_selected(row, invert);
char c;
int8_t n = LCD_WIDTH;
u8g.setPrintPos(0, (row + 1) * (DOG_CHAR_HEIGHT));
u8g.setColorIndex(1); // normal text
int8_t n = LCD_WIDTH - (START_COL);
if (center && !valstr) {
int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
while (--pad >= 0) { lcd_print(' '); n--; }
}
while (c = pgm_read_byte(pstr)) {
while (n > 0 && (c = pgm_read_byte(pstr))) {
n -= lcd_print(c);
pstr++;
}
if (valstr) {
lcd_print(valstr);
n -= lcd_strlen(valstr);
if (valstr) while (n > 0 && (c = *valstr)) {
n -= lcd_print(c);
valstr++;
}
while (n-- > 0) lcd_print(' ');
}
@ -514,7 +516,7 @@ static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, co
UNUSED(pre_char);
char c;
uint8_t n = LCD_WIDTH - 2;
uint8_t n = LCD_WIDTH - (START_COL) - 2;
lcd_implementation_mark_as_selected(row, isSelected);
@ -531,7 +533,7 @@ static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, co
static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const char* pstr, const char* data, bool pgm) {
char c;
uint8_t vallen = (pgm ? lcd_strlen_P(data) : (lcd_strlen((char*)data)));
uint8_t n = LCD_WIDTH - 2 - vallen;
uint8_t n = LCD_WIDTH - (START_COL) - 2 - vallen;
lcd_implementation_mark_as_selected(row, isSelected);
@ -571,7 +573,7 @@ static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const c
void lcd_implementation_drawedit(const char* pstr, const char* value=NULL) {
uint8_t rows = 1;
uint8_t lcd_width = LCD_WIDTH, char_width = DOG_CHAR_WIDTH;
uint8_t lcd_width = LCD_WIDTH - (START_COL), char_width = DOG_CHAR_WIDTH;
uint8_t vallen = lcd_strlen(value);
#if ENABLED(USE_BIG_EDIT_FONT)
@ -605,7 +607,7 @@ void lcd_implementation_drawedit(const char* pstr, const char* value=NULL) {
static void _drawmenu_sd(bool isSelected, uint8_t row, const char* pstr, const char* filename, char* const longFilename, bool isDir) {
UNUSED(pstr);
char c;
uint8_t n = LCD_WIDTH - 1;
uint8_t n = LCD_WIDTH - (START_COL) - 1;
if (longFilename[0]) {
filename = longFilename;

@ -214,21 +214,21 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
* START_SCREEN generates the init code for a screen function
*
* encoderLine is the position based on the encoder
* currentMenuViewOffset is the top menu line to display
* _drawLineNr is the index of the LCD line (0-3)
* _lineNr is the menu item to draw and process
* _menuItemNr is the index of each MENU_ITEM
* encoderTopLine is the top menu line to display
* _lcdLineNr is the index of the LCD line (e.g., 0-3)
* _menuLineNr is the menu item to draw and process
* _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM
*/
#define _START_SCREEN(CODE) do { \
#define _START_SCREEN(CODE) \
ENCODER_DIRECTION_MENUS(); \
encoderRateMultiplierEnabled = false; \
if (encoderPosition > 0x8000) encoderPosition = 0; \
uint8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \
NOMORE(currentMenuViewOffset, encoderLine); \
uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
int8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \
NOMORE(encoderTopLine, encoderLine); \
int8_t _menuLineNr = encoderTopLine, _thisItemNr; \
CODE; \
for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \
_menuItemNr = 0;
for (int8_t _lcdLineNr = 0; _lcdLineNr < LCD_HEIGHT; _lcdLineNr++, _menuLineNr++) { \
_thisItemNr = 0;
#define START_SCREEN() _START_SCREEN(0)
@ -260,49 +260,71 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
* menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedrate_multiplier, 10, 999)
*
*/
#define _MENU_ITEM_PART_1(type, label, args...) \
if (_menuItemNr == _lineNr) { \
#define _MENU_ITEM_PART_1(TYPE, LABEL, ARGS...) \
if (_menuLineNr == _thisItemNr) { \
if (lcdDrawUpdate) \
lcd_implementation_drawmenu_ ## type(encoderLine == _menuItemNr, _drawLineNr, PSTR(label), ## args); \
if (wasClicked && encoderLine == _menuItemNr) { \
lcd_implementation_drawmenu_ ## TYPE(encoderLine == _thisItemNr, _lcdLineNr, PSTR(LABEL), ## ARGS); \
if (wasClicked && encoderLine == _thisItemNr) { \
lcd_quick_feedback()
#define _MENU_ITEM_PART_2(type, args...) \
menu_action_ ## type(args); \
#define _MENU_ITEM_PART_2(TYPE, ARGS...) \
menu_action_ ## TYPE(ARGS); \
return; \
} \
} \
_menuItemNr++
_thisItemNr++
#define MENU_ITEM(type, label, args...) do { \
_MENU_ITEM_PART_1(type, label, ## args); \
_MENU_ITEM_PART_2(type, ## args); \
#define MENU_ITEM(TYPE, LABEL, ARGS...) do { \
_MENU_ITEM_PART_1(TYPE, LABEL, ## ARGS); \
_MENU_ITEM_PART_2(TYPE, ## ARGS); \
} while(0)
// Used to print static text with no visible cursor.
#define STATIC_ITEM(label, args...) \
if (_menuItemNr == _lineNr) { \
if (encoderLine == _menuItemNr && _menuItemNr < LCD_HEIGHT - 1) \
#define STATIC_ITEM(LABEL, ARGS...) \
if (_menuLineNr == _thisItemNr) { \
if (encoderLine == _thisItemNr && _thisItemNr < LCD_HEIGHT - 1) { \
encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
} \
if (lcdDrawUpdate) \
lcd_implementation_drawmenu_static(_drawLineNr, PSTR(label), ## args); \
lcd_implementation_drawmenu_static(_lcdLineNr, PSTR(LABEL), ## ARGS); \
} \
_menuItemNr++
_thisItemNr++
/**
*
* END_SCREEN Closing code for a screen having only static items.
* Do simplified scrolling of the entire screen.
*
* END_MENU Closing code for a screen with menu items.
* Scroll as-needed to keep the selected line in view.
*
* At this point _thisItemNr equals the total number of items.
*
*/
// Simple-scroll by using encoderLine as encoderTopLine
#define END_SCREEN() \
if (encoderLine >= _menuItemNr) { \
encoderPosition = _menuItemNr * (ENCODER_STEPS_PER_MENU_ITEM) - 1; \
encoderLine = _menuItemNr - 1; \
} \
if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { \
currentMenuViewOffset = encoderLine - (LCD_HEIGHT) + 1; \
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
_lineNr = currentMenuViewOffset - 1; \
_drawLineNr = -1; \
} \
} } while(0)
} \
NOMORE(encoderLine, _thisItemNr - LCD_HEIGHT); \
NOLESS(encoderLine, 0); \
encoderPosition = encoderLine * (ENCODER_STEPS_PER_MENU_ITEM); \
if (encoderTopLine != encoderLine) { \
encoderTopLine = encoderLine; \
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
}
#define END_MENU() END_SCREEN()
// Scroll through menu items, scrolling as-needed to stay in view
#define END_MENU() \
} \
if (encoderLine >= _thisItemNr) { \
encoderLine = _thisItemNr - 1; \
encoderPosition = encoderLine * (ENCODER_STEPS_PER_MENU_ITEM); \
} \
if (encoderLine >= encoderTopLine + LCD_HEIGHT) { \
encoderTopLine = encoderLine - (LCD_HEIGHT - 1); \
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
}
#if ENABLED(ENCODER_RATE_MULTIPLIER)
@ -320,7 +342,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
#endif //ENCODER_RATE_MULTIPLIER
#define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0)
#define MENU_ITEM_DUMMY() do { _thisItemNr++; } while(0)
#define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
#define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
#if ENABLED(ENCODER_RATE_MULTIPLIER)
@ -340,7 +362,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
volatile uint8_t slow_buttons; // Bits of the pressed buttons.
#endif
uint8_t currentMenuViewOffset; /* scroll offset in the current menu */
int8_t encoderTopLine; /* scroll offset in the current menu */
millis_t next_button_update_ms;
uint8_t lastEncoderBits;
uint32_t encoderPosition;
@ -376,6 +398,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
if (currentScreen != screen) {
currentScreen = screen;
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
encoderTopLine = 0;
#if ENABLED(NEWPANEL)
encoderPosition = encoder;
if (feedback) lcd_quick_feedback();
@ -654,6 +677,7 @@ void kill_screen(const char* lcd_msg) {
long babysteps_done = 0;
static void _lcd_babystep(const AxisEnum axis, const char* msg) {
if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
ENCODER_DIRECTION_NORMAL();
if (encoderPosition) {
int babystep_increment = (int32_t)encoderPosition * BABYSTEP_MULTIPLICATOR;
@ -666,7 +690,6 @@ void kill_screen(const char* lcd_msg) {
lcd_implementation_drawedit(msg, ftostr43sign(
((1000 * babysteps_done) / planner.axis_steps_per_mm[axis]) * 0.001f
));
if (LCD_CLICKED) lcd_goto_previous_menu(true);
}
#if ENABLED(BABYSTEP_XY)
@ -1321,6 +1344,7 @@ void kill_screen(const char* lcd_msg) {
float move_menu_scale;
static void _lcd_move_xyz(const char* name, AxisEnum axis, float min, float max) {
if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
ENCODER_DIRECTION_NORMAL();
if (encoderPosition) {
refresh_cmd_timeout();
@ -1332,7 +1356,6 @@ void kill_screen(const char* lcd_msg) {
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
}
if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr41sign(current_position[axis]));
if (LCD_CLICKED) lcd_goto_previous_menu(true);
}
#if ENABLED(DELTA)
static float delta_clip_radius_2 = (DELTA_PRINTABLE_RADIUS) * (DELTA_PRINTABLE_RADIUS);
@ -1349,6 +1372,7 @@ void kill_screen(const char* lcd_msg) {
int8_t eindex = -1
#endif
) {
if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
ENCODER_DIRECTION_NORMAL();
if (encoderPosition) {
current_position[E_AXIS] += float((int32_t)encoderPosition) * move_menu_scale;
@ -1378,7 +1402,6 @@ void kill_screen(const char* lcd_msg) {
#endif //EXTRUDERS > 1
lcd_implementation_drawedit(pos_label, ftostr41sign(current_position[E_AXIS]));
}
if (LCD_CLICKED) lcd_goto_previous_menu(true);
}
#if EXTRUDERS > 1
@ -1837,6 +1860,7 @@ void kill_screen(const char* lcd_msg) {
*/
#if HAS_LCD_CONTRAST
static void lcd_set_contrast() {
if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
ENCODER_DIRECTION_NORMAL();
if (encoderPosition) {
set_lcd_contrast(lcd_contrast + encoderPosition);
@ -1852,7 +1876,6 @@ void kill_screen(const char* lcd_msg) {
#endif
);
}
if (LCD_CLICKED) lcd_goto_previous_menu(true);
}
#endif // HAS_LCD_CONTRAST
@ -1886,13 +1909,13 @@ void kill_screen(const char* lcd_msg) {
#if !PIN_EXISTS(SD_DETECT)
static void lcd_sd_refresh() {
card.initsd();
currentMenuViewOffset = 0;
encoderTopLine = 0;
}
#endif
static void lcd_sd_updir() {
card.updir();
currentMenuViewOffset = 0;
encoderTopLine = 0;
}
/**
@ -1917,7 +1940,7 @@ void kill_screen(const char* lcd_msg) {
}
for (uint16_t i = 0; i < fileCnt; i++) {
if (_menuItemNr == _lineNr) {
if (_menuLineNr == _thisItemNr) {
card.getfilename(
#if ENABLED(SDCARD_RATHERRECENTFIRST)
fileCnt-1 -
@ -1944,10 +1967,12 @@ void kill_screen(const char* lcd_msg) {
#if ENABLED(PRINTCOUNTER)
/**
*
* About Printer > Stastics submenu
* About Printer > Statistics submenu
*
*/
static void lcd_info_stats_menu() {
if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
PrintCounter print_job_counter = PrintCounter();
print_job_counter.loadStats();
printStatistics stats = print_job_counter.getStats();
@ -1955,11 +1980,10 @@ void kill_screen(const char* lcd_msg) {
char printTime[6];
sprintf(printTime, "%02d:%02d", int(stats.printTime / 3600), int(stats.printTime / 60) % 60);
if (LCD_CLICKED) lcd_goto_previous_menu(true);
START_SCREEN();
STATIC_ITEM(MSG_INFO_PRINT_COUNT ": ", itostr3left(stats.totalPrints)); // Print Count : 999
STATIC_ITEM(MSG_INFO_FINISHED_PRINTS ": ", itostr3left(stats.finishedPrints)); // Finished : 666
STATIC_ITEM(MSG_INFO_PRINT_TIME ": ", printTime); // Total Time : 12:34
STATIC_ITEM(MSG_INFO_PRINT_COUNT ": ", false, false, itostr3left(stats.totalPrints)); // Print Count : 999
STATIC_ITEM(MSG_INFO_FINISHED_PRINTS ": ", false, false, itostr3left(stats.finishedPrints)); // Finished : 666
STATIC_ITEM(MSG_INFO_PRINT_TIME ": ", false, false, printTime); // Total Time : 12:34
END_SCREEN();
}
#endif // PRINTCOUNTER
@ -1970,48 +1994,48 @@ void kill_screen(const char* lcd_msg) {
*
*/
static void lcd_info_thermistors_menu() {
if (LCD_CLICKED) lcd_goto_previous_menu(true);
if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
START_SCREEN();
#define THERMISTOR_ID TEMP_SENSOR_0
#include "thermistornames.h"
STATIC_ITEM("T0: " THERMISTOR_NAME);
STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_0_MINTEMP));
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_0_MAXTEMP));
STATIC_ITEM("T0: " THERMISTOR_NAME, false, true);
STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_0_MINTEMP), false);
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_0_MAXTEMP), false);
#if TEMP_SENSOR_1 != 0
#undef THERMISTOR_ID
#define THERMISTOR_ID TEMP_SENSOR_1
#include "thermistornames.h"
STATIC_ITEM("T1: " THERMISTOR_NAME);
STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_1_MINTEMP));
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_1_MAXTEMP));
STATIC_ITEM("T1: " THERMISTOR_NAME, false, true);
STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_1_MINTEMP), false);
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_1_MAXTEMP), false);
#endif
#if TEMP_SENSOR_2 != 0
#undef THERMISTOR_ID
#define THERMISTOR_ID TEMP_SENSOR_2
#include "thermistornames.h"
STATIC_ITEM("T2: " THERMISTOR_NAME);
STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_2_MINTEMP));
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_2_MAXTEMP));
STATIC_ITEM("T2: " THERMISTOR_NAME, false, true);
STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_2_MINTEMP), false);
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_2_MAXTEMP), false);
#endif
#if TEMP_SENSOR_3 != 0
#undef THERMISTOR_ID
#define THERMISTOR_ID TEMP_SENSOR_3
#include "thermistornames.h"
STATIC_ITEM("T3: " THERMISTOR_NAME);
STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_3_MINTEMP));
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_3_MAXTEMP));
STATIC_ITEM("T3: " THERMISTOR_NAME, false, true);
STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_3_MINTEMP), false);
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_3_MAXTEMP), false);
#endif
#if TEMP_SENSOR_BED != 0
#undef THERMISTOR_ID
#define THERMISTOR_ID TEMP_SENSOR_BED
#include "thermistornames.h"
STATIC_ITEM("TBed:" THERMISTOR_NAME);
STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(BED_MINTEMP));
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(BED_MAXTEMP));
STATIC_ITEM("TBed:" THERMISTOR_NAME, false, true);
STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(BED_MINTEMP), false);
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(BED_MAXTEMP), false);
#endif
END_SCREEN();
}
@ -2022,9 +2046,9 @@ void kill_screen(const char* lcd_msg) {
*
*/
static void lcd_info_board_menu() {
if (LCD_CLICKED) lcd_goto_previous_menu(true);
if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
START_SCREEN();
STATIC_ITEM(BOARD_NAME); // MyPrinterController
STATIC_ITEM(BOARD_NAME, true, true); // MyPrinterController
STATIC_ITEM(MSG_INFO_BAUDRATE ": " STRINGIFY(BAUDRATE)); // Baud: 250000
STATIC_ITEM(MSG_INFO_PROTOCOL ": " PROTOCOL_VERSION); // Protocol: 1.0
#ifdef POWER_SUPPLY
@ -2043,9 +2067,9 @@ void kill_screen(const char* lcd_msg) {
*
*/
static void lcd_info_printer_menu() {
if (LCD_CLICKED) lcd_goto_previous_menu(true);
if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
START_SCREEN();
STATIC_ITEM(MSG_MARLIN); // Marlin
STATIC_ITEM(MSG_MARLIN, true, true); // Marlin
STATIC_ITEM(SHORT_BUILD_VERSION); // x.x.x-Branch
STATIC_ITEM(STRING_DISTRIBUTION_DATE); // YYYY-MM-DD HH:MM
STATIC_ITEM(MACHINE_NAME); // My3DPrinter
@ -2087,7 +2111,7 @@ void kill_screen(const char* lcd_msg) {
static void lcd_filament_change_option_menu() {
START_MENU();
#if LCD_HEIGHT > 2
STATIC_ITEM(MSG_FILAMENT_CHANGE_OPTION_HEADER);
STATIC_ITEM(MSG_FILAMENT_CHANGE_OPTION_HEADER, true, false);
#endif
MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_RESUME, lcd_filament_change_resume_print);
MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_EXTRUDE, lcd_filament_change_extrude_more);
@ -2096,7 +2120,7 @@ void kill_screen(const char* lcd_msg) {
static void lcd_filament_change_init_message() {
START_SCREEN();
STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER, true, true);
STATIC_ITEM(MSG_FILAMENT_CHANGE_INIT_1);
#ifdef MSG_FILAMENT_CHANGE_INIT_2
STATIC_ITEM(MSG_FILAMENT_CHANGE_INIT_2);
@ -2109,7 +2133,7 @@ void kill_screen(const char* lcd_msg) {
static void lcd_filament_change_unload_message() {
START_SCREEN();
STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER, true, true);
STATIC_ITEM(MSG_FILAMENT_CHANGE_UNLOAD_1);
#ifdef MSG_FILAMENT_CHANGE_UNLOAD_2
STATIC_ITEM(MSG_FILAMENT_CHANGE_UNLOAD_2);
@ -2122,7 +2146,7 @@ void kill_screen(const char* lcd_msg) {
static void lcd_filament_change_insert_message() {
START_SCREEN();
STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER, true, true);
STATIC_ITEM(MSG_FILAMENT_CHANGE_INSERT_1);
#ifdef MSG_FILAMENT_CHANGE_INSERT_2
STATIC_ITEM(MSG_FILAMENT_CHANGE_INSERT_2);
@ -2135,7 +2159,7 @@ void kill_screen(const char* lcd_msg) {
static void lcd_filament_change_load_message() {
START_SCREEN();
STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER, true, true);
STATIC_ITEM(MSG_FILAMENT_CHANGE_LOAD_1);
#ifdef MSG_FILAMENT_CHANGE_LOAD_2
STATIC_ITEM(MSG_FILAMENT_CHANGE_LOAD_2);
@ -2148,7 +2172,7 @@ void kill_screen(const char* lcd_msg) {
static void lcd_filament_change_extrude_message() {
START_SCREEN();
STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER, true, true);
STATIC_ITEM(MSG_FILAMENT_CHANGE_EXTRUDE_1);
#ifdef MSG_FILAMENT_CHANGE_EXTRUDE_2
STATIC_ITEM(MSG_FILAMENT_CHANGE_EXTRUDE_2);
@ -2161,7 +2185,7 @@ void kill_screen(const char* lcd_msg) {
static void lcd_filament_change_resume_message() {
START_SCREEN();
STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER, true, true);
STATIC_ITEM(MSG_FILAMENT_CHANGE_RESUME_1);
#ifdef MSG_FILAMENT_CHANGE_RESUME_2
STATIC_ITEM(MSG_FILAMENT_CHANGE_RESUME_2);

@ -830,7 +830,8 @@ static void lcd_implementation_status_screen() {
#if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE)
static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, const char *valstr=NULL, bool center=true) {
static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, bool center=true, bool invert=false, const char *valstr=NULL) {
UNUSED(invert);
char c;
int8_t n = LCD_WIDTH;
lcd.setCursor(0, row);
@ -838,13 +839,13 @@ static void lcd_implementation_status_screen() {
int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
while (--pad >= 0) { lcd.print(' '); n--; }
}
while ((c = pgm_read_byte(pstr)) && n > 0) {
while (n > 0 && (c = pgm_read_byte(pstr))) {
n -= lcd_print(c);
pstr++;
}
if (valstr) {
lcd_print(valstr);
n -= lcd_strlen(valstr);
if (valstr) while (n > 0 && (c = *valstr)) {
n -= lcd_print(c);
valstr++;
}
while (n-- > 0) lcd.print(' ');
}

Loading…
Cancel
Save