mirror of
https://github.com/synthetos/g2.git
synced 2026-09-22 03:08:42 +08:00
Messing with axis types a bit
This commit is contained in:
@@ -128,7 +128,7 @@ static void _exec_absolute_origin(float *value, bool *flag);
|
||||
static void _exec_program_finalize(float *value, bool *flag);
|
||||
|
||||
static int8_t _get_axis(const index_t index);
|
||||
static int8_t _get_axis_type(const index_t index);
|
||||
static cmAxisType _get_axis_type(const index_t index);
|
||||
|
||||
/***********************************************************************************
|
||||
**** CODE *************************************************************************
|
||||
@@ -2107,12 +2107,12 @@ static int8_t _get_axis(const index_t index)
|
||||
return (ptr - axes);
|
||||
}
|
||||
|
||||
static int8_t _get_axis_type(const index_t index)
|
||||
static cmAxisType _get_axis_type(const index_t index)
|
||||
{
|
||||
int8_t axis = _get_axis(index);
|
||||
if (axis >= AXIS_A) return (1);
|
||||
if (axis == -1) return (-1);
|
||||
return (0);
|
||||
if (axis >= AXIS_A) return (AXIS_TYPE_ROTARY);
|
||||
if (axis == -1) return (AXIS_TYPE_UNDEFINED);
|
||||
return (AXIS_TYPE_LINEAR);
|
||||
}
|
||||
|
||||
/**** Functions called directly from cfgArray table - mostly wrappers ****
|
||||
@@ -2262,10 +2262,12 @@ stat_t cm_get_am(nvObj_t *nv)
|
||||
|
||||
stat_t cm_set_am(nvObj_t *nv) // axis mode
|
||||
{
|
||||
if (_get_axis_type(nv->index) == 0) { // linear
|
||||
if (nv->value > AXIS_MODE_MAX_LINEAR) { return (STAT_INPUT_VALUE_RANGE_ERROR);}
|
||||
|
||||
nv->valuetype = TYPE_INT;
|
||||
if (_get_axis_type(nv->index) == AXIS_TYPE_LINEAR) {
|
||||
if (nv->value > AXIS_MODE_LINEAR_MAX) { return (STAT_INPUT_VALUE_RANGE_ERROR);}
|
||||
} else {
|
||||
if (nv->value > AXIS_MODE_MAX_ROTARY) { return (STAT_INPUT_VALUE_RANGE_ERROR);}
|
||||
if (nv->value > AXIS_MODE_ROTARY_MAX) { return (STAT_INPUT_VALUE_RANGE_ERROR);}
|
||||
}
|
||||
cmAxisMode *am = (cmAxisMode *)cfgArray[nv->index].target;
|
||||
void *p = (cfgArray[nv->index].target);
|
||||
@@ -2274,11 +2276,10 @@ stat_t cm_set_am(nvObj_t *nv) // axis mode
|
||||
// cmAxisMode a = (cmAxisMode)nv->value;
|
||||
// *am = (cmAxisMode)nv->value;
|
||||
*am = a;
|
||||
nv->valuetype = TYPE_INT;
|
||||
return(STAT_OK);
|
||||
|
||||
set_ui8(nv);
|
||||
return(STAT_OK);
|
||||
// set_ui8(nv);
|
||||
// return(STAT_OK);
|
||||
}
|
||||
|
||||
#pragma GCC reset_options
|
||||
|
||||
@@ -276,14 +276,20 @@ typedef enum { // used for spindle and arc dir
|
||||
DIRECTION_CCW
|
||||
} cmDirection;
|
||||
|
||||
typedef enum { // axis types
|
||||
AXIS_TYPE_UNDEFINED=-1, // invalid type
|
||||
AXIS_TYPE_LINEAR, // linear axis
|
||||
AXIS_TYPE_ROTARY // rotary axis
|
||||
} cmAxisType;
|
||||
|
||||
typedef enum { // axis modes (ordered: see _cm_get_feed_time())
|
||||
AXIS_DISABLED = 0, // kill axis
|
||||
AXIS_STANDARD, // axis in coordinated motion w/standard behaviors
|
||||
AXIS_INHIBITED, // axis is computed but not activated
|
||||
AXIS_RADIUS // rotary axis calibrated to circumference
|
||||
} cmAxisMode;
|
||||
#define AXIS_MODE_MAX_LINEAR AXIS_INHIBITED
|
||||
#define AXIS_MODE_MAX_ROTARY AXIS_RADIUS
|
||||
#define AXIS_MODE_LINEAR_MAX AXIS_INHIBITED
|
||||
#define AXIS_MODE_ROTARY_MAX AXIS_RADIUS
|
||||
|
||||
/*****************************************************************************
|
||||
* GCODE MODEL - The following GCodeModel/GCodeInput structs are used:
|
||||
|
||||
@@ -267,7 +267,8 @@ const cfgItem_t cfgArray[] = {
|
||||
// { "6","6mt",_fip, 2, st_print_mt, get_flt, st_set_mt, (float *)&st_cfg.mot[MOTOR_6].motor_timeout, M6_MOTOR_TIMEOUT },
|
||||
#endif
|
||||
// Axis parameters
|
||||
{ "x","xam",_fip, 0, cm_print_am, cm_get_am, cm_set_am, (float *)&cm->a[AXIS_X].axis_mode, X_AXIS_MODE },
|
||||
{ "x","xam",_fip, 0, cm_print_am, cm_get_am, cm_set_am, (float *)&cs.null, X_AXIS_MODE },
|
||||
// { "x","xam",_fip, 0, cm_print_am, cm_get_am, cm_set_am, (float *)&cm->a[AXIS_X].axis_mode, X_AXIS_MODE },
|
||||
{ "x","xvm",_fipc, 0, cm_print_vm, get_flt, cm_set_vm, (float *)&cm->a[AXIS_X].velocity_max, X_VELOCITY_MAX },
|
||||
{ "x","xfr",_fipc, 0, cm_print_fr, get_flt, cm_set_fr, (float *)&cm->a[AXIS_X].feedrate_max, X_FEEDRATE_MAX },
|
||||
{ "x","xtn",_fipc, 3, cm_print_tn, get_flt, set_flu, (float *)&cm->a[AXIS_X].travel_min, X_TRAVEL_MIN },
|
||||
|
||||
Reference in New Issue
Block a user