Quote:
Originally Posted by Doug Norman
One way some teams do this is by creating a typedef enum updated with a list of all their RefNum names. Then they simply drop that enum followed by the Format Into String function any place they need a RefNum name. It's a bit of extra code, but makes it so they don't have to remember the names or correct spellings - they simply pick it from the enum list.
|
We've done that, and actually took the concept a bit farther a couple of years ago. Along with the typedefs (.ctl files in LabVIEW), we had a Global Variable vi full of cluster constant arrays that defined everything that goes into the Open functions. In Begin, we looped through those arrays for Drive, Digital Input, Motor, Encoder, etc. to open everything. In Finish, we did the same thing to close everything. We made copies of each Refnum Get vi and modified them to take the enum directly. The rest of the robot code looked almost the same as the "normal" way of doing things, except that the enums are blue where strings are pink.