Yeah, I forgot Machinekit is in a perpetual state of "this might work the way it used to".....or "maybe not". I've recompiled components to swap parameters for pins but I don't think I'd try with a hm2 driver.
If all you want to do is set a parameter from an .ini line you don't have to do anything with Python whatsoever (unless there's some reason you really want to). All you need to do is: In the .ini [SPINDLE] MAXRPM = 12000 In the hal file: setp hm2_5i25.0.pwmgen.00.scale [SPINDLE]MAXRPM That's the pretty standard usage, or am I missing something? On Tuesday, May 19, 2020 at 9:32:11 AM UTC-4, Michael Brown wrote: > > > > On Tuesday, May 19, 2020 at 9:55:51 AM UTC+2, Bas de Bruijn wrote: >> >> Forgot to mention what has cost me a lot of time in the past. >> >> IIRC then in python ‘import hal’ imports the ‘legacy’ LCNC python >> bindings. >> >> If you use ‘from machinekit import hal’ then you use the Machinekit >> cython generated bindings. >> >> If I’m not right about this I hope to get corrected. >> >> >> >> *From:* [email protected] <[email protected]> *On Behalf >> Of *[email protected] >> *Sent:* Tuesday, 19 May 2020 09:51 >> *To:* 'Michael Brown' <[email protected]>; 'Machinekit' < >> [email protected]> >> *Subject:* RE: [Machinekit] Re: halcmd setp equivalent in python >> >> >> >> The Cython bindings do not support Params. I do not know about the >> original python bindings that came from the LCNC fork. >> >> If you have a pin (not param), then you can set it with >> hal.Pin(‘pinname’).set(value) >> > > >> If the params are needed in a python program, the best way would be to >> change the params to pins in the components source. >> > > Well this seems to be doable, I just don't know if its currently possible > to compile in the machinekit-cnc or lcnc part with the current > machinekit-hal status > (I'm running a cnc router with a machinekit-hal/-cnc combo from november > or so) > > Perhaps I should rephrase my question: > > What I would like to construct is something like this (where i can specify > the max spindle rpm [12000] in the ini file) > hal.Param('hm2_5i25.0.pwmgen.00.scale').set(c.find('SPINDLE', > 'MAXRPM')) > or > hal.Pin('hm2_5i25.0.pwmgen.00.scale').set(c.find('SPINDLE', 'MAXRPM')) > > What I have is this: > os.system('halcmd setp hm2_5i25.0.pwmgen.00.scale 12000') > > where I would like to replace the hard coded 12000 with > a c.find('SPINDLE', 'MAXRPM') construction, that probes it from the .ini > file > I just can't figure out how ? > -- website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit --- You received this message because you are subscribed to the Google Groups "Machinekit" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/machinekit/9c84c8d1-a49f-497a-b3de-d64e4c006427%40googlegroups.com.
