Introduce lcd_show_yes_no_and_wait for future use

Split off yes/no lcd handling from
lcd_show_fullscreen_message_yes_no_and_wait_P into a separate function
in order to allow generic requests where the text prompt can change.
This commit is contained in:
Yuri D'Elia 2021-03-28 16:39:02 +02:00
parent f97808e19a
commit 9b6fca9214
2 changed files with 18 additions and 6 deletions

View File

@ -3579,18 +3579,14 @@ int8_t lcd_show_multiscreen_message_two_choices_and_wait_P(const char *msg, bool
}
}
//! @brief Show single screen message with yes and no possible choices and wait with possible timeout
//! @param msg Message to show
//! @brief Display and wait for a Yes/No choice using the last two lines of the LCD
//! @param allow_timeouting if true, allows time outing of the screen
//! @param default_yes if true, yes choice is selected by default, otherwise no choice is preselected
//! @retval 1 yes choice selected by user
//! @retval 0 no choice selected by user
//! @retval -1 screen timed out
int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting, bool default_yes)
int8_t lcd_show_yes_no_and_wait(bool allow_timeouting, bool default_yes)
{
lcd_display_message_fullscreen_P(msg);
if (default_yes) {
lcd_putc_at(0, 2, '>');
lcd_puts_P(_T(MSG_YES));
@ -3643,6 +3639,20 @@ int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow
return retval;
}
//! @brief Show single screen message with yes and no possible choices and wait with possible timeout
//! @param msg Message to show
//! @param allow_timeouting if true, allows time outing of the screen
//! @param default_yes if true, yes choice is selected by default, otherwise no choice is preselected
//! @retval 1 yes choice selected by user
//! @retval 0 no choice selected by user
//! @retval -1 screen timed out
//! @relates lcd_show_yes_no_and_wait
int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting, bool default_yes)
{
lcd_display_message_fullscreen_P(msg);
return lcd_show_yes_no_and_wait(allow_timeouting, default_yes);
}
void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, uint8_t point_too_far_mask)
{
const char *msg = NULL;

View File

@ -72,6 +72,8 @@ extern void lcd_wait_for_click();
extern bool lcd_wait_for_click_delay(uint16_t nDelay);
extern void lcd_show_fullscreen_message_and_wait_P(const char *msg);
// 0: no, 1: yes, -1: timeouted
extern int8_t lcd_show_yes_no_and_wait(bool allow_timeouting = true, bool default_yes = false);
// 0: no, 1: yes, -1: timeouted
extern int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false);
extern int8_t lcd_show_multiscreen_message_two_choices_and_wait_P(const char *msg, bool allow_timeouting, bool default_yes,
const char *first_choice, const char *second_choice);