Skip to content

Commit

Permalink
Fix reset from arc
Browse files Browse the repository at this point in the history
If an arc is in progress when a feedhold followed by
a ctrl-x reset comes in, the next move after the reset
is wrong.  For example:

G0 X0 Y0
G3 X0 Y0 I-100 J0 F500
!
CTRL-X
$J=G91 Z0.1 F100

Instead of the jog going only in the Z direction, there
will be motion in X and Y too.  The problem is caused
by incorrect synchronization of the GCode position after
the aborted arc.  The code incorrectly sets the GCode position
to the target of the arc, as if the arc had completed,
instead of setting it to the actual position that existed
at the time of the hold+reset.  (It is possible that the
same problem might occur without the feedhold, only the
reset.  In any case, this patch works in both scenarios.)
  • Loading branch information
MitchBradley committed Sep 2, 2023
1 parent 3edb01e commit a79981a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions FluidNC/src/Error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ std::map<Error, const char*> ErrorNames = {
{ Error::AuthenticationFailed, "Authentication failed!" },
{ Error::Eol, "End of line" },
{ Error::Eof, "End of file" },
{ Error::Reset, "System Reset" },
{ Error::AnotherInterfaceBusy, "Another interface is busy" },
{ Error::BadPinSpecification, "Bad Pin Specification" },
{ Error::JogCancelled, "Jog Cancelled" },
Expand Down
1 change: 1 addition & 0 deletions FluidNC/src/Error.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ enum class Error : uint8_t {
AuthenticationFailed = 110,
Eol = 111,
Eof = 112, // Not necessarily an error
Reset = 113,
AnotherInterfaceBusy = 120,
JogCancelled = 130,
BadPinSpecification = 150,
Expand Down
3 changes: 3 additions & 0 deletions FluidNC/src/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1620,6 +1620,9 @@ Error gc_execute_line(char* line) {
// As far as the parser is concerned, the position is now == target. In reality the
// motion control system might still be processing the action and the real tool position
// in any intermediate location.
if (sys.abort) {
return Error::Reset;
}
if (gc_update_pos == GCUpdatePos::Target) {
copyAxes(gc_state.position, gc_block.values.xyz);
} else if (gc_update_pos == GCUpdatePos::System) {
Expand Down

0 comments on commit a79981a

Please sign in to comment.