Skip to content

Commit

Permalink
modbus: don't show not found errors in first minute
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDvP committed Dec 19, 2024
1 parent 1557fa9 commit c0ed62d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/modbus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,11 @@ ModbusMessage Modbus::handleRead(const ModbusMessage & request) {
}
}
if (error_code) {
LOG_ERROR("Unable to read raw device value %s for tag=%d - error_code = %d", modbusInfo->short_name, (int)tag, error_code);
if (uuid::get_uptime_sec() > 60 || error_code < -2) { // suppress not found messages for the first minute
LOG_ERROR("Unable to read raw device value %s for tag=%d - error_code = %d", modbusInfo->short_name, (int)tag, error_code);
}
response.setError(request.getServerID(), request.getFunctionCode(), SERVER_DEVICE_FAILURE);
return response;
}

response.add(request.getServerID());
Expand Down

0 comments on commit c0ed62d

Please sign in to comment.