On Tuesday 13 December 2016 09:27:22 John Kasunich wrote: > On Tue, Dec 13, 2016, at 06:52 AM, Gene Heskett wrote: > > On Tuesday 13 December 2016 04:35:44 andy pugh wrote: > > > Note that you can specify a thread position explicitly in the > > > "addf" command. I can't find it mentioned in the docs, but it is > > > there in the code > > > https://github.com/LinuxCNC/linuxcnc/blob/af15a4d90e1d51d5309db65f > > >e1c9 511e486df411/src/hal/hal_lib.c#L1973 > > Oops, looks like that got left out of the man page. It has been in > the code pretty much forever, and is documented in halcmd's built-in > help, like so: > > } else if (strcmp(command, "addf") == 0) { > printf("addf functname threadname [position]\n"); > printf(" Adds function 'functname' to thread 'threadname'. If\n"); > printf(" 'position' is specified, adds the function to that spot\n"); > printf(" in the thread, otherwise adds it to the end. Negative\n"); > printf(" 'position' means position with respect to the end of > the\n"); printf(" thread. For example '1' is start of thread, '-1' > is the\n"); printf(" end of the thread, '-3' is third from the > end.\n"); > > > I'd have to assume its a space/tab separated argument, from the > > code, last in the string before any # identifying comments. And it > > opens the door to even greater freedom in composing a .hal sequence > > of files in the manner I described & you clipped. Planning ahead, > > I'll try to use blocks of numbers that may leave gaps so there is > > room to go back later and insert the gear change suggesting code in > > the intervening, still unused numerical space in the thread > > execution order. I currently have 78 in TLM's main hal file, so as a > > starter I'll use 1-20 for one function, 21-40 for the next group. > > Wash rinse and repeat. And find out if it doesn't like missing > > numbers in the sequence. > > It doesn't work that way. > > The position is relative to the function list AS IT EXISTS at the > moment the addf command is executed. Functions are stored in a simple > linked list, not an array, so the concept of "empty spaces" doesn't > exist. Think of index cards in a card file. You can insert a new > card between the 3rd and 4th cards. When you do, the old 4th card > becomes the 5th card, and the new card becomes the 4th one. There are > no numbers associated with the cards - if you want to know which one > is the 4th, you just start at the front of the list and count. If you > want to know which one is 3rd from the end you start at the end and > count the other way.
by useing a -3... > If you have 5 functions in a thread at the moment you run an addf > command, the only legal values for "position" are -6 thru 6. Positive > 6 means 6th in the thread, so it counts off five from the front of the > list and inserts the new one after #5. If you tried positive 7 it > would need to count off 6 from the front of the list. There are only > 5, so the counting would hit the end of the list and throw an error > message. That doesn't sound nearly so usefull John, except as a way to fix a screwup in an existing config. By what you say, I can't even do a addf mux2 1 as the first addf it encounters. I'd imagine there was a theory back when though. So my current method of ordering addf's is still the best for the way this code works. The fifo that drives my spindle encoder noise averager is clocked by haveing its storage elements clocked in reverse order, on purpose. I don't believe that will stop me from doing each motor as a single hallfile. That ma slow the loading time, which is considerable already, drawing the lcnc screen but empty of content, sitting there a good 5 seconds before it fills in the screen with the usual content, and "comes alive" to where the f1/f2 keys actually respond. I believe I am going to look up that OSPark link and get that spi adapter I neglected to save a link to. If it doesn't get in the way mechanically, it will save me a intermittent connection headache in the long run. Thanks John, you just saved me a half an hour trying to make it work the was I'd hoped. 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
