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:
Guðni Már Gilbert 2023-02-22 18:30:51 +00:00 committed by DRracer
parent 062ea1cf25
commit 4ca7f8ce2d
2 changed files with 5 additions and 4 deletions

View File

@ -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();
}
}

View File

@ -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;