06-20-2012 07:59 AM
One of the big pains that I have encountered is when you change IO on a custom device, you have to delete and re-add the custom device to a Veristand Project to get the new channels in the project. This destroys all channel linking and creates great pains when changing large channel count custom devices.
I've created a good work around. I create a VI that scans the current channels in the Veristand Project against the channel list in the compiled custom device. I then delete the items that don't belong and add the channels that don't exist. The net result is that only the channels that are removed create bad links (obviously) and all old links stay in tact.
I then create a right click menu on the main page of the custom device that executes the VI I have created.
The end result is a refresh function that works exactly like the 'Refresh' button on a model.
Solved! Go to Solution.
06-20-2012 08:17 AM
I attached the code snippet as an attachment because it wouldn't fit in a message
Here is the xml portion
<Page> <Name> <eng>Lambda Genesys Power Supply</eng> <loc>Lambda Genesys Power Supply</loc> </Name> <GUID>cfbe9b2f-9a5f-4094-9071-559baab0f5b2</GUID> <Glyph> <Type>To Application Data Dir</Type> <Path>System Explorer\Glyphs\Lambda.png</Path> </Glyph> <Item2Launch> <Type>To Common Doc Dir</Type> <Path>Custom Devices\Lambda Genesys Power Supply\Lambda Genesys Power Supply Configuration.llb\Lambda Genesys Power Supply Main Page.vi</Path> </Item2Launch> <RunTimeMenu> <MenuItem> <GUID>183aa855-54a1-44dd-8579-4042fa0d765d</GUID> <Type>Action</Type> <Name> <eng>Refresh Custom Device</eng> <loc>Refresh Custom Device</loc> </Name> <Item2Launch> <Type>To Common Doc Dir</Type> <Path>Custom Devices\Lambda Genesys Power Supply\Reload Channels.vi</Path> </Item2Launch> </MenuItem> </RunTimeMenu> </Page>
07-16-2012 04:30 AM
Hi, MPCC.
I have the same issue and your solution is fantastic, but I have one question. Can it be included in existing custom devices? or only in news? I have a very large project with custom devices already compiled and I need to update them. So, do you know how to include in the existing ones?
Can you upload an example?
Thanks in advance.
Miguel
07-16-2012 11:03 AM - edited 07-16-2012 11:06 AM
One other things you can do to make this process more automatic is to use an "On Load" action VI. I use this approach to add mutation code to convert custom devices between versions. For example, in my Scan Engine and EtherCAT custom device, I added some extra status channels in my 3.4 version. To accomodate users which have a system definition file with an older version of the custom device, I added an OnLoad action to the main page to automatically add the new channels to their system definition file. If I have additional changes in future versions, I can just add a new case to this VI. The nice thing about this approach is that it will run any necessary upgrades in order, so that you can correctly upgrade any older version of the custom device.
In order to use this approach, you will need to increment the <Version> tag in the custom device xml whenever you make changes to it (you should be doing this anyway). I have attached a screenshot of my code and the relevent XML, but if you want to check it out further, you can download the source code for the custom device at the link above.
Hope this helps!
Devin
<Page>
<Name>
<eng>Scan Engine and EtherCAT</eng>
<loc>Scan Engine and EtherCAT</loc>
</Name>
<DisallowRenaming>true</DisallowRenaming>
<GUID>A04A67D4-9B64-052B-A031-6B05377B9B10</GUID>
<Glyph>
<Type>To Application Data Dir</Type>
<Path>System Explorer\Glyphs\network.png</Path>
</Glyph>
<Item2Launch>
<Type>To Common Doc Dir</Type>
<Path>Custom Devices\Scan Engine\Scan Engine - Configuration.llb\Scan Engine Main Page.vi</Path>
</Item2Launch>
<ActionVIOnLoad>
<Type>To Common Doc Dir</Type>
<Path>Custom Devices\Scan Engine\Scan Engine - Configuration.llb\Main - On Load.vi</Path>
</ActionVIOnLoad>
</Page>
07-16-2012 12:43 PM
Hi Devin_K.
Thanks for your answer but I'm having problems updating my custom devices. I have created them using the "Custom Device Template Tool.vi" provided by NI and adding my code, so I'm not very familiar including new vi's on my custom devices. I use to create a new "Asynchronous" device with Input and Output screen.
I can upload one of my custom devices. Can you help me to include this code on it? It would be fantastic because I don't know how to do it and I need to update a lot of devices. If you help me with one of them I'll be able to update the other ones by myself.
Thanks in advance.
Miguel.
07-25-2012 02:00 PM