Display sheet name when adjusting Z. Costs 130B of flash.
This commit is contained in:
parent
4a16fe6902
commit
53dbcdd852
3 changed files with 28 additions and 7 deletions
|
@ -174,15 +174,25 @@ static void menu_draw_item_puts_P(char type_char, const char* str)
|
|||
lcd_printf_P(PSTR("%c%-18.18S%c"), (lcd_encoder == menu_item)?'>':' ', str, type_char);
|
||||
}
|
||||
|
||||
//! @brief Format sheet name after PROGMEM text
|
||||
//!
|
||||
//! @param[in] str_P Pointer to string in PROGMEM
|
||||
//! @param[in] sheet_E Sheet in EEPROM
|
||||
//! @param[out] buffer for formatted output
|
||||
void menu_format_sheet_P_E(const char *str_P, const Sheet &sheet_E, SheetFormatBuffer &buffer)
|
||||
{
|
||||
uint_least8_t index = sprintf_P(buffer.c, PSTR("%.10S "), str_P);
|
||||
eeprom_read_block(&(buffer.c[index]), sheet_E.name, 7);
|
||||
index += 7;
|
||||
buffer.c[index] = '\0';
|
||||
}
|
||||
|
||||
static void menu_draw_item_puts_P(char type_char, const char *str_P, const Sheet &sheet)
|
||||
{
|
||||
lcd_set_cursor(0, menu_row);
|
||||
char buffer[19];
|
||||
uint_least8_t index = sprintf_P(buffer, PSTR("%.10S "), str_P);
|
||||
eeprom_read_block(&(buffer[index]), sheet.name, 7);
|
||||
index += 7;
|
||||
buffer[index] = '\0';
|
||||
lcd_printf_P(PSTR("%c%-18.18s%c"), (lcd_encoder == menu_item)?'>':' ', buffer, type_char);
|
||||
SheetFormatBuffer buffer;
|
||||
menu_format_sheet_P_E(str_P, sheet, buffer);
|
||||
lcd_printf_P(PSTR("%c%-18.18s%c"), (lcd_encoder == menu_item)?'>':' ', buffer.c, type_char);
|
||||
}
|
||||
|
||||
static void menu_draw_item_puts_P(char type_char, const char* str, char num)
|
||||
|
|
|
@ -130,6 +130,13 @@ extern void menu_draw_float31(const char* str, float val);
|
|||
|
||||
extern void menu_draw_float13(const char* str, float val);
|
||||
|
||||
struct SheetFormatBuffer
|
||||
{
|
||||
char c[19];
|
||||
};
|
||||
|
||||
extern void menu_format_sheet_P_E(const char *str_P, const Sheet &sheet_E, SheetFormatBuffer &buffer);
|
||||
|
||||
|
||||
#define MENU_ITEM_EDIT_int3_P(str, pval, minval, maxval) do { if (menu_item_edit_P(str, pval, minval, maxval)) return; } while (0)
|
||||
//#define MENU_ITEM_EDIT_int3_P(str, pval, minval, maxval) MENU_ITEM_EDIT(int3, str, pval, minval, maxval)
|
||||
|
|
|
@ -3121,6 +3121,10 @@ static void lcd_babystep_z()
|
|||
}
|
||||
if (lcd_draw_update)
|
||||
{
|
||||
SheetFormatBuffer buffer;
|
||||
menu_format_sheet_P_E(_T(MSG_SHEET), EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], buffer);
|
||||
lcd_set_cursor(0, 0);
|
||||
lcd_print(buffer.c);
|
||||
lcd_set_cursor(0, 1);
|
||||
menu_draw_float13(_i("Adjusting Z:"), _md->babystepMemMMZ); ////MSG_BABYSTEPPING_Z c=15 Beware: must include the ':' as its last character
|
||||
}
|
||||
|
@ -6372,7 +6376,7 @@ static void lcd_sheet_menu()
|
|||
MENU_ITEM_BACK_P(_T(MSG_MAIN));
|
||||
MENU_ITEM_SUBMENU_P(_i("Select"), lcd_select_sheet_menu); //// c=18
|
||||
MENU_ITEM_SUBMENU_P(_i("Rename"), lcd_rename_sheet_menu); //// c=18
|
||||
MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z); //TODO show value associated with sheet, not global legacy value
|
||||
MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);
|
||||
|
||||
MENU_END();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue