diff options
author | Chris Radek <chris@timeguy.com> | 2014-06-11 10:26:10 -0500 |
---|---|---|
committer | Chris Radek <chris@timeguy.com> | 2014-06-11 10:26:10 -0500 |
commit | 7897231f47fea04c2388b274a84df46517025cfd (patch) | |
tree | c9cff5400303d2305b7d2b92654730a4d1e02125 | |
parent | e9b0eab9ca835f85724cd6a7039117ea0d6ddbae (diff) | |
parent | 27f0bdd233e5e3f18c98b1894b7e5a240ec40b25 (diff) | |
download | linuxcnc-7897231f47fea04c2388b274a84df46517025cfd.tar.gz linuxcnc-7897231f47fea04c2388b274a84df46517025cfd.zip |
Merge branch '2.6'
-rw-r--r-- | configs/sim/axis/axis.ini | 6 | ||||
-rwxr-xr-x | configs/sim/axis/xhc-hb04/README | 26 | ||||
-rw-r--r-- | configs/sim/axis/xhc-hb04/xhc-hb04-layout1.ini | 7 | ||||
-rw-r--r-- | configs/sim/axis/xhc-hb04/xhc-hb04-layout2.ini | 32 | ||||
-rw-r--r-- | configs/sim/axis/xhc-hb04/xhc-hb04-layout2_mm.ini | 33 | ||||
-rw-r--r-- | docs/man/man1/halui.1 | 23 | ||||
-rw-r--r-- | docs/src/common/python-interface.txt | 3 | ||||
-rw-r--r-- | share/axis/tcl/axis.tcl | 52 | ||||
-rw-r--r-- | src/emc/kinematics/tp.c | 7 | ||||
-rw-r--r-- | src/emc/motion/command.c | 10 | ||||
-rw-r--r-- | src/emc/motion/control.c | 7 | ||||
-rw-r--r-- | src/emc/motion/motion.c | 1 | ||||
-rw-r--r-- | src/emc/motion/motion.h | 4 | ||||
-rw-r--r-- | src/emc/nml_intf/emc.cc | 13 | ||||
-rw-r--r-- | src/emc/nml_intf/emc.hh | 2 | ||||
-rw-r--r-- | src/emc/nml_intf/emc_nml.hh | 13 | ||||
-rw-r--r-- | src/emc/nml_intf/emcops.cc | 1 | ||||
-rw-r--r-- | src/emc/task/emctaskmain.cc | 13 | ||||
-rw-r--r-- | src/emc/task/taskintf.cc | 13 | ||||
-rw-r--r-- | src/emc/usr_intf/axis/extensions/emcmodule.cc | 12 | ||||
-rwxr-xr-x | src/emc/usr_intf/axis/scripts/axis.py | 24 | ||||
-rw-r--r-- | src/emc/usr_intf/halui.cc | 74 | ||||
-rw-r--r-- | src/hal/user_comps/xhc-hb04.cc | 58 |
23 files changed, 401 insertions, 33 deletions
diff --git a/configs/sim/axis/axis.ini b/configs/sim/axis/axis.ini index 7240f6075..9a25b0bf4 100644 --- a/configs/sim/axis/axis.ini +++ b/configs/sim/axis/axis.ini @@ -38,7 +38,7 @@ POSITION_FEEDBACK = ACTUAL MAX_FEED_OVERRIDE = 1.2 MAX_SPINDLE_OVERRIDE = 1.0 -MAX_LINEAR_VELOCITY = 1.2 +MAX_LINEAR_VELOCITY = 5 DEFAULT_LINEAR_VELOCITY = .25 # Prefix to be used PROGRAM_PREFIX = ../../nc_files/ @@ -126,9 +126,9 @@ HOME = 0 0 0 LINEAR_UNITS = inch ANGULAR_UNITS = degree CYCLE_TIME = 0.010 -DEFAULT_VELOCITY = 10 +DEFAULT_VELOCITY = 5 POSITION_FILE = position.txt -MAX_LINEAR_VELOCITY = 10 +MAX_LINEAR_VELOCITY = 5 # Axes sections --------------------------------------------------------------- diff --git a/configs/sim/axis/xhc-hb04/README b/configs/sim/axis/xhc-hb04/README index c5546f6e2..13ae26413 100755 --- a/configs/sim/axis/xhc-hb04/README +++ b/configs/sim/axis/xhc-hb04/README @@ -30,6 +30,29 @@ A hal pin (Type=bit, Dir=OUT) is created for each button, for example: xhc-hb04.button-rewind ... +If the configuration file includes buttons named: + button-zero + button-goto-zero + button-half +then the driver creates additional buttons for these that are active only if the axis is selected by the rotary switch. These synthesized buttons are: + button-zero-x + button-zero-y + button-zero-z + button-zero-a + button-goto-zero-x + button-goto-zero-y + button-goto-zero-z + button-goto-zero-a + button-half-x + button-half-y + button-half-z + button-half-a +As with real buttons, the synthesized buttons have hal pins named: + xhc-hb04button-zero-x + xhc-hb04button-zero-y + etc. + + Additional hal pins are created by the xhc-hb04 driver and connected as required by the halfile included for the demo configurations. A working and connected xhc-hb04 device is required for the demonstration configurations. If not connected, the sim configs will start without pendant functionality. @@ -60,8 +83,7 @@ sequence = 1 (1|2) The filter coefs can be used to slow the response to wheel steps but are usually not needed since the xhc-hb04 component implements smoothing. -The movement per wheel increment is normally controlled by connecting the STEP button to the hal pin xhc-hb04.stepsize-up. Each press of the STEP button will cause the wheel increment to increase according to the sequence specified. The sequence -starts over after the maximum value is reached. +The movement per wheel increment is normally controlled by connecting the STEP button to the hal pin xhc-hb04.stepsize-up. Each press of the STEP button will cause the wheel increment to increase according to the sequence specified. The sequence starts over after the maximum value is reached. The scale factor for each axis can be set with the scales item. diff --git a/configs/sim/axis/xhc-hb04/xhc-hb04-layout1.ini b/configs/sim/axis/xhc-hb04/xhc-hb04-layout1.ini index a5393c33e..14d26d170 100644 --- a/configs/sim/axis/xhc-hb04/xhc-hb04-layout1.ini +++ b/configs/sim/axis/xhc-hb04/xhc-hb04-layout1.ini @@ -39,7 +39,14 @@ probe-z = motion.probe-input x0 = halui.mdi-command-04 y0 = halui.mdi-command-05 z0 = halui.mdi-command-06 + goto-zero = halui.mdi-command-00 +# synthesized per-axis buttons for goto-zero button: +goto-zero-x = "" +goto-zero-y = "" +goto-zero-z = "" +goto-zero-a = "" + step = xhc-hb04.stepsize-up mode = "" spindle = "" diff --git a/configs/sim/axis/xhc-hb04/xhc-hb04-layout2.ini b/configs/sim/axis/xhc-hb04/xhc-hb04-layout2.ini index 9307d1fa4..57f9571f0 100644 --- a/configs/sim/axis/xhc-hb04/xhc-hb04-layout2.ini +++ b/configs/sim/axis/xhc-hb04/xhc-hb04-layout2.ini @@ -26,14 +26,34 @@ require_pendant = yes # note: "start-pause" is connected for standard behavior # controlling halui.pause/halui.resume/halui.run # these are examples, edit as required: + goto-zero = halui.mdi-command-00 +# synthesized per-axis buttons for goto-zero button: +goto-zero-x = "" +goto-zero-y = "" +goto-zero-z = "" +goto-zero-a = "" + start-pause = std_start_pause rewind = halui.program.step # probe-input for simulating a probe: probe-z = motion.probe-input macro-3 = halui.mdi-command-03 + half = halui.spindle.stop +# synthesized per-axis buttons for half button: +half-x = "" +half-y = "" +half-z = "" +half-a = "" + zero = "" +# synthesized per-axis buttons for zero button: +zero-x = halui.mdi-command-12 +zero-y = halui.mdi-command-13 +zero-z = halui.mdi-command-14 +zero-a = halui.mdi-command-15 + safe-z = halui.mdi-command-10 # in this sim, home-all only works first time, hold down till finished: home = halui.home-all @@ -65,10 +85,14 @@ MDI_COMMAND=(debug, example: mdi-08) MDI_COMMAND=(debug, example: mdi-09) MDI_COMMAND=(debug, example: mdi-10) MDI_COMMAND=(debug, example: mdi-11) -MDI_COMMAND=(debug, example: mdi-12) -MDI_COMMAND=(debug, example: mdi-13) -MDI_COMMAND=(debug, example: mdi-14) -MDI_COMMAND=(debug, example: mdi-15) +#12 +MDI_COMMAND= G10 L20 P0 X0 +#13 +MDI_COMMAND= G10 L20 P0 Y0 +#14 +MDI_COMMAND= G10 L20 P0 Z0 +#15 +MDI_COMMAND= G10 L20 P0 C0 [EMC] MACHINE = xhc-hb04 layout2 demo diff --git a/configs/sim/axis/xhc-hb04/xhc-hb04-layout2_mm.ini b/configs/sim/axis/xhc-hb04/xhc-hb04-layout2_mm.ini index cccbf459b..0fcc996ad 100644 --- a/configs/sim/axis/xhc-hb04/xhc-hb04-layout2_mm.ini +++ b/configs/sim/axis/xhc-hb04/xhc-hb04-layout2_mm.ini @@ -26,14 +26,34 @@ require_pendant = yes # note: "start-pause" is connected for standard behavior # controlling halui.pause/halui.resume/halui.run # these are examples, edit as required: + goto-zero = halui.mdi-command-00 +# syntheized per-axis buttons for goto-zero button: +goto-zero-x = "" +goto-zero-y = "" +goto-zero-z = "" +goto-zero-a = "" + start-pause = std_start_pause rewind = halui.program.step # probe-input for simulating a probe: probe-z = motion.probe-input macro-3 = halui.mdi-command-03 + half = halui.spindle.stop +# synthesized per-axis buttons for half button: +half-x = "" +half-y = "" +half-z = "" +half-a = "" + zero = "" +# synthesized per-axis buttons for zero button: +zero-x = halui.mdi-command-12 +zero-y = halui.mdi-command-13 +zero-z = halui.mdi-command-14 +zero-a = halui.mdi-command-15 + safe-z = halui.mdi-command-10 # in this sim, home-all only works first time, hold down till finished: home = halui.home-all @@ -65,10 +85,15 @@ MDI_COMMAND=(debug, example: mdi-08) MDI_COMMAND=(debug, example: mdi-09) MDI_COMMAND=(debug, example: mdi-10) MDI_COMMAND=(debug, example: mdi-11) -MDI_COMMAND=(debug, example: mdi-12) -MDI_COMMAND=(debug, example: mdi-13) -MDI_COMMAND=(debug, example: mdi-14) -MDI_COMMAND=(debug, example: mdi-15) +#12 +MDI_COMMAND= G10 L20 P0 X0 +#13 +MDI_COMMAND= G10 L20 P0 Y0 +#14 +MDI_COMMAND= G10 L20 P0 Z0 +#15 +MDI_COMMAND= G10 L20 P0 C0 + [EMC] MACHINE = xhc-hb04 layout2 mm demo diff --git a/docs/man/man1/halui.1 b/docs/man/man1/halui.1 index ae8a923a4..009f07ced 100644 --- a/docs/man/man1/halui.1 +++ b/docs/man/man1/halui.1 @@ -422,6 +422,29 @@ pin for setting the scale on changing the FO .B halui.feed-override.value\fR float out \fR current Feed Override value +.SS rapid override +.TP +.B halui.rapid-override.count-enable\fR bit in \fR (default: \fBTRUE\fR) +When TRUE, modify Rapid Override when counts changes. +.TP +.B halui.rapid-override.counts\fR s32 in \fR +counts X scale = Rapid Override percentage +.TP +.B halui.rapid-override.decrease\fR bit in \fR +pin for decreasing the Rapid Override (-=scale) +.TP +.B halui.rapid-override.direct-value\fR bit in \fR +pin to enable direct value Rapid Override input +.TP +.B halui.rapid-override.increase\fR bit in \fR +pin for increasing the Rapid Override (+=scale) +.TP +.B halui.rapid-override.scale\fR float in \fR +pin for setting the scale on changing the Rapid Override +.TP +.B halui.rapid-override.value\fR float out \fR +current Rapid Override value + .SS estop .TP .B halui.estop.activate\fR bit in \fR diff --git a/docs/src/common/python-interface.txt b/docs/src/common/python-interface.txt index 4f087d5ab..e488306bf 100644 --- a/docs/src/common/python-interface.txt +++ b/docs/src/common/python-interface.txt @@ -323,6 +323,9 @@ counterclockwise. *spindlerate*:: '(returns float)' - spindle speed override scale. +*rapidrate*:: '(returns float)' - +rapid override scale. + *state*:: '(returns integer)' - current command execution status. One of RCS_DONE, RCS_EXEC, RCS_ERROR. diff --git a/share/axis/tcl/axis.tcl b/share/axis/tcl/axis.tcl index e5e4e2a87..db2164db7 100644 --- a/share/axis/tcl/axis.tcl +++ b/share/axis/tcl/axis.tcl @@ -1706,6 +1706,44 @@ pack ${pane_top}.feedoverride.m \ pack ${pane_top}.feedoverride.foentry \ -side right +frame ${pane_top}.rapidoverride + +label ${pane_top}.rapidoverride.foentry \ + -textvariable rapidrate \ + -width 4 \ + -anchor e +setup_widget_accel ${pane_top}.rapidoverride.foentry 0 + +scale ${pane_top}.rapidoverride.foscale \ + -command set_rapidrate \ + -orient horizontal \ + -resolution 1.0 \ + -showvalue 0 \ + -takefocus 0 \ + -to 120.0 \ + -variable rapidrate + +label ${pane_top}.rapidoverride.l +setup_widget_accel ${pane_top}.rapidoverride.l [_ "Rapid Override:"] +label ${pane_top}.rapidoverride.m -width 1 +setup_widget_accel ${pane_top}.rapidoverride.m [_ "%"] + +# Pack widget ${pane_top}.rapidoverride.l +pack ${pane_top}.rapidoverride.l \ + -side left + +# Pack widget ${pane_top}.rapidoverride.foscale +pack ${pane_top}.rapidoverride.foscale \ + -side right + +# Pack widget ${pane_top}.rapidoverride.foentry +pack ${pane_top}.rapidoverride.m \ + -side right + +# Pack widget ${pane_top}.rapidoverride.foentry +pack ${pane_top}.rapidoverride.foentry \ + -side right + toplevel .about bind .about <Key-Return> { wm wi .about } bind .about <Key-Escape> { wm wi .about } @@ -1797,25 +1835,31 @@ grid ${pane_top}.feedoverride \ -row 2 \ -sticky new +# Grid widget ${pane_top}.rapidoverride +grid ${pane_top}.rapidoverride \ + -column 0 \ + -row 3 \ + -sticky new + # Grid widget ${pane_top}.spinoverride grid ${pane_top}.spinoverride \ -column 0 \ - -row 3 \ + -row 4 \ -sticky new grid ${pane_top}.jogspeed \ -column 0 \ - -row 4 \ + -row 5 \ -sticky new grid ${pane_top}.ajogspeed \ -column 0 \ - -row 5 \ + -row 6 \ -sticky new grid ${pane_top}.maxvel \ -column 0 \ - -row 6 \ + -row 7 \ -sticky new # Grid widget .info diff --git a/src/emc/kinematics/tp.c b/src/emc/kinematics/tp.c index 46d563cef..877fb5bdc 100644 --- a/src/emc/kinematics/tp.c +++ b/src/emc/kinematics/tp.c @@ -1013,13 +1013,6 @@ int tpRunCycle(TP_STRUCT * tp, long period) nexttc->feed_override = emcmotStatus->net_feed_scale; } } - // if this is rapid move, don't use feed override settings (max velocity override is still honoured) - if(tc->canon_motion_type==EMC_MOTION_TYPE_TRAVERSE) { - tc->feed_override = 1.0; - if(nexttc) { - nexttc->feed_override = 1.0; - } - } /* handle pausing */ if(tp->pausing && (!tc->synchronized || tc->velocity_mode)) { tc->feed_override = 0.0; diff --git a/src/emc/motion/command.c b/src/emc/motion/command.c index ada126d14..c19f79355 100644 --- a/src/emc/motion/command.c +++ b/src/emc/motion/command.c @@ -1051,6 +1051,16 @@ check_stuff ( "before command_handler()" ); emcmotStatus->feed_scale = emcmotCommand->scale; break; + case EMCMOT_RAPID_SCALE: + /* override rapids */ + /* can happen at any time */ + rtapi_print_msg(RTAPI_MSG_DBG, "RAPID SCALE"); + if (emcmotCommand->scale < 0.0) { + emcmotCommand->scale = 0.0; /* clamp it */ + } + emcmotStatus->rapid_scale = emcmotCommand->scale; + break; + case EMCMOT_FS_ENABLE: /* enable/disable overriding speed */ /* can happen at any time */ diff --git a/src/emc/motion/control.c b/src/emc/motion/control.c index 313fab27c..053a5a6c6 100644 --- a/src/emc/motion/control.c +++ b/src/emc/motion/control.c @@ -24,6 +24,7 @@ #include "tc.h" #include "motion_debug.h" #include "config.h" +#include "motion_types.h" // Mark strings for translation, but defer translation to userspace #define _(s) (s) @@ -461,7 +462,11 @@ static void process_inputs(void) /* feed scaling first: feed_scale, adaptive_feed, and feed_hold */ scale = 1.0; if ( enables & FS_ENABLED ) { - scale *= emcmotStatus->feed_scale; + if (emcmotStatus->motionType == EMC_MOTION_TYPE_TRAVERSE) { + scale *= emcmotStatus->rapid_scale; + } else { + scale *= emcmotStatus->feed_scale; + } } if ( enables & AF_ENABLED ) { /* read and clamp (0.0 to 1.0) adaptive feed HAL pin */ diff --git a/src/emc/motion/motion.c b/src/emc/motion/motion.c index 48e1bf980..aa691b74f 100644 --- a/src/emc/motion/motion.c +++ b/src/emc/motion/motion.c @@ -904,6 +904,7 @@ static int init_comm_buffers(void) emcmotConfig->limitVel = VELOCITY; emcmotStatus->acc = ACCELERATION; emcmotStatus->feed_scale = 1.0; + emcmotStatus->rapid_scale = 1.0; emcmotStatus->spindle_scale = 1.0; emcmotStatus->net_feed_scale = 1.0; /* adaptive feed is off by default, feed override, spindle diff --git a/src/emc/motion/motion.h b/src/emc/motion/motion.h index 435eac7e8..43411fa8b 100644 --- a/src/emc/motion/motion.h +++ b/src/emc/motion/motion.h @@ -124,6 +124,7 @@ extern "C" { EMCMOT_SPINDLE_SCALE, /* set scale factor for spindle speed */ EMCMOT_SS_ENABLE, /* enable/disable scaling the spindle speed */ EMCMOT_FEED_SCALE, /* set scale factor for feedrate */ + EMCMOT_RAPID_SCALE, /* set scale factor for rapids */ EMCMOT_FS_ENABLE, /* enable/disable scaling feedrate */ EMCMOT_FH_ENABLE, /* enable/disable feed_hold */ EMCMOT_AF_ENABLE, /* enable/disable adaptive feedrate */ @@ -604,7 +605,8 @@ Suggestion: Split this in to an Error and a Status flag register.. int commandNumEcho; /* echo of input command number */ cmd_status_t commandStatus; /* result of most recent command */ /* these are config info, updated when a command changes them */ - double feed_scale; /* velocity scale factor for all motion */ + double feed_scale; /* velocity scale factor for all motion but rapids */ + double rapid_scale; /* velocity scale factor for rapids */ double spindle_scale; /* velocity scale factor for spindle speed */ unsigned char enables_new; /* flags for FS, SS, etc */ /* the above set is the enables in effect for new moves */ diff --git a/src/emc/nml_intf/emc.cc b/src/emc/nml_intf/emc.cc index 9caf79f25..9566da7fe 100644 --- a/src/emc/nml_intf/emc.cc +++ b/src/emc/nml_intf/emc.cc @@ -428,6 +428,9 @@ int emcFormat(NMLTYPE type, void *buffer, CMS * cms) case EMC_TRAJ_SET_SCALE_TYPE: ((EMC_TRAJ_SET_SCALE *) buffer)->update(cms); break; + case EMC_TRAJ_SET_RAPID_SCALE_TYPE: + ((EMC_TRAJ_SET_RAPID_SCALE *) buffer)->update(cms); + break; case EMC_TRAJ_SET_SPINDLE_SCALE_TYPE: ((EMC_TRAJ_SET_SPINDLE_SCALE *) buffer)->update(cms); break; @@ -731,6 +734,8 @@ const char *emc_symbol_lookup(long type) return "EMC_TRAJ_SET_ROTATION"; case EMC_TRAJ_SET_SCALE_TYPE: return "EMC_TRAJ_SET_SCALE"; + case EMC_TRAJ_SET_RAPID_SCALE_TYPE: + return "EMC_TRAJ_SET_RAPID_SCALE"; case EMC_TRAJ_SET_SPINDLE_SCALE_TYPE: return "EMC_TRAJ_SET_SPINDLE_SCALE"; case EMC_TRAJ_SET_FO_ENABLE_TYPE: @@ -1829,6 +1834,14 @@ void EMC_TRAJ_SET_SCALE::update(CMS * cms) } +void EMC_TRAJ_SET_RAPID_SCALE::update(CMS * cms) +{ + + EMC_TRAJ_CMD_MSG::update(cms); + cms->update(scale); + +} + /* * NML/CMS Update function for EMC_TRAJ_SET_SPINDLE_SCALE * Automatically generated by Alex Joni :) diff --git a/src/emc/nml_intf/emc.hh b/src/emc/nml_intf/emc.hh index b61fd3d5b..9f73e8753 100644 --- a/src/emc/nml_intf/emc.hh +++ b/src/emc/nml_intf/emc.hh @@ -109,6 +109,7 @@ struct PM_CARTESIAN; #define EMC_TRAJ_SET_MAX_VELOCITY_TYPE ((NMLTYPE) 207) #define EMC_TRAJ_SET_MAX_ACCELERATION_TYPE ((NMLTYPE) 208) #define EMC_TRAJ_SET_SCALE_TYPE ((NMLTYPE) 209) +#define EMC_TRAJ_SET_RAPID_SCALE_TYPE ((NMLTYPE) 238) #define EMC_TRAJ_SET_MOTION_ID_TYPE ((NMLTYPE) 210) #define EMC_TRAJ_INIT_TYPE ((NMLTYPE) 211) @@ -418,6 +419,7 @@ extern int emcTrajSetAcceleration(double acc); extern int emcTrajSetMaxVelocity(double vel); extern int emcTrajSetMaxAcceleration(double acc); extern int emcTrajSetScale(double scale); +extern int emcTrajSetRapidScale(double scale); extern int emcTrajSetFOEnable(unsigned char mode); //feed override enable extern int emcTrajSetFHEnable(unsigned char mode); //feed hold enable extern int emcTrajSetSpindleScale(double scale); diff --git a/src/emc/nml_intf/emc_nml.hh b/src/emc/nml_intf/emc_nml.hh index c2212e9ee..b0d708838 100644 --- a/src/emc/nml_intf/emc_nml.hh +++ b/src/emc/nml_intf/emc_nml.hh @@ -609,6 +609,18 @@ class EMC_TRAJ_SET_SCALE:public EMC_TRAJ_CMD_MSG { double scale; }; +class EMC_TRAJ_SET_RAPID_SCALE:public EMC_TRAJ_CMD_MSG { + public: + EMC_TRAJ_SET_RAPID_SCALE():EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_RAPID_SCALE_TYPE, + sizeof(EMC_TRAJ_SET_RAPID_SCALE)) { + }; + + // For internal NML/CMS use only. + void update(CMS * cms); + + double scale; +}; + class EMC_TRAJ_SET_SPINDLE_SCALE:public EMC_TRAJ_CMD_MSG { public: EMC_TRAJ_SET_SPINDLE_SCALE():EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_SPINDLE_SCALE_TYPE, @@ -982,6 +994,7 @@ class EMC_TRAJ_STAT:public EMC_TRAJ_STAT_MSG { int id; // id of the currently executing motion bool paused; // non-zero means motion paused double scale; // velocity scale factor + double rapid_scale; // rapid scale factor double spindle_scale; // spindle velocity scale factor EmcPose position; // current commanded position diff --git a/src/emc/nml_intf/emcops.cc b/src/emc/nml_intf/emcops.cc index 849bdc6c6..33c490ff9 100644 --- a/src/emc/nml_intf/emcops.cc +++ b/src/emc/nml_intf/emcops.cc @@ -62,6 +62,7 @@ EMC_TRAJ_STAT_MSG(EMC_TRAJ_STAT_TYPE, sizeof(EMC_TRAJ_STAT)) id = 0; paused = OFF; scale = 0.0; + rapid_scale = 0.0; spindle_scale = 0.0; ZERO_EMC_POSE(position); diff --git a/src/emc/task/emctaskmain.cc b/src/emc/task/emctaskmain.cc index e3f41242a..6c1175e47 100644 --- a/src/emc/task/emctaskmain.cc +++ b/src/emc/task/emctaskmain.cc @@ -377,6 +377,7 @@ static EMC_AXIS_LOAD_COMP *axis_load_comp_msg; //static EMC_AXIS_SET_STEP_PARAMS *set_step_params_msg; static EMC_TRAJ_SET_SCALE *emcTrajSetScaleMsg; +static EMC_TRAJ_SET_RAPID_SCALE *emcTrajSetRapidScaleMsg; static EMC_TRAJ_SET_MAX_VELOCITY *emcTrajSetMaxVelocityMsg; static EMC_TRAJ_SET_SPINDLE_SCALE *emcTrajSetSpindleScaleMsg; static EMC_TRAJ_SET_VELOCITY *emcTrajSetVelocityMsg; @@ -823,6 +824,7 @@ static int emcTaskPlan(void) case EMC_AXIS_LOAD_COMP_TYPE: case EMC_AXIS_UNHOME_TYPE: case EMC_TRAJ_SET_SCALE_TYPE: + case EMC_TRAJ_SET_RAPID_SCALE_TYPE: case EMC_TRAJ_SET_MAX_VELOCITY_TYPE: case EMC_TRAJ_SET_SPINDLE_SCALE_TYPE: case EMC_TRAJ_SET_FO_ENABLE_TYPE: @@ -926,6 +928,7 @@ static int emcTaskPlan(void) case EMC_TRAJ_RESUME_TYPE: case EMC_TRAJ_ABORT_TYPE: case EMC_TRAJ_SET_SCALE_TYPE: + case EMC_TRAJ_SET_RAPID_SCALE_TYPE: case EMC_TRAJ_SET_MAX_VELOCITY_TYPE: case EMC_TRAJ_SET_SPINDLE_SCALE_TYPE: case EMC_TRAJ_SET_FO_ENABLE_TYPE: @@ -1027,6 +1030,7 @@ static int emcTaskPlan(void) case EMC_TRAJ_RESUME_TYPE: case EMC_TRAJ_ABORT_TYPE: case EMC_TRAJ_SET_SCALE_TYPE: + case EMC_TRAJ_SET_RAPID_SCALE_TYPE: case EMC_TRAJ_SET_MAX_VELOCITY_TYPE: case EMC_TRAJ_SET_SPINDLE_SCALE_TYPE: case EMC_TRAJ_SET_FO_ENABLE_TYPE: @@ -1124,6 +1128,7 @@ static int emcTaskPlan(void) case EMC_TRAJ_RESUME_TYPE: case EMC_TRAJ_ABORT_TYPE: case EMC_TRAJ_SET_SCALE_TYPE: + case EMC_TRAJ_SET_RAPID_SCALE_TYPE: case EMC_TRAJ_SET_MAX_VELOCITY_TYPE: case EMC_TRAJ_SET_SPINDLE_SCALE_TYPE: case EMC_TRAJ_SET_FO_ENABLE_TYPE: @@ -1193,6 +1198,7 @@ static int emcTaskPlan(void) case EMC_TRAJ_RESUME_TYPE: case EMC_TRAJ_ABORT_TYPE: case EMC_TRAJ_SET_SCALE_TYPE: + case EMC_TRAJ_SET_RAPID_SCALE_TYPE: case EMC_TRAJ_SET_MAX_VELOCITY_TYPE: case EMC_TRAJ_SET_SPINDLE_SCALE_TYPE: case EMC_TRAJ_SET_FO_ENABLE_TYPE: @@ -1276,6 +1282,7 @@ static int emcTaskPlan(void) case EMC_TRAJ_RESUME_TYPE: case EMC_TRAJ_ABORT_TYPE: case EMC_TRAJ_SET_SCALE_TYPE: + case EMC_TRAJ_SET_RAPID_SCALE_TYPE: case EMC_TRAJ_SET_MAX_VELOCITY_TYPE: case EMC_TRAJ_SET_SPINDLE_SCALE_TYPE: case EMC_TRAJ_SET_FO_ENABLE_TYPE: @@ -1352,6 +1359,7 @@ static int emcTaskPlan(void) case EMC_AXIS_SET_MIN_FERROR_TYPE: case EMC_AXIS_UNHOME_TYPE: case EMC_TRAJ_SET_SCALE_TYPE: + case EMC_TRAJ_SET_RAPID_SCALE_TYPE: case EMC_TRAJ_SET_MAX_VELOCITY_TYPE: case EMC_TRAJ_SET_SPINDLE_SCALE_TYPE: case EMC_TRAJ_SET_FO_ENABLE_TYPE: @@ -1753,6 +1761,11 @@ static int emcTaskIssueCommand(NMLmsg * cmd) retval = emcTrajSetScale(emcTrajSetScaleMsg->scale); break; + case EMC_TRAJ_SET_RAPID_SCALE_TYPE: + emcTrajSetRapidScaleMsg = (EMC_TRAJ_SET_RAPID_SCALE *) cmd; + retval = emcTrajSetRapidScale(emcTrajSetRapidScaleMsg->scale); + break; + case EMC_TRAJ_SET_MAX_VELOCITY_TYPE: emcTrajSetMaxVelocityMsg = (EMC_TRAJ_SET_MAX_VELOCITY *) cmd; retval = emcTrajSetMaxVelocity(emcTrajSetMaxVelocityMsg->velocity); diff --git a/src/emc/task/taskintf.cc b/src/emc/task/taskintf.cc index 9ed3bbdc3..2b2283e63 100644 --- a/src/emc/task/taskintf.cc +++ b/src/emc/task/taskintf.cc @@ -798,6 +798,18 @@ int emcTrajSetScale(double scale) return usrmotWriteEmcmotCommand(&emcmotCommand); } +int emcTrajSetRapidScale(double scale) +{ + if (scale < 0.0) { + scale = 0.0; + } + + emcmotCommand.command = EMCMOT_RAPID_SCALE; + emcmotCommand.scale = scale; + + return usrmotWriteEmcmotCommand(&emcmotCommand); +} + int emcTrajSetSpindleScale(double scale) { if (scale < 0.0) { @@ -1148,6 +1160,7 @@ int emcTrajUpdate(EMC_TRAJ_STAT * stat) stat->paused = emcmotStatus.paused; stat->scale = emcmotStatus.feed_scale; + stat->rapid_scale = emcmotStatus.rapid_scale; stat->spindle_scale = emcmotStatus.spindle_scale; stat->position = emcmotStatus.carte_pos_cmd; diff --git a/src/emc/usr_intf/axis/extensions/emcmodule.cc b/src/emc/usr_intf/axis/extensions/emcmodule.cc index da87cbb63..22cac9840 100644 --- a/src/emc/usr_intf/axis/extensions/emcmodule.cc +++ b/src/emc/usr_intf/axis/extensions/emcmodule.cc @@ -333,6 +333,7 @@ static PyMemberDef Stat_members[] = { {(char*)"id", T_INT, O(motion.traj.id), READONLY}, {(char*)"paused", T_BOOL, O(motion.traj.paused), READONLY}, {(char*)"feedrate", T_DOUBLE, O(motion.traj.scale), READONLY}, + {(char*)"rapidrate", T_DOUBLE, O(motion.traj.rapid_scale), READONLY}, {(char*)"spindlerate", T_DOUBLE, O(motion.traj.spindle_scale), READONLY}, {(char*)"velocity", T_DOUBLE, O(motion.traj.velocity), READONLY}, @@ -782,6 +783,16 @@ static PyObject *feedrate(pyCommandChannel *s, PyObject *o) { return Py_None; } +static PyObject *rapidrate(pyCommandChannel *s, PyObject *o) { + EMC_TRAJ_SET_RAPID_SCALE m; + if(!PyArg_ParseTuple(o, "d", &m.scale)) return NULL; + m.serial_number = next_serial(s); + s->c->write(m); + emcWaitCommandReceived(s->serial, s->s); + Py_INCREF(Py_None); + return Py_None; +} + static PyObject *spindleoverride(pyCommandChannel *s, PyObject *o) { EMC_TRAJ_SET_SPINDLE_SCALE m; if(!PyArg_ParseTuple(o, "d", &m.scale)) return NULL; @@ -1336,6 +1347,7 @@ static PyMethodDef Command_methods[] = { {"mdi", (PyCFunction)mdi, METH_VARARGS}, {"mode", (PyCFunction)mode, METH_VARARGS}, {"feedrate", (PyCFunction)feedrate, METH_VARARGS}, + {"rapidrate", (PyCFunction)rapidrate, METH_VARARGS}, {"maxvel", (PyCFunction)maxvel, METH_VARARGS}, {"spindleoverride", (PyCFunction)spindleoverride, METH_VARARGS}, {"spindle", (PyCFunction)spindle, METH_VARARGS}, diff --git a/src/emc/usr_intf/axis/scripts/axis.py b/src/emc/usr_intf/axis/scripts/axis.py index 332d20f71..b43226602 100755 --- a/src/emc/usr_intf/axis/scripts/axis.py +++ b/src/emc/usr_intf/axis/scripts/axis.py @@ -142,6 +142,7 @@ mdi_history_save_filename =\ feedrate_blackout = 0 +rapidrate_blackout = 0 spindlerate_blackout = 0 maxvel_blackout = 0 jogincr_index_last = 1 @@ -677,8 +678,8 @@ class LivePlotter: ) o.after_idle(lambda: thread.start_new_thread(self.logger.start, (.01,))) - global feedrate_blackout, spindlerate_blackout, maxvel_blackout - feedrate_blackout=spindlerate_blackout=maxvel_blackout=time.time()+1 + global feedrate_blackout, rapidrate_blackout, spindlerate_blackout, maxvel_blackout + feedrate_blackout=rapidrate_blackout=spindlerate_blackout=maxvel_blackout=time.time()+1 self.running.set(True) @@ -797,6 +798,8 @@ class LivePlotter: vupdate(vars.spindlerate, int(100 * self.stat.spindlerate + .5)) if time.time() > feedrate_blackout: vupdate(vars.feedrate, int(100 * self.stat.feedrate + .5)) + if time.time() > rapidrate_blackout: + vupdate(vars.rapidrate, int(100 * self.stat.rapidrate + .5)) if time.time() > maxvel_blackout: m = to_internal_linear_unit(self.stat.max_velocity) if vars.metric.get(): m = m * 25.4 @@ -1220,6 +1223,7 @@ widgets = nf.Widgets(root_window, ("rotate", Button, ".toolbar.rotate"), ("feedoverride", Scale, pane_top + ".feedoverride.foscale"), + ("rapidoverride", Scale, pane_top + ".rapidoverride.foscale"), ("spinoverride", Scale, pane_top + ".spinoverride.foscale"), ("spinoverridef", Scale, pane_top + ".spinoverride"), @@ -1772,6 +1776,15 @@ class TclCommands(nf.TclCommands): c.feedrate(value) feedrate_blackout = time.time() + 1 + def set_rapidrate(newval): + global rapidrate_blackout + try: + value = int(newval) + except ValueError: return + value = value / 100. + c.rapidrate(value) + rapidrate_blackout = time.time() + 1 + def set_maxvel(newval): newval = float(newval) if vars.metric.get(): newval = newval / 25.4 @@ -2553,6 +2566,7 @@ vars = nf.Variables(root_window, ("dro_large_font", IntVar), ("show_rapids", IntVar), ("feedrate", IntVar), + ("rapidrate", IntVar), ("spindlerate", IntVar), ("tool", StringVar), ("active_codes", StringVar), @@ -2609,6 +2623,9 @@ update_recent_menu() def set_feedrate(n): widgets.feedoverride.set(n) +def set_rapidrate(n): + widgets.rapidoverride.set(n) + def activate_axis_or_set_feedrate(n): # XXX: axis_mask does not apply if in joint mode if manual_ok() and s.axis_mask & (1<<n): @@ -2852,6 +2869,7 @@ root_window.tk.eval("${pane_top}.jogspeed.s set [setval $jog_speed $max_speed]") root_window.tk.eval("${pane_top}.ajogspeed.s set [setval $jog_aspeed $max_aspeed]") root_window.tk.eval("${pane_top}.maxvel.s set [setval $maxvel_speed $max_maxvel]") widgets.feedoverride.configure(to=max_feed_override) +widgets.rapidoverride.configure(to=100) widgets.spinoverride.configure(to=max_spindle_override) nmlfile = inifile.find("EMC", "NML_FILE") if nmlfile: @@ -3329,6 +3347,8 @@ if lathe: widgets.feedoverride.set(100) commands.set_feedrate(100) +widgets.rapidoverride.set(100) +commands.set_rapidrate(100) widgets.spinoverride.set(100) commands.set_spindlerate(100) diff --git a/src/emc/usr_intf/halui.cc b/src/emc/usr_intf/halui.cc index 0fc32a1a6..0793e2b95 100644 --- a/src/emc/usr_intf/halui.cc +++ b/src/emc/usr_intf/halui.cc @@ -211,6 +211,15 @@ DONE: - feed-override halui.feed-override.increase bit // pin for increasing the FO (+=scale) halui.feed-override.decrease bit // pin for decreasing the FO (-=scale) +DONE: - rapid-override + halui.rapid-override.value float //current RO value + halui.rapid-override.scale float // pin for setting the scale on changing the RO + halui.rapid-override.counts s32 //counts from an encoder for example to change RO + halui.rapid-override.count-enable bit // TRUE to modify RO based on counts + halui.rapid-override.direct-value bit // TRUE to make override based as a direct (scaled) value rather then counts of increments + halui.rapid-override.increase bit // pin for increasing the RO (+=scale) + halui.rapid-override.decrease bit // pin for decreasing the RO (-=scale) + DONE: - spindle-override halui.spindle-override.value float //current FO value halui.spindle-override.scale float // pin for setting the scale on changing the SO @@ -334,6 +343,14 @@ DONE: - spindle-override FIELD(hal_bit_t,fo_increase) /* pin for increasing the FO (+=scale) */ \ FIELD(hal_bit_t,fo_decrease) /* pin for decreasing the FO (-=scale) */ \ \ + FIELD(hal_s32_t,ro_counts) /* pin for the Feed Override counting */ \ + FIELD(hal_bit_t,ro_count_enable) /* pin for the Feed Override counting enable */ \ + FIELD(hal_bit_t,ro_direct_value) /* pin for enabling direct value option instead of counts */ \ + FIELD(hal_float_t,ro_scale) /* scale for the Feed Override counting */ \ + FIELD(hal_float_t,ro_value) /* current Feed Override value */ \ + FIELD(hal_bit_t,ro_increase) /* pin ror increasing the FO (+=scale) */ \ + FIELD(hal_bit_t,ro_decrease) /* pin for decreasing the FO (-=scale) */ \ +\ FIELD(hal_s32_t,so_counts) /* pin for the Spindle Speed Override counting */ \ FIELD(hal_bit_t,so_count_enable) /* pin for the Spindle Speed Override counting enable */ \ FIELD(hal_bit_t,so_direct_value) /* pin for enabling direct value option instead of counts */ \ @@ -801,6 +818,8 @@ int halui_hal_init(void) if (retval < 0) return retval; retval = hal_pin_float_newf(HAL_OUT, &(halui_data->fo_value), comp_id, "halui.feed-override.value"); if (retval < 0) return retval; + retval = hal_pin_float_newf(HAL_OUT, &(halui_data->ro_value), comp_id, "halui.rapid-override.value"); + if (retval < 0) return retval; retval = hal_pin_u32_newf(HAL_OUT, &(halui_data->joint_selected), comp_id, "halui.joint.selected"); if (retval < 0) return retval; retval = hal_pin_u32_newf(HAL_OUT, &(halui_data->tool_number), comp_id, "halui.tool.number"); @@ -926,6 +945,22 @@ int halui_hal_init(void) retval = halui_export_pin_IN_bit(&(halui_data->fo_decrease), "halui.feed-override.decrease"); if (retval < 0) return retval; + retval = halui_export_pin_IN_s32(&(halui_data->ro_counts), "halui.rapid-override.counts"); + if (retval < 0) return retval; + *halui_data->ro_counts = 0; + retval = halui_export_pin_IN_bit(&(halui_data->ro_count_enable), "halui.rapid-override.count-enable"); + if (retval < 0) return retval; + *halui_data->ro_count_enable = 1; + retval = halui_export_pin_IN_bit(&(halui_data->ro_direct_value), "halui.rapid-override.direct-value"); + if (retval < 0) return retval; + *halui_data->ro_direct_value = 0; + retval = halui_export_pin_IN_float(&(halui_data->ro_scale), "halui.rapid-override.scale"); + if (retval < 0) return retval; + retval = halui_export_pin_IN_bit(&(halui_data->ro_increase), "halui.rapid-override.increase"); + if (retval < 0) return retval; + retval = halui_export_pin_IN_bit(&(halui_data->ro_decrease), "halui.rapid-override.decrease"); + if (retval < 0) return retval; + retval = halui_export_pin_IN_s32(&(halui_data->so_counts), "halui.spindle-override.counts"); if (retval < 0) return retval; *halui_data->so_counts = 0; @@ -1488,6 +1523,24 @@ static int sendFeedOverride(double override) return emcCommandWaitReceived(emcCommandSerialNumber); } +static int sendRapidOverride(double override) +{ + EMC_TRAJ_SET_RAPID_SCALE emc_traj_set_scale_msg; + + if (override < 0.0) { + override = 0.0; + } + + if (override > 1.0) { + override = 1.0; + } + + emc_traj_set_scale_msg.serial_number = ++emcCommandSerialNumber; + emc_traj_set_scale_msg.scale = override; + emcCommandBuffer->write(emc_traj_set_scale_msg); + return emcCommandWaitReceived(emcCommandSerialNumber); +} + static int sendMaxVelocity(double velocity) { EMC_TRAJ_SET_MAX_VELOCITY mv; @@ -1655,6 +1708,7 @@ static void hal_init_pins() *(halui_data->joint_selected) = 0; // select joint 0 by default *(halui_data->fo_scale) = old_halui_data.fo_scale = 0.1; //sane default + *(halui_data->ro_scale) = old_halui_data.ro_scale = 0.1; //sane default *(halui_data->so_scale) = old_halui_data.so_scale = 0.1; //sane default } @@ -1794,6 +1848,20 @@ static void check_hal_changes() old_halui_data.fo_counts = counts; } + //rapid-override stuff + counts = new_halui_data.ro_counts; + if (counts != old_halui_data.ro_counts) { + if (new_halui_data.ro_count_enable) { + if (new_halui_data.ro_direct_value) { + sendRapidOverride(counts * new_halui_data.ro_scale); + } else { + sendRapidOverride( new_halui_data.ro_value + (counts - old_halui_data.ro_counts) * + new_halui_data.ro_scale); + } + } + old_halui_data.ro_counts = counts; + } + //spindle-override stuff counts = new_halui_data.so_counts; if (counts != old_halui_data.so_counts) { @@ -1818,6 +1886,11 @@ static void check_hal_changes() if (check_bit_changed(new_halui_data.fo_decrease, old_halui_data.fo_decrease) != 0) sendFeedOverride(new_halui_data.fo_value - new_halui_data.fo_scale); + if (check_bit_changed(new_halui_data.ro_increase, old_halui_data.ro_increase) != 0) + sendRapidOverride(new_halui_data.ro_value + new_halui_data.ro_scale); + if (check_bit_changed(new_halui_data.ro_decrease, old_halui_data.ro_decrease) != 0) + sendRapidOverride(new_halui_data.ro_value - new_halui_data.ro_scale); + if (check_bit_changed(new_halui_data.so_increase, old_halui_data.so_increase) != 0) sendSpindleOverride(new_halui_data.so_value + new_halui_data.so_scale); if (check_bit_changed(new_halui_data.so_decrease, old_halui_data.so_decrease) != 0) @@ -2067,6 +2140,7 @@ static void modify_hal_pins() *(halui_data->mv_value) = emcStatus->motion.traj.maxVelocity; *(halui_data->fo_value) = emcStatus->motion.traj.scale; //feedoverride from 0 to 1 for 100% + *(halui_data->ro_value) = emcStatus->motion.traj.rapid_scale; //rapid override from 0 to 1 for 100% *(halui_data->so_value) = emcStatus->motion.traj.spindle_scale; //spindle-speed-override from 0 to 1 for 100% *(halui_data->mist_is_on) = emcStatus->io.coolant.mist; diff --git a/src/hal/user_comps/xhc-hb04.cc b/src/hal/user_comps/xhc-hb04.cc index e351d749b..e987d108d 100644 --- a/src/hal/user_comps/xhc-hb04.cc +++ b/src/hal/user_comps/xhc-hb04.cc @@ -121,6 +121,18 @@ typedef struct { hal_bit_t *sleeping; hal_bit_t *connected; hal_bit_t *require_pendant; + hal_bit_t *zero_x; + hal_bit_t *zero_y; + hal_bit_t *zero_z; + hal_bit_t *zero_a; + hal_bit_t *gotozero_x; + hal_bit_t *gotozero_y; + hal_bit_t *gotozero_z; + hal_bit_t *gotozero_a; + hal_bit_t *half_x; + hal_bit_t *half_y; + hal_bit_t *half_z; + hal_bit_t *half_a; } xhc_hal_t; typedef struct { @@ -401,6 +413,24 @@ void cb_response_in(struct libusb_transfer *transfer) for (i=0; i<NB_MAX_BUTTONS; i++) { if (!xhc.hal->button_pin[i]) continue; *(xhc.hal->button_pin[i]) = (xhc.button_code == xhc.buttons[i].code); + if (strcmp("button-zero", xhc.buttons[i].pin_name) == 0) { + *(xhc.hal->zero_x) = (xhc.button_code == xhc.buttons[i].code) && (xhc.axis == axis_x); + *(xhc.hal->zero_y) = (xhc.button_code == xhc.buttons[i].code) && (xhc.axis == axis_y); + *(xhc.hal->zero_z) = (xhc.button_code == xhc.buttons[i].code) && (xhc.axis == axis_z); + *(xhc.hal->zero_a) = (xhc.button_code == xhc.buttons[i].code) && (xhc.axis == axis_a); + } + if (strcmp("button-goto-zero", xhc.buttons[i].pin_name) == 0) { + *(xhc.hal->gotozero_x) = (xhc.button_code == xhc.buttons[i].code) && (xhc.axis == axis_x); + *(xhc.hal->gotozero_y) = (xhc.button_code == xhc.buttons[i].code) && (xhc.axis == axis_y); + *(xhc.hal->gotozero_z) = (xhc.button_code == xhc.buttons[i].code) && (xhc.axis == axis_z); + *(xhc.hal->gotozero_a) = (xhc.button_code == xhc.buttons[i].code) && (xhc.axis == axis_a); + } + if (strcmp("button-half", xhc.buttons[i].pin_name) == 0) { + *(xhc.hal->half_x) = (xhc.button_code == xhc.buttons[i].code) && (xhc.axis == axis_x); + *(xhc.hal->half_y) = (xhc.button_code == xhc.buttons[i].code) && (xhc.axis == axis_y); + *(xhc.hal->half_z) = (xhc.button_code == xhc.buttons[i].code) && (xhc.axis == axis_z); + *(xhc.hal->half_a) = (xhc.button_code == xhc.buttons[i].code) && (xhc.axis == axis_a); + } if (simu_mode && *(xhc.hal->button_pin[i])) { printf("%s pressed", xhc.buttons[i].pin_name); } @@ -545,11 +575,29 @@ static void hal_setup() r |= _hal_pin_float_newf(HAL_IN, &(xhc.hal->spindle_rps), hal_comp_id, "%s.spindle-rps", modname); r |= _hal_pin_float_newf(HAL_IN, &(xhc.hal->spindle_override), hal_comp_id, "%s.spindle-override", modname); - for (i=0; i<NB_MAX_BUTTONS; i++) { - if (!xhc.buttons[i].pin_name[0]) continue; - r |= _hal_pin_bit_newf(HAL_OUT, &(xhc.hal->button_pin[i]), hal_comp_id, "%s.%s", modname, xhc.buttons[i].pin_name); - if (strcmp("button-step", xhc.buttons[i].pin_name) == 0) xhc.button_step = xhc.buttons[i].code; - } + for (i=0; i<NB_MAX_BUTTONS; i++) { + if (!xhc.buttons[i].pin_name[0]) continue; + r |= _hal_pin_bit_newf(HAL_OUT, &(xhc.hal->button_pin[i]), hal_comp_id, "%s.%s", modname, xhc.buttons[i].pin_name); + if (strcmp("button-zero", xhc.buttons[i].pin_name) == 0) { + r |= _hal_pin_bit_newf(HAL_OUT, &(xhc.hal->zero_x), hal_comp_id, "%s.%s-x", modname, xhc.buttons[i].pin_name); + r |= _hal_pin_bit_newf(HAL_OUT, &(xhc.hal->zero_y), hal_comp_id, "%s.%s-y", modname, xhc.buttons[i].pin_name); + r |= _hal_pin_bit_newf(HAL_OUT, &(xhc.hal->zero_z), hal_comp_id, "%s.%s-z", modname, xhc.buttons[i].pin_name); + r |= _hal_pin_bit_newf(HAL_OUT, &(xhc.hal->zero_a), hal_comp_id, "%s.%s-a", modname, xhc.buttons[i].pin_name); + } + if (strcmp("button-goto-zero", xhc.buttons[i].pin_name) == 0) { + r |= _hal_pin_bit_newf(HAL_OUT, &(xhc.hal->gotozero_x), hal_comp_id, "%s.%s-x", modname, xhc.buttons[i].pin_name); + r |= _hal_pin_bit_newf(HAL_OUT, &(xhc.hal->gotozero_y), hal_comp_id, "%s.%s-y", modname, xhc.buttons[i].pin_name); + r |= _hal_pin_bit_newf(HAL_OUT, &(xhc.hal->gotozero_z), hal_comp_id, "%s.%s-z", modname, xhc.buttons[i].pin_name); + r |= _hal_pin_bit_newf(HAL_OUT, &(xhc.hal->gotozero_a), hal_comp_id, "%s.%s-a", modname, xhc.buttons[i].pin_name); + } + if (strcmp("button-half", xhc.buttons[i].pin_name) == 0) { + r |= _hal_pin_bit_newf(HAL_OUT, &(xhc.hal->half_x), hal_comp_id, "%s.%s-x", modname, xhc.buttons[i].pin_name); + r |= _hal_pin_bit_newf(HAL_OUT, &(xhc.hal->half_y), hal_comp_id, "%s.%s-y", modname, xhc.buttons[i].pin_name); + r |= _hal_pin_bit_newf(HAL_OUT, &(xhc.hal->half_z), hal_comp_id, "%s.%s-z", modname, xhc.buttons[i].pin_name); + r |= _hal_pin_bit_newf(HAL_OUT, &(xhc.hal->half_a), hal_comp_id, "%s.%s-a", modname, xhc.buttons[i].pin_name); + } + if (strcmp("button-step", xhc.buttons[i].pin_name) == 0) xhc.button_step = xhc.buttons[i].code; + } r |= _hal_pin_bit_newf(HAL_OUT, &(xhc.hal->sleeping), hal_comp_id, "%s.sleeping", modname); r |= _hal_pin_bit_newf(HAL_OUT, &(xhc.hal->connected), hal_comp_id, "%s.connected", modname); |