cleanup: drop lcd_encoder in _menu_edit_P
Taken from PR 3985 by adding currentValue infrastructure Change in memory: Flash: 0 bytes SRAM: 0 bytes
This commit is contained in:
parent
062ea1cf25
commit
4ca7f8ce2d
|
|
@ -470,14 +470,14 @@ static void _menu_edit_P(void)
|
|||
menu_data_edit_t* _md = (menu_data_edit_t*)&(menu_data[0]);
|
||||
if (lcd_draw_update)
|
||||
{
|
||||
if (lcd_encoder < _md->minEditValue) lcd_encoder = _md->minEditValue;
|
||||
else if (lcd_encoder > _md->maxEditValue) lcd_encoder = _md->maxEditValue;
|
||||
// Constrain the value in case it's outside the allowed limits
|
||||
_md->currentValue = constrain(_md->currentValue, _md->minEditValue, _md->maxEditValue);
|
||||
lcd_set_cursor(0, 1);
|
||||
menu_draw_P(' ', _md->editLabel, lcd_encoder);
|
||||
menu_draw_P(' ', _md->editLabel, _md->currentValue);
|
||||
}
|
||||
if (lcd_clicked())
|
||||
{
|
||||
*((T)(_md->editValue)) = lcd_encoder;
|
||||
*((T)(_md->editValue)) = _md->currentValue;
|
||||
menu_back_no_reset();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ typedef struct
|
|||
//Variables used when editing values.
|
||||
const char* editLabel;
|
||||
void* editValue;
|
||||
int16_t currentValue;
|
||||
int16_t minEditValue;
|
||||
int16_t maxEditValue;
|
||||
} menu_data_edit_t;
|
||||
|
|
|
|||
Loading…
Reference in New Issue