A fairly mysterious situation happened recently in the MK3 branch.
After merging #3033 (change watchdogReset() into a single inline wdr instruction)
we were unable to flash languages.
Since it looked similarly suspicious like issue #2954 we started investigating deeply.
The problem was in the code as described in the comment in this PR.
Instead of resetting the encoder status when homing or leveling, simply
exit the move/liveZ menu.
When transitioning from idle->printing, axis move shouldn't be allowed
as it would insert moves during a print. This is always wrong.
The menu must be always dismissed. Instead of checking all places where
the menu could be active, automatically dimiss the menu from within
_lcd_move when homing/MBL is happening. The long-push function and the
settings menu checks if "axis move" is possible, and thus
prevent the user to re-enter the menu already.
When doing the first layer calibration, the _lcd_babystep_z is
automatically brought back after MBL has completed.
Technically we should do the same when entering/exiting the paused state
in _lcd_move. However, it's better to dismiss _any_ menu in
stop_and_save_print_to_ram/restore_print_from_ram_and_continue instead.
To be done later...
Move axis queues movements, which disrupts a normal print, homing (when
XY is combined) or MBL.
Likewise, "Disable steppers" only makes sense when the printer is fully
idle.
Only allow such actions when the printer is not active and/or in the
paused state.
Further restrict babystep insertion when the lcd_update is enabled by
toggling homing_flag when probing Z (where Z shouldn't be touched
anyway as it would disrupt the measurement)
Also reset the encoder value during mesh leveling.
The code around these calls _requires_ that the steps are immediately
processed and/or added to the subsequent planner moves.
The only part that doesn't care about immediate insertion is the
direct user-insertion though the lcd encoder.