On Saturday 08 October 2016 12:25:57 Danny Miller wrote: > I have the wireless pendant button triggering a probe cycle in an > .ngc. > > Problem is, IF the cycle ends without tripping the probe (user error), > Axis UI ends up switching to MDI tab, and all the pendant function is > for Manual Control tab. So it disables the pendant until you can get > back to the PC and fix it by clicking back to Manual Control tab. Why > does it end up in MDI tab, and how can make LinuxCNC end up back in > the Manual Control tab? > > .ngc code below: > > <pre> > o100 sub > > #1 = #[5203 + [20 * #5220] ] > > G38.3 F50 Z[-6.5-#1]
Coding style. did you mean -6.5 - #1? I always use a space around a math function char, reducing the ambiguity when I go back and read it months/years later. > G10 L2 P0 Z1.826 This also is a coding style preference, but I have gotten out of the habit of adjusting the G54 map. It reduces the hunting while looking for a map that matches the one originally homed to mapping, for me at least. So I wind up using the next 2 or 3 maps in most of my coding. This also is a disadvantage because, realizing the machine is going to hit a fixture or something I didn't intend, hitting the esc key restores G54, and unless you know what map was in use, you lost the data that would tell me my math was funkity or THAT map was funkity because my math was. > > o101 if [#5070 EQ 1] > G10 L20 P0 Z1.826 > G1 Z1.93 F3 > G38.3 F3 Z[1.6] (<- useless brackets. what effect? if any) > G10 L20 P0 Z1.826 > G0 Z2.5 > o101 else > G53 G0 Z0 > (debug, FAILED TO FIND PROBE) > o101 endif > > o100 endsub > </pre> > > > Thanks, > > Danny > I don't see anything above that would put you in the mdi mode unless the math equates to an F5 character somehow. Not seeing the rest of the code, I've no clue if the scope of #1 thru #30 has been violated. This to me is a very strong argument in favor of separating global data from local data by the use of #<_name> (note the underscore) for global variables, and #<name> for local to this subroutine data. In my own coding I find that results in far fewer surprises. Either way works if you pay attention but I find that the leading underscore is a reminder that this is global data, and its lack as an indicator that this was intended to be local, vanishing with the end of the subroutine rather handy when I am reading it again later. Named data to me is at least as handy as sliced bread. :) I've no clue if this helps but I hope it does Danny. Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene> ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
