From 7a81e2c5a041068f1caa95969ba1d14a68a1af22 Mon Sep 17 00:00:00 2001 From: koennecke Date: Thu, 13 Jul 2023 10:57:07 +0200 Subject: [PATCH] Reduced output from MasterMacsDriver --- sinqEPICSApp/src/MasterMACSDriver.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/sinqEPICSApp/src/MasterMACSDriver.cpp b/sinqEPICSApp/src/MasterMACSDriver.cpp index b1d1db6..24c7909 100644 --- a/sinqEPICSApp/src/MasterMACSDriver.cpp +++ b/sinqEPICSApp/src/MasterMACSDriver.cpp @@ -28,6 +28,8 @@ #define CHECK_BIT(var,pos) ((var) & (1 << pos)) #define ABS(x) (x < 0 ? -(x) : (x)) +#define debug 0 + /** Creates a new MasterMACSController object. * \param[in] portName The name of the asyn port that will be created for this driver * \param[in] MasterMACSPortName The name of the drvAsynSerialPort that was created previously to connect to the MasterMACS controller @@ -187,13 +189,13 @@ asynStatus free(mmacsData); /* format and print the response in hex for debugging purposes */ - /* + if(debug) { for(i = 0, idx = 0; i < in; i++){ sprintf(hexResponse + idx, "%02x ", (unsigned int)mmacsResponse[i]); idx = strlen(hexResponse); } errlogSevPrintf(errlogMajor,"Reply in hex: %s\n", hexResponse); - */ + } /* Here we have read the data from the MasterMACS. We proceed to extract * the payload and the state of the ACK byte and place that reply into data @@ -234,8 +236,9 @@ asynStatus lenPayload = idx - 4; memcpy(reply + 4, mmacsResponse + 4, lenPayload); reply[4 + lenPayload] = (char) 0; - errlogSevPrintf(errlogMajor, "Completed reply at end of transactController: %s ", reply); - + if(debug) { + errlogSevPrintf(errlogMajor, "Completed reply at end of transactController: %s ", reply); + } return status; } @@ -261,7 +264,7 @@ asynStatus if (function == enableAxis_) { /* - * Read the status in order to prevent execssiove commands + * Read the status in order to prevent execssive commands */ devStatus = pAxis->readStatus(); if(devStatus < 900){ @@ -606,8 +609,10 @@ asynStatus MasterMACSAxis::poll(bool * moving) goto skip; } - errlogPrintf("Axis %d, position %lf, devStatus %d\n", axisNo_, - position, devStatus); + if(debug) { + errlogPrintf("Axis %d, position %lf, devStatus %d\n", axisNo_, + position, devStatus); + } if (!isOn(devStatus)) { setIntegerParam(pC_->motorStatusProblem_, true); @@ -693,8 +698,10 @@ asynStatus MasterMACSAxis::poll(bool * moving) sscanf(pPtr + 1, "%f", &errStatus); derCode = (unsigned int) errStatus; - errlogPrintf("Axis %d, errCode(R11) %d, derCode(R18) %d\n", axisNo_, + if(debug) { + errlogPrintf("Axis %d, errCode(R11) %d, derCode(R18) %d\n", axisNo_, errCode, derCode); + } setIntegerParam(pC_->motorStatusProblem_, true); if (errCode == 0) {