updates
This commit is contained in:
parent
2e000ed456
commit
f5edc62a29
|
@ -225,11 +225,12 @@ void set_date(uint8_t yt, uint8_t yo, uint8_t mt, uint8_t mo, uint8_t dayt, uint
|
|||
}
|
||||
|
||||
/* value 1..7, 0 is default (do not set) */
|
||||
void set_contrast(uint8_t v)
|
||||
void set_contrast(void)
|
||||
{
|
||||
uint8_t v = gui_data.contrast;
|
||||
if ( v > 0 )
|
||||
{
|
||||
v = v * 7*32;
|
||||
v = v * 36;
|
||||
u8g2_SetContrast(gui_menu.u8g2, v);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -876,9 +876,10 @@ int main()
|
|||
}
|
||||
|
||||
/*set a alarm time for testing */
|
||||
gui_alarm_list[0].enable = 1;
|
||||
gui_alarm_list[0].m = 1;
|
||||
gui_alarm_list[0].wd[5] = 1;
|
||||
//gui_alarm_list[0].enable = 1;
|
||||
//gui_alarm_list[0].m = 1;
|
||||
//gui_alarm_list[0].wd[5] = 1;
|
||||
|
||||
gui_Recalculate();
|
||||
|
||||
}
|
||||
|
@ -924,7 +925,8 @@ int main()
|
|||
|
||||
/* turn on display now */
|
||||
u8g2_SetPowerSave(&u8g2, 0); /* not required for the ALWAYS_ON mode, but does not matter in the other modes */
|
||||
u8g2_SetContrast(&u8g2, DISPLAY_CONTRAST_NORMAL);
|
||||
//u8g2_SetContrast(&u8g2, DISPLAY_CONTRAST_NORMAL);
|
||||
set_contrast();
|
||||
|
||||
/* get current voltage level of the battery */
|
||||
adc = readADC(5);
|
||||
|
|
|
@ -45,7 +45,7 @@ struct _gui_data
|
|||
|
||||
uint8_t is_alarm; /* input/calculated: set by the software, has to be reset by the user */
|
||||
uint8_t active_alarm_idx; /* input/calculated: set by the software, has to be reset by the user */
|
||||
uint8_t contrast;
|
||||
uint8_t contrast; /* value 1..7, 0 is default (do not set) */
|
||||
uint8_t display_voltage;
|
||||
|
||||
char s[16]; /* string buffer */
|
||||
|
@ -119,7 +119,7 @@ void enable_alarm(void);
|
|||
void disable_alarm(void);
|
||||
void set_time(uint8_t ht, uint8_t ho, uint8_t mt, uint8_t mo, uint8_t st, uint8_t so);
|
||||
void set_date(uint8_t yt, uint8_t yo, uint8_t mt, uint8_t mo, uint8_t dayt, uint8_t dayo, uint8_t weekday);
|
||||
void set_contrast(uint8_t v);
|
||||
void set_contrast(void); /* set contrast to gui_data.contrast, value 1..7, 0 is default (do not set) */
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -101,8 +101,10 @@ void set_date(uint8_t yt, uint8_t yo, uint8_t mt, uint8_t mo, uint8_t dayt, uint
|
|||
{
|
||||
}
|
||||
|
||||
/* value 1..7, 0 is default (do not set) */
|
||||
void set_contrast(uint8_t v)
|
||||
/* set contrast to gui_data.contrast, value 1..7, 0 is default (do not set) */
|
||||
void set_contrast(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -448,6 +448,10 @@ int me_cb_button_empty(menu_t *menu, const me_t *me, uint8_t msg)
|
|||
Name: me_cb_scale_1_7
|
||||
Val: uint8_t *
|
||||
*/
|
||||
|
||||
void set_contrast(void);
|
||||
|
||||
|
||||
int me_cb_scale_1_7(menu_t *menu, const me_t *me, uint8_t msg)
|
||||
{
|
||||
u8g2_uint_t x;
|
||||
|
@ -475,13 +479,16 @@ int me_cb_scale_1_7(menu_t *menu, const me_t *me, uint8_t msg)
|
|||
{
|
||||
val++;
|
||||
if ( val > 7 )
|
||||
val = 0;
|
||||
val = 1;
|
||||
*(uint8_t *)(me->val) = val;
|
||||
}
|
||||
return 1;
|
||||
case ME_MSG_DRAW:
|
||||
u8g2_SetFont(menu->u8g2, MENU_BIG_NUM);
|
||||
//u8g2_DrawGlyph(menu->u8g2, me->x, me->y, *(uint8_t *)(me->val) + '0');
|
||||
set_contrast(); /* give user feedback... not so nice: We assume *(uint8_t *)(me->val) points to gui_data.contrast */
|
||||
|
||||
//u8g2_SetFont(menu->u8g2, MENU_NORMAL_FONT);
|
||||
//u8g2_DrawGlyph(menu->u8g2, me->x, me->y-2, *(uint8_t *)(me->val) + '0');
|
||||
|
||||
u8g2_DrawHLine(menu->u8g2, me->x, me->y, 6*5+1);
|
||||
|
||||
u8g2_DrawVLine(menu->u8g2, me->x, me->y-2, 5);
|
||||
|
|
Loading…
Reference in New Issue