From 98f2ba3854d4ef8428add553f0bb1f8f6a222462 Mon Sep 17 00:00:00 2001 From: Peter Denison Date: Thu, 20 Sep 2007 10:34:47 +0000 Subject: [PATCH] Improve error reporting e.g. with bad axis number --- motorApp/MotorSrc/devMotorAsyn.c | 36 +++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/motorApp/MotorSrc/devMotorAsyn.c b/motorApp/MotorSrc/devMotorAsyn.c index db18a0d6..973653f8 100644 --- a/motorApp/MotorSrc/devMotorAsyn.c +++ b/motorApp/MotorSrc/devMotorAsyn.c @@ -11,9 +11,9 @@ * Notwithstanding the above, explicit permission is granted for APS to * redistribute this software. * - * Version: $Revision: 1.20 $ + * Version: $Revision: 1.21 $ * Modified by: $Author: peterd $ - * Last Modified: $Date: 2007-09-18 12:41:59 $ + * Last Modified: $Date: 2007-09-20 10:34:47 $ * * Original Author: Peter Denison * Current Author: Peter Denison @@ -252,8 +252,13 @@ static long init_record(struct motorRecord * pmr ) resolution); */ pasynUser->reason = motorStatus; - pPvt->pasynMotorStatus->read(pPvt->asynMotorStatusPvt, pasynUser, - &pPvt->status); + status = pPvt->pasynMotorStatus->read(pPvt->asynMotorStatusPvt, pasynUser, + &pPvt->status); + if (status != asynSuccess) { + asynPrint(pasynUser, ASYN_TRACE_ERROR, + "%s devMotorAsyn.c::init_record: pasynMotorStatus->read " + "returned %s", pmr->name, pasynUser->errorMessage); + } pasynManager->freeAsynUser(pasynUser); pPvt->needUpdate = 1; @@ -471,8 +476,14 @@ static void asynCallback(asynUser *pasynUser) switch (pmsg->command) { case motorStatus: /* Read the current status of the device */ - pPvt->pasynMotorStatus->read(pPvt->asynMotorStatusPvt, pasynUser, - &pPvt->status); + status = pPvt->pasynMotorStatus->read(pPvt->asynMotorStatusPvt, + pasynUser, + &pPvt->status); + if (status != asynSuccess) { + asynPrint(pasynUser, ASYN_TRACE_ERROR, + "devMotorAsyn::asynCallback: %s pasynMotorStatus->read" + "returned %s\n", pmr->name, pasynUser->errorMessage); + } break; case motorMoveAbs: @@ -482,12 +493,17 @@ static void asynCallback(asynUser *pasynUser) /* Intentional fall-through */ default: if (pmsg->interface == int32Type) { - pPvt->pasynInt32->write(pPvt->asynInt32Pvt, pasynUser, - pmsg->ivalue); + status = pPvt->pasynInt32->write(pPvt->asynInt32Pvt, pasynUser, + pmsg->ivalue); } else { - pPvt->pasynFloat64->write(pPvt->asynFloat64Pvt, pasynUser, - pmsg->dvalue); + status = pPvt->pasynFloat64->write(pPvt->asynFloat64Pvt, pasynUser, + pmsg->dvalue); } + if (status != asynSuccess) { + asynPrint(pasynUser, ASYN_TRACE_ERROR, + "devMotorAsyn::asynCallback: %s pasyn{Float64,Int32}->" + "write returned %s\n", pmr->name, pasynUser->errorMessage); + } break; }