Round system parameter to tenths?

More
3 years 1 week ago #283654 by nick.smith
If I have:

G28.1
(debug , X is #5161)

It will display the result as 5.123456

How can I format it to 5.1234? Also, how can I pull just the integer and modulus?

Please Log in or Create an account to join the conversation.

More
3 years 1 week ago #283655 by cmorley
The following user(s) said Thank You: MaHa

Please Log in or Create an account to join the conversation.

More
3 years 1 week ago #283656 by nick.smith
Excellent, but I'm not on 2.9 sadly.

Please Log in or Create an account to join the conversation.

More
3 years 1 week ago #283690 by andypugh
To answer the second question

#100 = [#5161 MOD 10]
#101 = [#5161 - #100]
(debug, #101 #100)

If you want 2.9, it's installable, but I haven't quite finished all the documentation work around the release. But this process should work:
linuxcnc.org/docs/2.9/html/getting-start...dating-linuxcnc.html
Except that the package name is 2.9-uspace not 2.9-rtpreempt. (That's one of the thinngs I need to change)

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #333664 by xenon-alien
Hello.
I have the same question.
After probing i have the Z coordinate value.
I measuring 2 points to align the B axis.
I'm doing it 2 times.
The 2nd measuring if gives a result with equal 2 decimals don't rotate the B axis.
Is there a code for the g-code to get a result in parameter, like in the debug
%.xf = x (0-9) number of decimals?

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #333674 by andypugh

Is there a code for the g-code to get a result in parameter, like in the debug
%.xf = x (0-9) number of decimals?
No, sorry. 

But if you just want to compare two numbers to see if they differ by less than a certain amount:
Code:
O100 IF [ ABS[#100 - #101] LT 0.01]   <do stuff> O100 ENDIF

linuxcnc.org/docs/html/gcode/overview.html#gcode:functions
linuxcnc.org/docs/stable/html/gcode/o-co...ml#ocode:conditional
 
The following user(s) said Thank You: xenon-alien

Please Log in or Create an account to join the conversation.

Time to create page: 0.066 seconds
Powered by Kunena Forum