Skip to content

Commit 6c1462c

Browse files
committed
Add a kinematics API for getting the name on an axis
Add an API to the kinematics library that will return the character name of an axis type.
1 parent ab4caeb commit 6c1462c

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

src/core/kinematics/kinematics.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,29 @@ axis_type_t kinematics_axis_type_from_char(char type_char) {
117117
return type;
118118
}
119119

120+
char kinematics_axis_type_to_char(const axis_type_t type) {
121+
switch (type) {
122+
case AXIS_TYPE_A:
123+
return 'A';
124+
case AXIS_TYPE_B:
125+
return 'B';
126+
case AXIS_TYPE_C:
127+
return 'C';
128+
case AXIS_TYPE_E:
129+
return 'E';
130+
case AXIS_TYPE_X:
131+
return 'X';
132+
case AXIS_TYPE_Y:
133+
return 'Y';
134+
case AXIS_TYPE_Z:
135+
return 'Z';
136+
case AXIS_TYPE_MAX:
137+
break;
138+
}
139+
140+
return '\0';
141+
}
142+
120143
void *kinematics_get_config(void) {
121144
switch (core_kinematics.type) {
122145
case KINEMATICS_CARTESIAN:

src/core/kinematics/kinematics.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ typedef struct {
8686
int kinematics_init(kinematics_config_t *config);
8787
kinematics_type_t kinematics_type_get(void);
8888
axis_type_t kinematics_axis_type_from_char(char type_char);
89+
char kinematics_axis_type_to_char(const axis_type_t);
8990
void *kinematics_get_config(void);
9091
int kinematics_get_motor_movement(coordinates_t *delta,
9192
coordinates_t *movement);

0 commit comments

Comments
 (0)