Well seems like my brain started working again and I found out that this 
construction fits that task:

    os.system("halcmd setp hm2_5i25.0.pwmgen.00.scale %s 
"%(c.find('SPINDLE', 'MAXRPM')))

On a side note according to this post:
https://www.mail-archive.com/[email protected]&q=subject:%22%5C%5BMachinekit%5C%5D+Machinekit+Advanced+HAL+Tutorial%22&o=newest&f=1
Parameters are depreciated in machinekit-hal so,
It could seem like a great idea to convert all the Params in hm2 to pins ?
Unless there are worries about breaking too many existing Machinekit mesa 
hm2 configs ?

Best wishes
Michael Brown




On Tuesday, May 19, 2020 at 5:47:05 PM UTC+2, Michael Brown wrote:
>
> Perhaps I will clarify if I point directly to the exact file I'm 
> attempting to rectify:
>
> https://github.com/the-snowwhite/Hm2-soc_FDM/blob/work/Cramps/PY/OX/cramps.py#L91
>
> I'm trying to replace the hard coded 12000 below with the parameter 
> MAXRPM from the .ini file 
> <https://github.com/the-snowwhite/Hm2-soc_FDM/blob/work/Cramps/PY/OX/ox.ini#L382>
> os.system('halcmd setp hm2_5i25.0.pwmgen.00.scale 12000')
>
> I cannot see how to make this work:
>
> os.system('halcmd setp hm2_5i25.0.pwmgen.00.scale c.find('SPINDLE', 
> 'MAXRPM')')
>
>
> On Tuesday, May 19, 2020 at 5:05:42 PM UTC+2, Bas de Bruijn wrote:
>>
>>  
>>
>>  
>>
>> *From:* [email protected] <[email protected]> *On Behalf 
>> Of *justin White
>> *Sent:* Tuesday, 19 May 2020 17:01
>> *To:* Machinekit <[email protected]>
>> *Subject:* Re: [Machinekit] Re: halcmd setp equivalent in python
>>
>>  
>>
>>  
>>
>> 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?
>>
>>  
>>
>>  
>>
>>  
>>
>> Yes, we were talking of doing this from python (see subject)
>>
>

-- 
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/05d8021e-c605-4c46-90ba-8eaddc03fee8%40googlegroups.com.

Reply via email to