Reduced output from MasterMacsDriver

This commit is contained in:
2023-07-13 10:57:07 +02:00
parent f1a17bc295
commit 7a81e2c5a0

View File

@ -28,6 +28,8 @@
#define CHECK_BIT(var,pos) ((var) & (1 << pos)) #define CHECK_BIT(var,pos) ((var) & (1 << pos))
#define ABS(x) (x < 0 ? -(x) : (x)) #define ABS(x) (x < 0 ? -(x) : (x))
#define debug 0
/** Creates a new MasterMACSController object. /** Creates a new MasterMACSController object.
* \param[in] portName The name of the asyn port that will be created for this driver * \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 * \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); free(mmacsData);
/* format and print the response in hex for debugging purposes */ /* format and print the response in hex for debugging purposes */
/* if(debug) {
for(i = 0, idx = 0; i < in; i++){ for(i = 0, idx = 0; i < in; i++){
sprintf(hexResponse + idx, "%02x ", (unsigned int)mmacsResponse[i]); sprintf(hexResponse + idx, "%02x ", (unsigned int)mmacsResponse[i]);
idx = strlen(hexResponse); idx = strlen(hexResponse);
} }
errlogSevPrintf(errlogMajor,"Reply in hex: %s\n", hexResponse); errlogSevPrintf(errlogMajor,"Reply in hex: %s\n", hexResponse);
*/ }
/* Here we have read the data from the MasterMACS. We proceed to extract /* 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 * the payload and the state of the ACK byte and place that reply into data
@ -234,8 +236,9 @@ asynStatus
lenPayload = idx - 4; lenPayload = idx - 4;
memcpy(reply + 4, mmacsResponse + 4, lenPayload); memcpy(reply + 4, mmacsResponse + 4, lenPayload);
reply[4 + lenPayload] = (char) 0; 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; return status;
} }
@ -261,7 +264,7 @@ asynStatus
if (function == enableAxis_) { if (function == enableAxis_) {
/* /*
* Read the status in order to prevent execssiove commands * Read the status in order to prevent execssive commands
*/ */
devStatus = pAxis->readStatus(); devStatus = pAxis->readStatus();
if(devStatus < 900){ if(devStatus < 900){
@ -606,8 +609,10 @@ asynStatus MasterMACSAxis::poll(bool * moving)
goto skip; goto skip;
} }
errlogPrintf("Axis %d, position %lf, devStatus %d\n", axisNo_, if(debug) {
position, devStatus); errlogPrintf("Axis %d, position %lf, devStatus %d\n", axisNo_,
position, devStatus);
}
if (!isOn(devStatus)) { if (!isOn(devStatus)) {
setIntegerParam(pC_->motorStatusProblem_, true); setIntegerParam(pC_->motorStatusProblem_, true);
@ -693,8 +698,10 @@ asynStatus MasterMACSAxis::poll(bool * moving)
sscanf(pPtr + 1, "%f", &errStatus); sscanf(pPtr + 1, "%f", &errStatus);
derCode = (unsigned int) 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); errCode, derCode);
}
setIntegerParam(pC_->motorStatusProblem_, true); setIntegerParam(pC_->motorStatusProblem_, true);
if (errCode == 0) { if (errCode == 0) {