Closed mark0n closed 10 years ago
Yes, the asyn device support overwrites the default record value at iocInit. It's because I'm setting a default value in the controller constructor, like:
setIntegerParam(P6K_C_TLIMEnable, 0)
Using autosave on TLIM will solve it.
I could take a different approach and not initialize the parameters in the driver, which would allow setting default parameters via the database. But then my code relies on a database being there, otherwise I'm reading uninitialized values from the parameter list.
It's probably best if I only initialize read-only database parameters. Then I let the database set the default value for the read/write params. Sounds ok?
I still don't understand why initialization in p6kController::p6kController(...)
does overwrite values set by records with PINI==YES
. Isn't the constructor called before the record processes the first time?
The constructor is called first yes, then the record is initialized during iocInit. Then in the asyn device support it decides to take the value from the driver as the correct value, rather than the database value. I guess it's an asyn design decision, but I've haven't looked into it that much.
There's a comment about it in one of the areaDetector base classes, about not setting default values for read/write parameters, which is why I think I should be doing that in the motor driver too.
I see. AFAIK I do not use any of the other read/write parameters. Removing the init line fixes my problem. So I think you can go ahead and remove them.
I removed some of the lines in the constructor that initialized parameters that should have default values in the database.
For some reason enabling TLIM polling on IOC start does not work for me. Here is what I have in my DB:
The record's status after IOC boot is:
So it did process but it has a wrong value. Sniffing the connection to the controller I cannot see any TLIM commands, though. A caput with value "1" to this record at a later point in time works, though.
When I remove the which means the record never processed. But the
PINI
field from the record I getTIME
VAL
field is 0. Does the device support overwrite this value (maybe using the state of the controller object) on IOC start? Doing the same without settingDTYP
andOUT
works as expected (VAL
==1)