mirror of
https://github.com/3cky/mbusd
synced 2025-10-12 23:14:13 +08:00
Add one char delay before switching TRX control, fixed warnings (#115)
* Added one char to delay TRX control after write * fixed warnings * fix non working -r argument --------- Co-authored-by: Daniel Beneš <benes@energycoud.cz>
This commit is contained in:
parent
4a05446732
commit
6b4248aa71
|
@ -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 != '/')
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue
Block a user