From: Jeff E. <gi...@gi...> - 2009-07-04 16:41:20
|
add a spindle speed output which is in revolutions per second revolutions per second is more sensible, because it lets the scale (e.g., of a stepgen being used in velocity mode) be 1 = 1 revolution, rather than 1 = 1/60 revolution http://git.linuxcnc.org/?p=emc2.git;a=commitdiff;h=7058bc0 --- docs/man/man9/motion.9 | 4 ++++ src/emc/motion/control.c | 2 ++ src/emc/motion/mot_priv.h | 1 + src/emc/motion/motion.c | 1 + 4 files changed, 8 insertions(+), 0 deletions(-) diff --git a/docs/man/man9/motion.9 b/docs/man/man9/motion.9 index 1dad603..ebdbb54 100644 --- a/docs/man/man9/motion.9 +++ b/docs/man/man9/motion.9 @@ -154,6 +154,10 @@ Actual spindle speed feedback in revolutions per second; used for G96 feed-per-r Desired spindle speed in rotations per minute .TP +\fBmotion.spindle-speed-out-rps\fR OUT float +Desired spindle speed in rotations per second + +.TP \fBmotion.spindle-at-speed\fR IN bit Motion will pause until this pin is TRUE, under the following conditions: before the first feed move after each spindle start or speed change; before the start of every diff --git a/src/emc/motion/control.c b/src/emc/motion/control.c index a31178a..1c63244 100644 --- a/src/emc/motion/control.c +++ b/src/emc/motion/control.c @@ -1768,8 +1768,10 @@ static void output_to_hal(void) speed = emcmotStatus->spindle.speed; *(emcmot_hal_data->spindle_speed_out) = speed; + *(emcmot_hal_data->spindle_speed_out_rps) = speed/60.; } else { *(emcmot_hal_data->spindle_speed_out) = emcmotStatus->spindle.speed * emcmotStatus->net_spindle_scale; + *(emcmot_hal_data->spindle_speed_out_rps) = emcmotStatus->spindle.speed * emcmotStatus->net_spindle_scale / 60.; } *(emcmot_hal_data->spindle_on) = ((emcmotStatus->spindle.speed * emcmotStatus->net_spindle_scale) != 0) ? 1 : 0; *(emcmot_hal_data->spindle_forward) = (*emcmot_hal_data->spindle_speed_out > 0) ? 1 : 0; diff --git a/src/emc/motion/mot_priv.h b/src/emc/motion/mot_priv.h index 91fd64a..29b19b2 100644 --- a/src/emc/motion/mot_priv.h +++ b/src/emc/motion/mot_priv.h @@ -132,6 +132,7 @@ typedef struct { // output of a prescribed speed (to hook-up to a velocity controller) hal_float_t *spindle_speed_out; /* spindle speed output */ + hal_float_t *spindle_speed_out_rps; /* spindle speed output */ hal_float_t *spindle_speed_in; /* spindle speed measured */ // FIXME - debug only, remove later diff --git a/src/emc/motion/motion.c b/src/emc/motion/motion.c index 748215a..b783998 100644 --- a/src/emc/motion/motion.c +++ b/src/emc/motion/motion.c @@ -297,6 +297,7 @@ static int init_hal_io(void) if ((retval = hal_pin_bit_newf(HAL_OUT, &(emcmot_hal_data->spindle_reverse), mot_comp_id, "motion.spindle-reverse")) < 0) goto error; if ((retval = hal_pin_bit_newf(HAL_OUT, &(emcmot_hal_data->spindle_brake), mot_comp_id, "motion.spindle-brake")) < 0) goto error; if ((retval = hal_pin_float_newf(HAL_OUT, &(emcmot_hal_data->spindle_speed_out), mot_comp_id, "motion.spindle-speed-out")) < 0) goto error; + if ((retval = hal_pin_float_newf(HAL_OUT, &(emcmot_hal_data->spindle_speed_out_rps), mot_comp_id, "motion.spindle-speed-out-rps")) < 0) goto error; // if ((retval = hal_pin_bit_newf(HAL_OUT, &(emcmot_hal_data->inpos_output), mot_comp_id, "motion.motion-inpos")) < 0) goto error; if ((retval = hal_pin_float_newf(HAL_IN, &(emcmot_hal_data->spindle_revs), mot_comp_id, "motion.spindle-revs")) < 0) goto error; |