optimisation: reduce code size in rendering cursor

Change in memory:
Flash: -62 bytes
SRAM: 0 bytes
This commit is contained in:
Guðni Már Gilbert 2023-02-11 15:32:19 +00:00 committed by DRracer
parent c51aa10087
commit 504099bd6c
2 changed files with 8 additions and 16 deletions

View File

@ -171,18 +171,14 @@ static uint8_t ReportErrorHookMonitor(uint8_t ei) {
//! ----------------------
//! @endcode
//
lcd_set_cursor(0, 3);
lcd_print(current_selection == LCD_LEFT_BUTTON_CHOICE ? '>': ' ');
lcd_putc_at(0, 3, current_selection == LCD_LEFT_BUTTON_CHOICE ? '>': ' ');
if (two_choices == false)
{
lcd_set_cursor(9, 3);
lcd_print(current_selection == LCD_MIDDLE_BUTTON_CHOICE ? '>': ' ');
lcd_set_cursor(18, 3);
lcd_print(current_selection == LCD_RIGHT_BUTTON_CHOICE ? '>': ' ');
lcd_putc_at(9, 3, current_selection == LCD_MIDDLE_BUTTON_CHOICE ? '>': ' ');
lcd_putc_at(18, 3, current_selection == LCD_RIGHT_BUTTON_CHOICE ? '>': ' ');
} else {
// More button for two button screen
lcd_set_cursor(18, 3);
lcd_print(current_selection == LCD_MIDDLE_BUTTON_CHOICE ? '>': ' ');
lcd_putc_at(18, 3, current_selection == LCD_MIDDLE_BUTTON_CHOICE ? '>': ' ');
}
// Consume rotation event and make feedback sound
enc_dif = lcd_encoder_diff;

View File

@ -3089,16 +3089,12 @@ uint8_t lcd_show_multiscreen_message_yes_no_and_wait_P(const char *msg, bool all
//! @param third_choice text caption of third, optional, choice.
void lcd_show_choices_prompt_P(uint8_t selected, const char *first_choice, const char *second_choice, uint8_t second_col, const char *third_choice)
{
lcd_set_cursor(0, 3);
lcd_print(selected == LCD_LEFT_BUTTON_CHOICE ? '>': ' ');
lcd_putc_at(0, 3, selected == LCD_LEFT_BUTTON_CHOICE ? '>': ' ');
lcd_puts_P(first_choice);
lcd_set_cursor(second_col, 3);
lcd_print(selected == LCD_MIDDLE_BUTTON_CHOICE ? '>': ' ');
lcd_putc_at(second_col, 3, selected == LCD_MIDDLE_BUTTON_CHOICE ? '>': ' ');
lcd_puts_P(second_choice);
if (third_choice)
{
lcd_set_cursor(18, 3);
lcd_print(selected == LCD_RIGHT_BUTTON_CHOICE ? '>': ' ');
if (third_choice) {
lcd_putc_at(18, 3, selected == LCD_RIGHT_BUTTON_CHOICE ? '>': ' ');
lcd_puts_P(third_choice);
}
}