|
|
@ -66,11 +66,11 @@ uint8_t screen_history_depth = 0; |
|
|
|
bool screen_changed; |
|
|
|
|
|
|
|
// Value Editing
|
|
|
|
PGM_P editLabel; |
|
|
|
void *editValue; |
|
|
|
int32_t minEditValue, maxEditValue; |
|
|
|
screenFunc_t callbackFunc; |
|
|
|
bool liveEdit; |
|
|
|
PGM_P MenuItemBase::editLabel; |
|
|
|
void* MenuItemBase::editValue; |
|
|
|
int16_t MenuItemBase::minEditValue, MenuItemBase::maxEditValue; |
|
|
|
screenFunc_t MenuItemBase::callbackFunc; |
|
|
|
bool MenuItemBase::liveEdit; |
|
|
|
|
|
|
|
// Prevent recursion into screen handlers
|
|
|
|
bool no_reentry = false; |
|
|
@ -131,8 +131,8 @@ void MenuItem_gcode::action(PGM_P pgcode) { enqueue_and_echo_commands_P(pgcode); |
|
|
|
*/ |
|
|
|
void MenuItemBase::edit(strfunc_t strfunc, loadfunc_t loadfunc) { |
|
|
|
ui.encoder_direction_normal(); |
|
|
|
if ((int32_t)ui.encoderPosition < 0) ui.encoderPosition = 0; |
|
|
|
if ((int32_t)ui.encoderPosition > maxEditValue) ui.encoderPosition = maxEditValue; |
|
|
|
if (int16_t(ui.encoderPosition) < 0) ui.encoderPosition = 0; |
|
|
|
if (int16_t(ui.encoderPosition) > maxEditValue) ui.encoderPosition = maxEditValue; |
|
|
|
if (ui.should_draw()) |
|
|
|
draw_edit_screen(editLabel, strfunc(ui.encoderPosition + minEditValue)); |
|
|
|
if (ui.lcd_clicked || (liveEdit && ui.should_draw())) { |
|
|
@ -142,7 +142,7 @@ void MenuItemBase::edit(strfunc_t strfunc, loadfunc_t loadfunc) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void MenuItemBase::init(PGM_P const el, void * const ev, const int32_t minv, const int32_t maxv, const uint32_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le) { |
|
|
|
void MenuItemBase::init(PGM_P const el, void * const ev, const int16_t minv, const int16_t maxv, const uint16_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le) { |
|
|
|
ui.save_previous_screen(); |
|
|
|
ui.refresh(); |
|
|
|
editLabel = el; |
|
|
@ -193,7 +193,7 @@ bool printer_busy() { |
|
|
|
/**
|
|
|
|
* General function to go directly to a screen |
|
|
|
*/ |
|
|
|
void MarlinUI::goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/, const uint8_t top/*=0*/, const uint8_t items/*=0*/) { |
|
|
|
void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, const uint8_t top/*=0*/, const uint8_t items/*=0*/) { |
|
|
|
if (currentScreen != screen) { |
|
|
|
|
|
|
|
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) |
|
|
@ -364,7 +364,7 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) { |
|
|
|
#endif |
|
|
|
ui.encoder_direction_normal(); |
|
|
|
if (ui.encoderPosition) { |
|
|
|
const int16_t babystep_increment = (int32_t)ui.encoderPosition * (BABYSTEP_MULTIPLICATOR); |
|
|
|
const int16_t babystep_increment = int16_t(ui.encoderPosition) * (BABYSTEP_MULTIPLICATOR); |
|
|
|
ui.encoderPosition = 0; |
|
|
|
|
|
|
|
const float diff = planner.steps_to_mm[Z_AXIS] * babystep_increment, |
|
|
@ -438,7 +438,7 @@ void _lcd_draw_homing() { |
|
|
|
|
|
|
|
void do_select_screen(PGM_P const yes, PGM_P const no, bool &yesno, PGM_P const pref, const char * const string, PGM_P const suff) { |
|
|
|
if (ui.encoderPosition) { |
|
|
|
yesno = int32_t(ui.encoderPosition) > 0; |
|
|
|
yesno = int16_t(ui.encoderPosition) > 0; |
|
|
|
ui.encoderPosition = 0; |
|
|
|
} |
|
|
|
draw_select_screen(yes, no, yesno, pref, string, suff); |
|
|
|