diff --git a/uCNC/cnc_hal_config.h b/uCNC/cnc_hal_config.h index e67c9d3d..0b8ac505 100644 --- a/uCNC/cnc_hal_config.h +++ b/uCNC/cnc_hal_config.h @@ -107,6 +107,17 @@ extern "C" */ // #define ENABLE_XY_SIMULTANEOUS_HOMING +/** + * Rotational axis - force relative distances + * Enable this option if you want the rotation axis to work in relative distance mode only + * This will mean that no matter if the machine is working in absolute (G90) or relative (G91) coordinates + * the rotational axis will always calculate the motion in relative distance mode + * +*/ +// #define AXIS_A_FORCE_RELATIVE_MODE +// #define AXIS_B_FORCE_RELATIVE_MODE +// #define AXIS_C_FORCE_RELATIVE_MODE + /** * Uncomment this feature to enable multi motor axis * NOTE: If Laser PPI is enabled one of the stepper drivers position will be used by the laser controller diff --git a/uCNC/src/core/parser.c b/uCNC/src/core/parser.c index 8383bcec..39ff4b87 100644 --- a/uCNC/src/core/parser.c +++ b/uCNC/src/core/parser.c @@ -1402,19 +1402,31 @@ uint8_t parser_exec_command(parser_state_t *new_state, parser_words_t *words, pa #ifdef AXIS_A if (CHECKFLAG(cmd->words, GCODE_WORD_A)) { +#ifndef AXIS_A_FORCE_RELATIVE_MODE target[AXIS_A] = (abspos) ? words->xyzabc[AXIS_A] : (words->xyzabc[AXIS_A] + target[AXIS_A]); +#else + target[AXIS_A] = (words->xyzabc[AXIS_A] + target[AXIS_A]); +#endif } #endif #ifdef AXIS_B if (CHECKFLAG(cmd->words, GCODE_WORD_B)) { +#ifndef AXIS_B_FORCE_RELATIVE_MODE target[AXIS_B] = (abspos) ? words->xyzabc[AXIS_B] : (words->xyzabc[AXIS_B] + target[AXIS_B]); +#else + target[AXIS_B] = (words->xyzabc[AXIS_B] + target[AXIS_B]); +#endif } #endif #ifdef AXIS_C if (CHECKFLAG(cmd->words, GCODE_WORD_C)) { +#ifndef AXIS_C_FORCE_RELATIVE_MODE target[AXIS_C] = (abspos) ? words->xyzabc[AXIS_C] : (words->xyzabc[AXIS_C] + target[AXIS_C]); +#else + target[AXIS_C] = (words->xyzabc[AXIS_C] + target[AXIS_C]); +#endif } #endif