Commit 8bb83590806cc4ff60edb0d1031ab449cf8616a4

Authored by Torello Querci
Committed by Stéphane Raimbault
1 parent bf6718c9

Add some debug message in the send request function.

Showing 1 changed file with 7 additions and 0 deletions
src/modbus-rtu.c
... ... @@ -266,6 +266,10 @@ ssize_t _modbus_rtu_send(modbus_t *ctx, const uint8_t *req, int req_length)
266 266 #else
267 267 modbus_rtu_t *ctx_rtu = ctx->backend_data;
268 268 if (ctx_rtu->usage_rts == MODBUS_USE_RTS) {
  269 + if (ctx->debug) {
  270 + fprintf(stderr, "sending request using RTS signal\n");
  271 + }
  272 +
269 273 ssize_t size;
270 274  
271 275 _modbus_rtu_setrts(ctx->s,1);
... ... @@ -277,6 +281,9 @@ ssize_t _modbus_rtu_send(modbus_t *ctx, const uint8_t *req, int req_length)
277 281  
278 282 return size;
279 283 } else {
  284 + if (ctx->debug) {
  285 + fprintf(stderr, "sending request without RTS signal\n");
  286 + }
280 287 return write(ctx->s, req, req_length);
281 288 }
282 289 #endif
... ...