Encoder direction: Wrangle, Revert select screen change (#14628)
This commit is contained in:
committed by
Scott Lahteine
parent
9e19f004d0
commit
c9aa68ef7a
@ -130,7 +130,6 @@ void MenuItem_gcode::action(PGM_P const pgcode) { queue.inject_P(pgcode); }
|
||||
* MenuItem_int3::action_edit(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
|
||||
*/
|
||||
void MenuItemBase::edit(strfunc_t strfunc, loadfunc_t loadfunc) {
|
||||
ui.encoder_direction_normal();
|
||||
if (int16_t(ui.encoderPosition) < 0) ui.encoderPosition = 0;
|
||||
if (int16_t(ui.encoderPosition) > maxEditValue) ui.encoderPosition = maxEditValue;
|
||||
if (ui.should_draw())
|
||||
@ -276,7 +275,11 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co
|
||||
drawing_screen = false;
|
||||
#endif
|
||||
|
||||
set_ui_selection(false);
|
||||
#if HAS_LCD_MENU
|
||||
encoder_direction_normal();
|
||||
#endif
|
||||
|
||||
set_selection(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -371,7 +374,6 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) {
|
||||
#else
|
||||
constexpr bool do_probe = true;
|
||||
#endif
|
||||
ui.encoder_direction_normal();
|
||||
if (ui.encoderPosition) {
|
||||
const int16_t babystep_increment = int16_t(ui.encoderPosition) * (BABYSTEP_MULTIPLICATOR);
|
||||
ui.encoderPosition = 0;
|
||||
@ -448,14 +450,16 @@ void _lcd_draw_homing() {
|
||||
//
|
||||
// Selection screen presents a prompt and two options
|
||||
//
|
||||
bool ui_selection; // = false
|
||||
void set_ui_selection(const bool sel) { ui_selection = sel; }
|
||||
void do_select_screen(PGM_P const yes, PGM_P const no, selectFunc_t yesFunc, selectFunc_t noFunc, PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/) {
|
||||
if (ui.encoderPosition) {
|
||||
ui_selection = ((ENCODERBASE) > 0) == (int16_t(ui.encoderPosition) > 0);
|
||||
ui.encoderPosition = 0;
|
||||
bool MarlinUI::selection; // = false
|
||||
bool MarlinUI::update_selection() {
|
||||
if (encoderPosition) {
|
||||
selection = int16_t(encoderPosition) > 0;
|
||||
encoderPosition = 0;
|
||||
}
|
||||
const bool got_click = ui.use_click();
|
||||
return selection;
|
||||
}
|
||||
void do_select_screen(PGM_P const yes, PGM_P const no, selectFunc_t yesFunc, selectFunc_t noFunc, PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/) {
|
||||
const bool ui_selection = ui.update_selection(), got_click = ui.use_click();
|
||||
if (got_click || ui.should_draw()) {
|
||||
draw_select_screen(yes, no, ui_selection, pref, string, suff);
|
||||
if (got_click) { ui_selection ? yesFunc() : noFunc(); }
|
||||
|
Reference in New Issue
Block a user