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 to join the conversation.

More
3 years 1 week ago #283655 by cmorley

Please Log in 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 to join the conversation.

More
3 years 6 days 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 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 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
 

Please Log in to join the conversation.

More
1 year 2 months ago #333754 by xenon-alien

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 https://linuxcnc.org/docs/html/gcode/overview.html#gcode:functions https://linuxcnc.org/docs/stable/html/gcode/o-code.html#ocode:conditional  

Thank you.
I saw that documents, but  I'm not realized it can be done so simple way...

Please Log in to join the conversation.

More
1 year 2 months ago #333932 by xenon-alien
I figured out how to make it work the axis alignment
But on 2.8.4 LCNC my code hangs out the LCNC when i uncomment the:
O100 do
O100 while [#_<ValueABS> GT 0.007]
The whole code in the attachment.

I want to combine 3 measurings in one file (also in attachment), but the same result - The LCNC freezes out without errors.

The decimal test code works fine
Maybe the global parameters makes the issue?
Can anyone tell how to solve this?

Please Log in to join the conversation.

More
1 year 2 months ago #334042 by andypugh
You may be seeing a problem caused by the G-code preview. That runs through the code to draw the lines, but won't update values based on probe results etc (as it doesn't _move_ anything).

The trick here is probably
Code:
O100 while [#<_task> EQ 1.0 AND #<_deltaabs> GT 0.007]

Which will end the loop early in preview generation.

linuxcnc.org/docs/stable/html/gcode/over...ub:system-parameters

Please Log in to join the conversation.

More
1 year 2 months ago #334076 by xenon-alien

The trick here is probably
Code:
O100 while [#<_task> EQ 1.0 AND #<_deltaabs> GT 0.007]
 
Thank you! It's HELPED!!
 

Attachment not found

Please Log in to join the conversation.

Time to create page: 0.098 seconds
Powered by Kunena Forum