diff --git a/src/cfg.c b/src/cfg.c index 545410c..233c82a 100644 --- a/src/cfg.c +++ b/src/cfg.c @@ -50,7 +50,7 @@ cfg_t cfg; /* Configuration error message */ char cfg_err[INTBUFSIZE + 1]; -#define CFG_ERR(s, v) snprintf(cfg_err, INTBUFSIZE, s, v) +#define CFG_ERR(...) snprintf(cfg_err, INTBUFSIZE, __VA_ARGS__) /* * Setting up config defaults @@ -232,7 +232,7 @@ cfg_handle_param(char *name, char *value) { if (!strlen(value)) { - CFG_ERR("missing logfile value", value); + CFG_ERR("missing logfile value"); return 0; } else if (*value != '/') diff --git a/src/conn.c b/src/conn.c index 9077f92..5266e2c 100644 --- a/src/conn.c +++ b/src/conn.c @@ -245,8 +245,6 @@ conn_write(int d, void *buf, size_t nbytes, int istty) { int rc; fd_set fs; - struct timeval ts, tts; - long delay; #ifdef TRXCTL if (istty && cfg.trxcntl != TRX_ADDC) @@ -266,7 +264,8 @@ conn_write(int d, void *buf, size_t nbytes, int istty) #ifdef TRXCTL if (istty && cfg.trxcntl != TRX_ADDC ) { - tty_delay(DV(nbytes, tty.bpc, cfg.ttyspeed)); + // one char more delay to prevent too early GPIO switch on some HW + tty_delay(DV((nbytes + 1), tty.bpc, cfg.ttyspeed)); tty_set_rx(d); } #endif @@ -839,7 +838,7 @@ conn_loop(void) if (curconn->ctr >= MB_DATA_NBYTES) { /* compute request data length for fc 15/16 */ - unsigned int len; + unsigned int len = 0; switch (MB_FRAME(curconn->buf, MB_FCODE)) { case 15: /* Force Multiple Coils */ diff --git a/src/main.c b/src/main.c index 630b0fa..f122f42 100644 --- a/src/main.c +++ b/src/main.c @@ -194,7 +194,7 @@ main(int argc, char *argv[]) while ((rc = getopt(argc, argv, "dh" #ifdef TRXCTL - "ty:Y:" + "try:Y:" #endif #ifdef HAVE_TIOCRS485 "S"