Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev asyn motor remove init event #1

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

tboegi
Copy link
Contributor

@tboegi tboegi commented Oct 9, 2020

No description provided.

Copy link
Contributor

@MarkRivers MarkRivers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asynPrint formats should be changed

pmr->name, setPos );
} else {
asynPrint(pasynUser, ASYN_TRACE_FLOW,
"devMotorAsyn::init_controller, %s set position to %f\n",
"devMotorAsyn::init_controller, %s set position to %2.6lf\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%lf is not a correct format for printf(). It should just be %f. I don't think we should be giving precision and width, we don't know the magnitude of these values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review, @MarkRivers
I agree that the %f should be the default for a generic code base.
A new version had been pushed.
Unless we introduce a macro/#define and make the configurable, but that is another story.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see even the version for upstream motor:
epics-modules/motor#167

When the motorRecord is initialized, init_record() is called.
For asynMotors init_record() calls init_controller() in devMotorAsyn.c

From here, the encoder ratio is send to the driver.
After doing that, the code "locks" the execution waiting for a callback
to call epicsEventSignal(pPvt->initEvent) which "unlocks" the code.

As Mark Clift points out, this code can be simplified and the initEvent
can be removed.

Mark Rivers suggested to use the asynFloat64SyncIO interface,
which locks the asyn port when calling the driver.
…nitEvent

Conflicts:
    motorApp/MotorSrc/devMotorAsyn.c
@tboegi tboegi force-pushed the dev-asynMotor-remove-initEvent branch from 0595f69 to 8dee7bf Compare October 12, 2020 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants