Skip to content

Commit

Permalink
ethercatmcIndexer.cpp: Improve printing in indexerParamWrite()
Browse files Browse the repository at this point in the history
Make the printing more verbose when the parameter interface is busy
with an "old" read- or write- request.
These happen kind of frequently when the poller polls parameters
in the background.
  • Loading branch information
tboegi committed Oct 10, 2024
1 parent c5cc866 commit 2b05a6d
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions ethercatmcApp/src/ethercatmcIndexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,20 +576,18 @@ asynStatus ethercatmcController::indexerParamWrite(ethercatmcIndexerAxis *pAxis,
}
unsigned cmdSubParamIndexRB = NETTOUINT(paramIf_from_MCU.paramCtrl);
unsigned paramIndexRB = cmdSubParamIndexRB & PARAM_IF_IDX_MASK;
unsigned paramIfCmd = cmdSubParamIndexRB & PARAM_IF_CMD_MASK;

if (counter >= 1) {
asynPrint(
pasynUserController_, traceMask,
"%sindexerParamWrite(%d) %s(%u 0x%02X) value=%02g "
"counter=%u RB=%s (0x%04X)\n",
modNamEMC, axisNo, plcParamIndexTxtFromParamIndex(paramIndex),
paramIndex, paramIndex, value, counter,
paramIfCmdToString(cmdSubParamIndexRB),
// Print the even the sub-index as HEX, in case the PLC "hides" some
// info here
cmdSubParamIndexRB & (PARAM_IF_SUBIDX_MASK | PARAM_IF_IDX_MASK));
if ((counter >= 1) || (paramIfCmd == PARAM_IF_CMD_BUSY) ||
(paramIfCmd == PARAM_IF_CMD_DOREAD)) {
asynPrint(pasynUserController_, traceMask,
"%sindexerParamWrite(%d) %s(%u 0x%02X) value=%02g "
"counter=%u RB=%s,%s (0x%04X)\n",
modNamEMC, axisNo, plcParamIndexTxtFromParamIndex(paramIndex),
paramIndex, paramIndex, value, counter,
plcParamIndexTxtFromParamIndex(paramIndexRB),
paramIfCmdToString(cmdSubParamIndexRB), cmdSubParamIndexRB);
}
unsigned paramIfCmd = cmdSubParamIndexRB & PARAM_IF_CMD_MASK;
switch (paramIfCmd) {
case PARAM_IF_CMD_DONE: {
if (paramIndexRB == paramIndex) {
Expand Down Expand Up @@ -669,11 +667,12 @@ asynStatus ethercatmcController::indexerParamWrite(ethercatmcIndexerAxis *pAxis,
if (paramIndexIsMovingFunction(paramIndex)) {
asynPrint(pasynUserController_, traceMask,
"%sindexerParamWrite(%d) %s(%u 0x%02X) value=%02g "
"movingFun RB=%s (0x%04X)\n",
"movingFun RB=%s,%s (0x%04X)\n",
modNamEMC, axisNo,
plcParamIndexTxtFromParamIndex(paramIndex), paramIndex,
paramIndex, value, paramIfCmdToString(cmdSubParamIndexRB),
cmdSubParamIndexRB);
paramIndex, value,
plcParamIndexTxtFromParamIndex(paramIndexRB),
paramIfCmdToString(cmdSubParamIndexRB), cmdSubParamIndexRB);
if (paramIndexRB == paramIndex) {
/* "our" function: return */
if (pValueRB) *pValueRB = valueRB;
Expand Down

0 comments on commit 2b05a6d

Please sign in to comment.