Quote:
Originally Posted by Alan Anderson
I have two questions about your compressor code. First, why are you storing the compressor reference in a global variable instead of using the refnum registry? Second, why are you reading the compressor status and not doing anything with the result?
|
In the sample I posted I took out all the "misc" code that might have had an effect, but didn't. In our real code we are taking the Compressor (pressure) status and sending it to an LED on the Driver Station.
As for why I'm putting the ref in a global, that's how we do all the refs in our code. It was done this way in the first year of FRC LabVIEW, and I've never really taken to the "new" way of storing them in the registry. I don't like the fact that the registry usage can't be checked by the compiler at build time. Any name typos are only detected at run time, and you have to be looking for them. Plus it's not particularly extensible anyway... Every new refnum type needs it's own put/get VI...
I also don't like the way the code has to do the refnum lookup every time the VI is run. I just got hammered for being inefficient in calling the "start" for the compressor every time around the loop. I don't see why I need to incurr the code/time penalty for looking up the refnum each time around the loop either. It just seemed much more direct to read it from a global variable.
Phil.
__________________
Phil Malone
Garrett Engineering And Robotics Society (GEARS) founder.
http://www.GEARSinc.org
FRC1629 Mentor, FTC2818 Coach, FTC4240 Mentor, FLL NeXTGEN Mentor