Skip to content

Commit 5f10ab7

Browse files
authored
Merge pull request #4098 from Sigma1912/fix_g52_g92_reset_on_m2
fix(interp): reset G52/G92 offsets on prog_stop when DISABLE_G92_PERSISTENCE=1
2 parents ca66074 + 566e655 commit 5f10ab7

5 files changed

Lines changed: 30 additions & 7 deletions

File tree

docs/src/config/ini-config.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ The maximum number of `USER_M_PATH` directories is defined at compile time (typ:
633633
Preserve case in O-word names within comments if set, enables reading of mixed-case HAL items in structured comments like `(debug, #<_hal[MixedCaseItem])`.
634634
* `OWORD_WARNONLY = 0` (Default: 0) +
635635
Warn rather than error in case of errors in O-word subroutines.
636-
* `DISABLE_G92_PERSISTENCE = 0` (Default: 0)
636+
* `DISABLE_G92_PERSISTENCE = 0` (bool, Default: 0)
637637
Allow to clear the G92 offset automatically when config start-up.
638638
* `DISABLE_AUTO_G54 = 0` (bool, Default: 0) +
639639
When set M2 and M30 will no longer automatically reset the active WCS to 'G54'.

src/emc/rs274ngc/interp_convert.cc

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5262,10 +5262,32 @@ int Interp::convert_stop(block_pointer block, //!< pointer to a block of RS27
52625262
}
52635263

52645264
/*10*/
5265-
if (settings->disable_g92_persistence)
5265+
if (settings->disable_g92_persistence) {
52665266
// Clear G92/G52 offset
52675267
for (index=5210; index<=5219; index++)
52685268
settings->parameters[index] = 0;
5269+
settings->current_x = settings->current_x + settings->axis_offset_x;
5270+
settings->current_y = settings->current_y + settings->axis_offset_y;
5271+
settings->current_z = settings->current_z + settings->axis_offset_z;
5272+
settings->AA_current = (settings->AA_current + settings->AA_axis_offset);
5273+
settings->BB_current = (settings->BB_current + settings->BB_axis_offset);
5274+
settings->CC_current = (settings->CC_current + settings->CC_axis_offset);
5275+
settings->u_current = (settings->u_current + settings->u_axis_offset);
5276+
settings->v_current = (settings->v_current + settings->v_axis_offset);
5277+
settings->w_current = (settings->w_current + settings->w_axis_offset);
5278+
5279+
SET_G92_OFFSET(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
5280+
5281+
settings->axis_offset_x = 0.0;
5282+
settings->axis_offset_y = 0.0;
5283+
settings->axis_offset_z = 0.0;
5284+
settings->AA_axis_offset = 0.0;
5285+
settings->BB_axis_offset = 0.0;
5286+
settings->CC_axis_offset = 0.0;
5287+
settings->u_axis_offset = 0.0;
5288+
settings->v_axis_offset = 0.0;
5289+
settings->w_axis_offset = 0.0;
5290+
}
52695291

52705292
if (block->m_modes[4] == 30)
52715293
PALLET_SHUTTLE();

src/emc/rs274ngc/interp_internal.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ struct setup
824824
// control to skip to beginning of file
825825
bool loop_on_main_m99;
826826

827-
int disable_g92_persistence;
827+
bool disable_g92_persistence;
828828
bool disable_auto_g54;
829829

830830
// add new geometric fields for our new tags

src/emc/rs274ngc/interp_setup.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ setup::setup() :
186186
feature_set(0),
187187
disable_fanuc_style_sub(false),
188188
loop_on_main_m99(false),
189-
disable_g92_persistence(0),
189+
disable_g92_persistence(false),
190190
disable_auto_g54(false),
191191
heading(0.0),
192192
radius(0.0),

tests/interp/g52/g92-offset-persistence/expected

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ G92 params: 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.00
5353
12 N..... SET_FEED_RATE(0.0000)
5454
13 N..... STOP_SPINDLE_TURNING(0)
5555
14 N..... SET_SPINDLE_MODE(0 0.0000)
56-
15 N..... PALLET_SHUTTLE()
57-
16 N..... PROGRAM_END()
58-
17 N..... ON_RESET()
56+
15 N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
57+
16 N..... PALLET_SHUTTLE()
58+
17 N..... PROGRAM_END()
59+
18 N..... ON_RESET()

0 commit comments

Comments
 (0)