Split the planner sync code out of planner_abort_hard() so that we can
independently resync the planner position from the counters.
This is needed in xyzcal as we directly modify the stepper counters
(bypassing both planner and stepper).
Call this new function instead of planner_abort_hard() when leaving, so
that motion can resume in the middle of the gcode_M45 instruction.
We already disable the heaters upon entering, and the new temperature
isr doesn't perform any direct movement until we return to the main
loop.
This allows us to remove direct control of the soft_pwm interrupt from
the header, which is dangerous.
printer_smodel_check was incorrectly substituting the final " with a
null in the command to simplify the model string comparison, but in
doing so was also corrupting the next pop from the cmdqueue.
We can modify the current strchr_pointer as long as we *don't* change
it's length. This can cause an incorrect extra read from the queue,
resulting in the last command to be completely ignored.
cmdqueue will run commands when EOF is reached without returning to the
main loop, which is already incorrect.
However, since it needs to ensure the queue is empty, an st_synchronize
call can result in a re-entrant call to get_command, which will
reprocess EOF again. Even if we removed st_synchronize, another command
could be picked by an unsuspecting manage_inactivity() somewhere else.
Short-circuit EOF processing by closing the file early and checking for
the file state early in get_command.
This should fix#3549
Call this variable menu_block_mask instead. We don't need to know the
exact reason of why we're locking the menu.
We will be able to reuse this to prevent menu entry during more
activities in a cleaner way than testing for each condition as it's
currently done for both menu entry and longpress.
This allows us to use "M310 B0 W0.01" as a way to report the current
error continuosly on the serial without 1) more code and 2) without
preventing regular usage.
Use OCTOPRINT_ASK_* for the present form of actions. In these cases the
host will perform the pausing manouvers for us.
Use OCTOPRINT_* instead for the past tense forms when we are in charge.
Also always emit the action, whether we are or not sd-printing. This is
due to the new Stopped handling behaving correctly in either case.