Skip to content

Commit

Permalink
2.31.2
Browse files Browse the repository at this point in the history
  • Loading branch information
olikraus committed Sep 20, 2021
1 parent c232065 commit 716d7ad
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Description: https://github.com/olikraus/u8g2/wiki

Issue Tracker: https://github.com/olikraus/u8g2/issues

Download (2.31.1): https://github.com/olikraus/U8g2_Arduino/archive/master.zip
Download (2.31.2): https://github.com/olikraus/U8g2_Arduino/archive/master.zip

3 changes: 3 additions & 0 deletions extras/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,6 @@ https://github.com/olikraus/u8g2 ChangeLog
* Bugfix drawButtonUTF8 (added C++ code, issue 1577)
2021-09-19 v2.31.1 [email protected]
* Added icons from https://app.streamlinehq.com/icons/pixel (issue 1589)
2021-09-20 v2.31.2 [email protected]
* Bugfix release for include error (issues 1592 and 1594)

2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=U8g2
version=2.31.1
version=2.31.2
author=oliver <[email protected]>
maintainer=oliver <[email protected]>
sentence=Monochrome LCD, OLED and eInk Library. Display controller: SSD1305, SSD1306, SSD1309, SSD1316, SSD1320, SSD1322, SSD1325, SSD1327, SSD1329, SSD1606, SSD1607, SH1106, SH1107, SH1108, SH1122, T6963, RA8835, LC7981, PCD8544, PCF8812, HX1230, UC1601, UC1604, UC1608, UC1610, UC1611, UC1617, UC1638, UC1701, ST7511, ST7528, ST7565, ST7567, ST7571, ST7586, ST7588, ST75256, ST75320, NT7534, ST7920, IST3020, IST7920, LD7032, KS0108, KS0713, HD44102, T7932, SED1520, SBN1661, IL3820, MAX7219. Interfaces: I2C, SPI, Parallel.
Expand Down
5 changes: 5 additions & 0 deletions src/clib/mui.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,11 @@ void mui_EnterForm(mui_t *ui, fds_t *fds, uint8_t initial_cursor_position)
ui->touch_focus_fds = NULL;
ui->cursor_focus_fds = NULL;

/* reset all the scoll values */
ui->form_scroll_top = 0;
ui->form_scroll_visible = 0;
ui->form_scroll_total = 0;

/* assign the form, which should be entered */
ui->current_form_fds = fds;

Expand Down
80 changes: 74 additions & 6 deletions src/clib/mui_u8g2.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ uint8_t mui_u8g2_u8_opt_line_wa_mse_pi(mui_t *ui, uint8_t msg)
{
*value = 0;
mui_fds_get_nth_token(ui, *value);
}
}
mui_u8g2_draw_button_utf(ui, mui_u8g2_get_draw_button_pi_flags(ui), ui->arg, 1, MUI_U8G2_V_PADDING, ui->text);
//u8g2_DrawButtonUTF8(u8g2, mui_get_x(ui), mui_get_y(ui), mui_u8g2_get_draw_button_pi_flags(ui), ui->arg, 1, MUI_U8G2_V_PADDING, ui->text);

Expand Down Expand Up @@ -1042,13 +1042,14 @@ uint8_t mui_u8g2_u8_opt_child_mse_common(mui_t *ui, uint8_t msg)
break;
case MUIF_MSG_FORM_START:
/* we can assume that the list starts at the top. It will be adjisted by cursor down events later */
ui->form_scroll_top = 0;
/* ui->form_scroll_top = 0 and all other form_scroll values are set to 0 if a new form is entered in mui_EnterForm() */
if ( ui->form_scroll_visible <= arg )
ui->form_scroll_visible = arg+1;
if ( ui->form_scroll_total == 0 )
ui->form_scroll_total = mui_GetSelectableFieldOptionCnt(ui, ui->last_form_id, ui->last_form_cursor_focus_position);
//printf("MUIF_MSG_FORM_START: arg=%d visible=%d top=%d total=%d\n", arg, ui->form_scroll_visible, ui->form_scroll_top, ui->form_scroll_total);
break;
case MUIF_MSG_FORM_END:
case MUIF_MSG_FORM_END:
break;
case MUIF_MSG_CURSOR_ENTER:
break;
Expand All @@ -1063,7 +1064,7 @@ uint8_t mui_u8g2_u8_opt_child_mse_common(mui_t *ui, uint8_t msg)
case MUIF_MSG_TOUCH_UP:
break;
case MUIF_MSG_EVENT_NEXT:
//printf("MUIF_MSG_EVENT_NEXT: arg=%d form_scroll_visible=%d\n", arg, ui->form_scroll_visible);
//printf("MUIF_MSG_EVENT_NEXT: arg=%d visible=%d top=%d total=%d\n", arg, ui->form_scroll_visible, ui->form_scroll_top, ui->form_scroll_total);
if ( arg+1 == ui->form_scroll_visible )
{
if ( ui->form_scroll_visible + ui->form_scroll_top < ui->form_scroll_total )
Expand Down Expand Up @@ -1096,7 +1097,7 @@ uint8_t mui_u8g2_u8_opt_child_mse_common(mui_t *ui, uint8_t msg)
}


uint8_t mui_u8g2_u8_opt_child_wm_mse_pi(mui_t *ui, uint8_t msg)
uint8_t mui_u8g2_u8_opt_radio_child_wm_mse_pi(mui_t *ui, uint8_t msg)
{
u8g2_t *u8g2 = mui_get_U8g2(ui);
uint8_t *value = (uint8_t *)muif_get_data(ui->uif);
Expand Down Expand Up @@ -1141,7 +1142,7 @@ uint8_t mui_u8g2_u8_opt_child_wm_mse_pi(mui_t *ui, uint8_t msg)
}


uint8_t mui_u8g2_u8_opt_child_w1_mse_pi(mui_t *ui, uint8_t msg)
uint8_t mui_u8g2_u8_opt_radio_child_w1_mse_pi(mui_t *ui, uint8_t msg)
{
u8g2_t *u8g2 = mui_get_U8g2(ui);
uint8_t *value = (uint8_t *)muif_get_data(ui->uif);
Expand Down Expand Up @@ -1186,6 +1187,45 @@ uint8_t mui_u8g2_u8_opt_child_w1_mse_pi(mui_t *ui, uint8_t msg)
return 0;
}


uint8_t mui_u8g2_u8_opt_child_wm_mse_pi(mui_t *ui, uint8_t msg)
{
u8g2_t *u8g2 = mui_get_U8g2(ui);
//uint8_t *value = (uint8_t *)muif_get_data(ui->uif);
uint8_t arg = ui->arg; // remember the arg value, because it might be overwritten

switch(msg)
{
case MUIF_MSG_DRAW:
{
//u8g2_uint_t w = 0;
u8g2_uint_t x = mui_get_x(ui); // if mui_GetSelectableFieldTextOption is called, then field vars are overwritten, so get the value
u8g2_uint_t y = mui_get_y(ui); // if mui_GetSelectableFieldTextOption is called, then field vars are overwritten, so get the value
uint8_t flags = mui_u8g2_get_draw_button_pi_flags(ui);
//if ( mui_IsCursorFocus(ui) )
//{
// flags = U8G2_BTN_INV;
//}

if ( ui->text[0] == '\0' )
{
/* if the text is not provided, then try to get the text from the previous (saved) element, assuming that this contains the selection */
/* this will overwrite all ui member functions, so we must not access any ui members (except ui->text) any more */
mui_GetSelectableFieldTextOption(ui, ui->last_form_id, ui->last_form_cursor_focus_position, arg + ui->form_scroll_top);
}
if ( ui->text[0] != '\0' )
{
u8g2_DrawButtonUTF8(u8g2, x, y, flags, 0, 1, MUI_U8G2_V_PADDING, ui->text);
}
}
break;
default:
return mui_u8g2_u8_opt_child_mse_common(ui, msg);
}
return 0;
}


/*
data: mui_u8g2_list_t *
*/
Expand Down Expand Up @@ -1424,3 +1464,31 @@ uint8_t mui_u8g2_u16_list_child_w1_mse_pi(mui_t *ui, uint8_t msg)
}
return 0;
}

uint8_t mui_u8g2_u16_list_goto_w1_mse_pi(mui_t *ui, uint8_t msg)
{
u8g2_t *u8g2 = mui_get_U8g2(ui);
mui_u8g2_list_t *list = (mui_u8g2_list_t *)muif_get_data(ui->uif);
uint16_t *selection = mui_u8g2_list_get_selection_ptr(list);
void *data = mui_u8g2_list_get_data_ptr(list);
mui_u8g2_get_list_element_cb element_cb = mui_u8g2_list_get_element_cb(list);
//mui_u8g2_get_list_count_cb count_cb = mui_u8g2_list_get_count_cb(list);

uint16_t pos = ui->arg; // remember the arg value, because it might be overwritten
pos += ui->form_scroll_top;

switch(msg)
{
case MUIF_MSG_DRAW:
mui_u8g2_draw_button_utf(ui, mui_u8g2_get_draw_button_pi_flags(ui), u8g2_GetDisplayWidth(u8g2), 1, MUI_U8G2_V_PADDING, element_cb(data, pos)+1);
break;
case MUIF_MSG_CURSOR_SELECT:
if ( selection != NULL )
*selection = pos;
mui_GotoForm(ui, (uint8_t)element_cb(data, pos)[0], 0);
break;
default:
return mui_u8g2_u16_list_child_mse_common(ui, msg);
}
return 0;
}
7 changes: 5 additions & 2 deletions src/clib/mui_u8g2.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#ifndef MUI_U8G2_H
#define MUI_U8G2_H

#include <mui.h>
#include "mui.h"

/*==========================================*/
/* C++ compatible */
Expand Down Expand Up @@ -130,8 +130,9 @@ uint8_t mui_u8g2_u8_opt_line_wa_mse_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_opt_line_wa_mud_pi(mui_t *ui, uint8_t msg);

uint8_t mui_u8g2_u8_opt_parent_wm_mse_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_opt_radio_child_wm_mse_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_opt_radio_child_w1_mse_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_opt_child_wm_mse_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_opt_child_w1_mse_pi(mui_t *ui, uint8_t msg);

uint8_t mui_u8g2_u8_chkbox_wm_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_radio_wm_pi(mui_t *ui, uint8_t msg);
Expand Down Expand Up @@ -165,6 +166,8 @@ uint8_t mui_u8g2_u16_list_line_wa_mud_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u16_list_parent_wm_mse_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u16_list_child_w1_mse_pi(mui_t *ui, uint8_t msg);

uint8_t mui_u8g2_u16_list_goto_w1_mse_pi(mui_t *ui, uint8_t msg); /* first char of the string denotes the target form */


#ifdef __cplusplus
}
Expand Down

0 comments on commit 716d7ad

Please sign in to comment.