PMDX Forum

General Category => SmartBOB controllers and dedicated accessories => Topic started by: beezerlm on August 12, 2016, 04:09:07 PM

Title: DRO from encoder input - PMDX-424
Post by: beezerlm on August 12, 2016, 04:09:07 PM
     I have an DRO panel set up that is reading my encoder input just fine.  I would like for the DRO to display inches instead of encoder pulses.  What type of script would you use and where would you put it?  I understand how to calculate my pulses per inch, I am just unsure of which type of script would be best to interact with this input.
Title: Re: DRO from encoder input - PMDX-424
Post by: Bob at PMDX on August 12, 2016, 05:18:58 PM
I'm not sure you can do that directly in the DRO.  There is an "on update" script that you can add code to.  So you *may* be able to get the current (i.e. new) value, multiply by your scale factor and then somehow write that back to the DRO.  I don't know if that would then trigger ANOTHER update event, creating an infinite loop.

I think what you would have to do is write a Lua function that reads the SmartBOB encoder register, multiplies that by your scale factor to convert to inches, and then update (somehow) a field on the screen.  The script would go in the screen set's PLC script so that it would run periodically. 

There may be a better way.  I would suggest posting this on the MachSupport forums (https://www.machsupport.com/forum/).  There are a few people there who have done lots of things with Lua and may be able to give you some better suggestions.

Bob