Closed kmpeters closed 10 months ago
This is a trivial change that doesn't really need a review. I'm trying to get into the habit of keeping people in the loop as changes happen.
There is a check for ERES=0 in the motor record already:
I'm not sure why this wasn't sufficient protection in the case of the Gailil controller.
I think the problem is that the encoder ratio is set in devMotorAsyn::init_controller https://github.com/epics-modules/motor/blob/81662468d0ab2ff0896eb6fbfab214165122ceb2/motorApp/MotorSrc/devMotorAsyn.c#L185, which is called from devMotorAsyn::init_record https://github.com/epics-modules/motor/blob/81662468d0ab2ff0896eb6fbfab214165122ceb2/motorApp/MotorSrc/devMotorAsyn.c#L418. But in the motor_record.cc the device support init_record is called https://github.com/epics-modules/motor/blob/81662468d0ab2ff0896eb6fbfab214165122ceb2/motorApp/MotorSrc/motorRecord.cc#L647 before the check for ERES=0 https://github.com/epics-modules/motor/blob/81662468d0ab2ff0896eb6fbfab214165122ceb2/motorApp/MotorSrc/motorRecord.cc#L692
Set encoder ratio to 1 if ERES is 0 in devMotorAsyn.c to avoid dividing by 0.
Fixes #213