many more lcd_putc_at optimisations
Changes in lcd_implementation_drawmenu_sdfile and lcd_implementation_drawmenu_sddirectory seem to save the most. Change in memory: Flash: -72 bytes SRAM: 0 bytes
This commit is contained in:
parent
dea7f2b26c
commit
9b6e1babcb
|
|
@ -622,8 +622,7 @@ void crashdet_detected(uint8_t mask)
|
||||||
lcd_print(msg);
|
lcd_print(msg);
|
||||||
|
|
||||||
// ask whether to resume printing
|
// ask whether to resume printing
|
||||||
lcd_set_cursor(0, 1);
|
lcd_puts_at_P(0, 1, _T(MSG_RESUME_PRINT));
|
||||||
lcd_puts_P(_T(MSG_RESUME_PRINT));
|
|
||||||
lcd_putc('?');
|
lcd_putc('?');
|
||||||
uint8_t yesno = lcd_show_yes_no_and_wait(false);
|
uint8_t yesno = lcd_show_yes_no_and_wait(false);
|
||||||
if (yesno == LCD_LEFT_BUTTON_CHOICE)
|
if (yesno == LCD_LEFT_BUTTON_CHOICE)
|
||||||
|
|
|
||||||
|
|
@ -159,8 +159,7 @@ static char menu_selection_mark(){
|
||||||
|
|
||||||
static void menu_draw_item_puts_P(char type_char, const char* str)
|
static void menu_draw_item_puts_P(char type_char, const char* str)
|
||||||
{
|
{
|
||||||
lcd_set_cursor(0, menu_row);
|
lcd_putc_at(0, menu_row, menu_selection_mark());
|
||||||
lcd_putc(menu_selection_mark());
|
|
||||||
lcd_print_pad_P(str, LCD_WIDTH - 2);
|
lcd_print_pad_P(str, LCD_WIDTH - 2);
|
||||||
lcd_putc(type_char);
|
lcd_putc(type_char);
|
||||||
}
|
}
|
||||||
|
|
@ -218,10 +217,9 @@ void menu_format_sheet_select_E(const Sheet &sheet_E, SheetFormatBuffer &buffer)
|
||||||
|
|
||||||
static void menu_draw_item_select_sheet_E(char type_char, const Sheet &sheet)
|
static void menu_draw_item_select_sheet_E(char type_char, const Sheet &sheet)
|
||||||
{
|
{
|
||||||
lcd_set_cursor(0, menu_row);
|
|
||||||
SheetFormatBuffer buffer;
|
SheetFormatBuffer buffer;
|
||||||
menu_format_sheet_select_E(sheet, buffer);
|
menu_format_sheet_select_E(sheet, buffer);
|
||||||
lcd_putc(menu_selection_mark());
|
lcd_putc_at(0, menu_row, menu_selection_mark());
|
||||||
lcd_print_pad(buffer.c, LCD_WIDTH - 2);
|
lcd_print_pad(buffer.c, LCD_WIDTH - 2);
|
||||||
lcd_putc(type_char);
|
lcd_putc(type_char);
|
||||||
}
|
}
|
||||||
|
|
@ -229,10 +227,9 @@ static void menu_draw_item_select_sheet_E(char type_char, const Sheet &sheet)
|
||||||
|
|
||||||
static void menu_draw_item_puts_E(char type_char, const Sheet &sheet)
|
static void menu_draw_item_puts_E(char type_char, const Sheet &sheet)
|
||||||
{
|
{
|
||||||
lcd_set_cursor(0, menu_row);
|
|
||||||
SheetFormatBuffer buffer;
|
SheetFormatBuffer buffer;
|
||||||
menu_format_sheet_E(sheet, buffer);
|
menu_format_sheet_E(sheet, buffer);
|
||||||
lcd_putc(menu_selection_mark());
|
lcd_putc_at(0, menu_row, menu_selection_mark());
|
||||||
lcd_print_pad(buffer.c, LCD_WIDTH - 2);
|
lcd_print_pad(buffer.c, LCD_WIDTH - 2);
|
||||||
lcd_putc(type_char);
|
lcd_putc(type_char);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -267,22 +267,18 @@ const char STR_SEPARATOR[] PROGMEM = "------------";
|
||||||
static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* longFilename)
|
static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* longFilename)
|
||||||
{
|
{
|
||||||
uint8_t len = LCD_WIDTH - 1;
|
uint8_t len = LCD_WIDTH - 1;
|
||||||
lcd_set_cursor(0, row);
|
lcd_putc_at(0, row, (lcd_encoder == menu_item)?'>':' ');
|
||||||
lcd_print((lcd_encoder == menu_item)?'>':' ');
|
|
||||||
lcd_print_pad(longFilename, len);
|
lcd_print_pad(longFilename, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* longFilename)
|
static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* longFilename)
|
||||||
{
|
{
|
||||||
uint8_t len = LCD_WIDTH - 2;
|
uint8_t len = LCD_WIDTH - 2;
|
||||||
lcd_set_cursor(0, row);
|
lcd_putc_at(0, row, (lcd_encoder == menu_item)?'>':' ');
|
||||||
lcd_print((lcd_encoder == menu_item)?'>':' ');
|
lcd_putc(LCD_STR_FOLDER[0]);
|
||||||
lcd_print(LCD_STR_FOLDER[0]);
|
|
||||||
lcd_print_pad(longFilename, len);
|
lcd_print_pad(longFilename, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define MENU_ITEM_SDDIR(str_fn, str_fnl) do { menu_item_sddir(str_fn, str_fnl); } while (0)
|
#define MENU_ITEM_SDDIR(str_fn, str_fnl) do { menu_item_sddir(str_fn, str_fnl); } while (0)
|
||||||
#define MENU_ITEM_SDFILE(str_fn, str_fnl) do { menu_item_sdfile(str_fn, str_fnl); } while (0)
|
#define MENU_ITEM_SDFILE(str_fn, str_fnl) do { menu_item_sdfile(str_fn, str_fnl); } while (0)
|
||||||
|
|
||||||
|
|
@ -2935,9 +2931,8 @@ static const char* lcd_display_message_fullscreen_nonBlocking_P(const char *msg)
|
||||||
if (multi_screen) {
|
if (multi_screen) {
|
||||||
// Display the "next screen" indicator character.
|
// Display the "next screen" indicator character.
|
||||||
lcd_set_custom_characters_nextpage();
|
lcd_set_custom_characters_nextpage();
|
||||||
lcd_set_cursor(19, 3);
|
|
||||||
// Display the double down arrow.
|
// Display the double down arrow.
|
||||||
lcd_print(LCD_STR_ARROW_2_DOWN[0]);
|
lcd_putc_at(19, 3, LCD_STR_ARROW_2_DOWN[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return multi_screen ? msgend : NULL;
|
return multi_screen ? msgend : NULL;
|
||||||
|
|
@ -2969,9 +2964,8 @@ void lcd_show_fullscreen_message_and_wait_P(const char *msg)
|
||||||
// Until confirmed by a button click.
|
// Until confirmed by a button click.
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (msg_next == NULL) {
|
if (msg_next == NULL) {
|
||||||
lcd_set_cursor(19, 3);
|
|
||||||
// Display the confirm char.
|
// Display the confirm char.
|
||||||
lcd_print(LCD_STR_CONFIRM[0]);
|
lcd_putc_at(19, 3, LCD_STR_CONFIRM[0]);
|
||||||
}
|
}
|
||||||
// Wait for 5 seconds before displaying the next text.
|
// Wait for 5 seconds before displaying the next text.
|
||||||
for (uint8_t i = 0; i < 100; ++ i) {
|
for (uint8_t i = 0; i < 100; ++ i) {
|
||||||
|
|
@ -4785,8 +4779,7 @@ char reset_menu() {
|
||||||
};
|
};
|
||||||
|
|
||||||
lcd_clear();
|
lcd_clear();
|
||||||
lcd_set_cursor(0, 0);
|
lcd_putc_at(0, 0, '>');
|
||||||
lcd_putc('>');
|
|
||||||
lcd_consume_click();
|
lcd_consume_click();
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
|
|
@ -5139,8 +5132,7 @@ static void lcd_rename_sheet_menu()
|
||||||
{
|
{
|
||||||
lcd_putc(menuData->name[i]);
|
lcd_putc(menuData->name[i]);
|
||||||
}
|
}
|
||||||
lcd_set_cursor(menuData->selected, 1);
|
lcd_putc_at(menuData->selected, 1, '^');
|
||||||
lcd_putc('^');
|
|
||||||
if (lcd_clicked())
|
if (lcd_clicked())
|
||||||
{
|
{
|
||||||
if ((menuData->selected + 1u) < sizeof(Sheet::name))
|
if ((menuData->selected + 1u) < sizeof(Sheet::name))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue