From 9047ffabf0b5661a8eec351fb2104180e5bc32ff Mon Sep 17 00:00:00 2001 From: kraus Date: Wed, 1 Sep 2021 22:01:29 +0200 Subject: [PATCH] issue #1572 --- .../MUICountDown/MUICountDown.ino | 19 +++++----------- sys/sdl/mui/main.c | 18 +++++++++++---- tools/font/battery/battery19.bdf | 21 +++++++++++++++++- tools/font/battery/battery19.fon | Bin 944 -> 944 bytes tools/font/bdf/battery19.bdf | 21 +++++++++++++++++- 5 files changed, 59 insertions(+), 20 deletions(-) diff --git a/sys/arduino/u8g2_page_buffer/MUICountDown/MUICountDown.ino b/sys/arduino/u8g2_page_buffer/MUICountDown/MUICountDown.ino index 85bf897a..a7c3793b 100644 --- a/sys/arduino/u8g2_page_buffer/MUICountDown/MUICountDown.ino +++ b/sys/arduino/u8g2_page_buffer/MUICountDown/MUICountDown.ino @@ -305,8 +305,7 @@ uint8_t number_input = 2; // variable where the user can input a number be uint8_t exit_code = 0; // return value from the menu system extern "C" uint8_t mui_style_helv_r_08(mui_t *ui, uint8_t msg) -{ - +{ u8g2_t *u8g2 = mui_get_U8g2(ui); switch(msg) { @@ -412,8 +411,7 @@ long milliseconds = 0; void loop(void) { /* check whether the menu is active */ - if ( mui.isFormActive() ) - { + if ( mui.isFormActive() ) { /* if so, then draw the menu */ if ( is_redraw ) { @@ -444,19 +442,14 @@ void loop(void) { if ( mui.isFormActive() ) milliseconds = ((long)number_input) * 1000; - } - else - { + } else { /* menu not active: show countdown */ - if ( milliseconds <= 0 ) - { + if ( milliseconds <= 0 ) { /* countdown reached 0: activate menu again */ mui.gotoForm(/* form_id= */ 1, /* initial_cursor_position= */ 0); - } - else - { + } else { /* execute countdown */ u8g2.setFont(U8G2_FONT); u8g2.firstPage(); @@ -467,9 +460,7 @@ void loop(void) { milliseconds -= 100; delay(100); } - } - } diff --git a/sys/sdl/mui/main.c b/sys/sdl/mui/main.c index 13e89ec6..d9c8ad8c 100644 --- a/sys/sdl/mui/main.c +++ b/sys/sdl/mui/main.c @@ -58,6 +58,7 @@ uint8_t my_value3 = 0; uint8_t color_input = 0; uint8_t checkbox_input = 0; uint8_t direction_input = 0; +uint8_t exit_code = 0; /* @@ -113,8 +114,11 @@ muif_t muif_list[] = { MUIF(".L",0,0,mui_label_u8g2), /* button for the minimal example */ - MUIF("BN", MUIF_CFLAG_IS_CURSOR_SELECTABLE, 0, mui_leave_menu_frame_button_invers_select_u8g2) - + MUIF("BN", MUIF_CFLAG_IS_CURSOR_SELECTABLE, 0, mui_leave_menu_frame_button_invers_select_u8g2), + + /* Leave the menu system */ + MUIF("LV",MUIF_CFLAG_IS_CURSOR_SELECTABLE,&exit_code,mui_leave_menu_frame_button_invers_select_u8g2) + }; /* @@ -218,6 +222,13 @@ MUI_FORM(200) MUI_STYLE(0) MUI_XYT("BN",64, 30, " Select Me ") +MUI_FORM(201) +MUI_STYLE(0) +MUI_LABEL(5,12, "Countdown Time") +MUI_LABEL(5,30, "Seconds:") +MUI_XY("IN",60, 30) +MUI_XYT("LV",64, 59, " OK ") + ; int screenshot_n = 0; @@ -252,11 +263,10 @@ int main(void) u8x8_ConnectBitmapToU8x8(u8g2_GetU8x8(&u8g2)); /* connect to bitmap */ mui_Init(&ui, &u8g2, fds, muif_list, sizeof(muif_list)/sizeof(muif_t)); - mui_GotoForm(&ui, 200, 0); + mui_GotoForm(&ui, 201, 0); //puts(fds); - x = 4; // use as height for the box y = 0; diff --git a/tools/font/battery/battery19.bdf b/tools/font/battery/battery19.bdf index 7b2d746d..28f7a151 100644 --- a/tools/font/battery/battery19.bdf +++ b/tools/font/battery/battery19.bdf @@ -172,8 +172,27 @@ STARTCHAR 054 ENCODING 54 SWIDTH 648 0 DWIDTH 9 0 -BBX 0 0 0 0 +BBX 8 19 0 0 BITMAP +3C +FF +81 +81 +81 +89 +89 +99 +99 +BD +BD +99 +99 +91 +91 +81 +81 +81 +FF ENDCHAR STARTCHAR 055 ENCODING 55 diff --git a/tools/font/battery/battery19.fon b/tools/font/battery/battery19.fon index 4af2eb48eb5184cc54edacf3bed51be433b6e577..3f95c5c21aac9c3c6171898236835168928b813a 100644 GIT binary patch delta 31 ncmdnMzJYy13NydW|Hj6~&d!-L_wJoJbK=Cw{Y>JM6PVQi;WZ7s delta 18 XcmdnMzJYy13iIR%%nBep(SQd4K1l`N diff --git a/tools/font/bdf/battery19.bdf b/tools/font/bdf/battery19.bdf index 7b2d746d..28f7a151 100644 --- a/tools/font/bdf/battery19.bdf +++ b/tools/font/bdf/battery19.bdf @@ -172,8 +172,27 @@ STARTCHAR 054 ENCODING 54 SWIDTH 648 0 DWIDTH 9 0 -BBX 0 0 0 0 +BBX 8 19 0 0 BITMAP +3C +FF +81 +81 +81 +89 +89 +99 +99 +BD +BD +99 +99 +91 +91 +81 +81 +81 +FF ENDCHAR STARTCHAR 055 ENCODING 55