Square one with 5i25+7i76

More
13 Apr 2017 11:43 #91295 by andypugh
andypugh replied the topic: Square one with 5i25+7i76

rotwang wrote: second from bottom in left hand column, "7i76 Mode x I/O Card" (where x may be 0,1,2) click on the down arrow box and you can set the mode for the 7i76.


I didn't seem to be able to change that on my machine. I will try again.

Not that it matters now, but I have thought of a more "Pythonic" way to do things which does not rely on the "magic token" in the index numbers.

Python "For" Loops can have an "else" clause:
book.pythontips.com/en/latest/for_-_else.html

so:
			for j in ("123456789"):
                 	    if ("m"+j) in self.d["mesa0sserial0_%dsubboard"% (i-1)]:
                     	        temp = temp + j
 				break
                 	else: temp = temp + "0"
Should also work.
More
13 Apr 2017 12:51 #91299 by rotwang
rotwang replied the topic: Square one with 5i25+7i76
That is so horrendously non-intuitive that I will try to forget I ever saw it. If Guido has used "then" instead of "else" I might find it more palatable.
Still, any which way it works.
I can try to get some screen shots of the pncconf screens if that will help. The only other thing I can think of is on the "configuration" screen for the 5i25 I have "5i25 internal data" for the source as there seems to have been some historical confusion and a lack of 5i25 .pin and .xml files in the linuxcnc distribution.
Roger
More
13 Apr 2017 13:00 #91301 by andypugh
andypugh replied the topic: Square one with 5i25+7i76

rotwang wrote: That is so horrendously non-intuitive that I will try to forget I ever saw it


I forgive it because it covers an extremely common use-case.
More
13 Apr 2017 14:45 #91316 by tommylight
tommylight replied the topic: Square one with 5i25+7i76
This is geting interesting so i will continue to follow and aplaude from the corner. :)
Once upon a time i wanted to add some more options to pncconfig, but never got to do it. It does the job perfectly for having a basis for later editing to suit the needs that may arise.

Thank you for your great work
More
13 Apr 2017 15:11 #91320 by rotwang
rotwang replied the topic: Square one with 5i25+7i76
No objection to the use-case, seems a reasonable thing to want to do. Maybe I'm too used to too many other languages where "else" is bound to "if" clauses. Seems to me to imply that the "else" is an alternative to the "for" instead of a way of handling the exit condition. If it were formulated as some sort of "try....except" I wouldn't have raised an eyebrow.
Strokes for folks I guess. Just so long as we have the original problem solved.
Roger
More
21 Apr 2017 13:08 #91780 by rotwang
rotwang replied the topic: Square one with 5i25+7i76
That fix works for me, did it get pushed to repositories?
More
21 Apr 2017 13:14 #91781 by andypugh
andypugh replied the topic: Square one with 5i25+7i76

rotwang wrote: That fix works for me, did it get pushed to repositories?


Yes, here it is: github.com/LinuxCNC/linuxcnc/commit/a182...8dad98c056532dbf5c02
The following user(s) said Thank You: tommylight
Moderators: cmorley
Time to create page: 0.078 seconds
Powered by Kunena Forum