Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option for rotational axis #624

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading