What's new
VORON Design

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members!

Question Config parameters as variables?

Eremius

Member
I am configuring the klipper_z_calibration mod for use with my euclid probe.

It looks like the config file for the mod wants a lot of data duplication of info that are available in other config files.

It seems like the smart way to do this would be to be able to access the data as a variable. For instance, z_cali sets a config which uses a value of 2 x z_offset. It seems like instead of explicitly setting that number I should be able to do "$z_offset * 2".

Is this a thing? Are you able to reference other configured parameters? It seems like this is a gimme in terms of usability and code clarity.
 
I am configuring the klipper_z_calibration mod for use with my euclid probe.

It looks like the config file for the mod wants a lot of data duplication of info that are available in other config files.

It seems like the smart way to do this would be to be able to access the data as a variable. For instance, z_cali sets a config which uses a value of 2 x z_offset. It seems like instead of explicitly setting that number I should be able to do "$z_offset * 2".

Is this a thing? Are you able to reference other configured parameters? It seems like this is a gimme in terms of usability and code clarity.

Maybe what you are asking for is not a "variable" but a macro. Let's say you have an IDEX system with two print heads, then you would define "MAXTEMP = 270" at the top of the config file and then wherever you needed the number "270" you would put the text "MAXTEMP". It is not a variable because it can never vary. Some programming languages call these "constants"

With effort, you could do this now. UNIX and now Linux since the mid-1970s have come with a general-purpose macro processor called "m4". I bet you already have m4 installed. So you write your config file as a dot.m4 file and then process it with m4 and it generates the dot.config file. IBut don't think Klipper config files are repetitive enough to warrant the effort.

I think a better way and what is needed is a web-app that has a form where you select your controller board and which printer you have and some other things then it checks for errors and writes a config file for you.
 
Top