Add global parameters while running

26 Feb 2021 00:56 - 26 Feb 2021 00:58 #200156 by grandixximo
I wanted to make a reliable Gcode that may have different input values, according to these input values I'd like to add a certain amount of global parameters.

The easy approach would be to create all variables I may ever need, and then all possible roots where I would need these variables. I was wondering if there was a more elegant solution

an example of what I mean
o<var>call [1](variable group identifier) [3] (quantity of variables needed)



depending on the parameters passed to the sub, different parameters should be created

Is there a way to change the name of the group parameter by giving it a parameter in the name?

I've tried also making an executable to be called by custom M-code that will change the subroutine on the fly, and then call it, but that doesn't work, as the subs seem to be loaded in memory before the fact, so changing it on the fly on the hard drive doesn't work, maybe there is a way to force reload the subs before executing them?
Last edit: 26 Feb 2021 00:58 by grandixximo.

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

27 Feb 2021 18:12 #200322 by aleksamc
try o<#<cahnging parameter>+1> call

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

01 Mar 2021 11:59 #200682 by MaHa
Maybe it's best to do this with numbered parameter, them are Global, the range from 31-5602 available. Returning zero, when uninitialized. No need to create in advance.
Only uninitialized named parameters produce an error when used.

Numbered parameters name can also very easy be accessed with some calculation with variables
#100 = 5                 ;Variable No.
#101 = 8                 ;Group
#[[100 * #101] + #100]   ;results #805, this could be Group8 Variable05

;Another attempt with Named Parameter Variant, change 2 variables within the name:

The named Parameter Variant can also be done, but exactly the same syntax (eg. #101 / #100 ) is required for read and write. It worked for me to create a matrix, only with numbered variables. as shown.
So it is needed to always set #100 and #101 first
#<_GROUP[#101]VAR[#100]> = 1234
The following user(s) said Thank You: Aciera

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

Time to create page: 0.095 seconds
Powered by Kunena Forum