Skip to content

Commit

Permalink
Merge pull request #624 from Paciente8159/axis-rotation-mode
Browse files Browse the repository at this point in the history
Added option for rotational axis
  • Loading branch information
Paciente8159 committed Feb 14, 2024
2 parents b8cf4e3 + c76b01e commit 665a1de
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions uCNC/cnc_hal_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions uCNC/src/core/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 665a1de

Please sign in to comment.