diff options
Diffstat (limited to '')
-rw-r--r-- | modbuslog.c | 6 | ||||
-rw-r--r-- | modbuslog.cfg | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/modbuslog.c b/modbuslog.c index 248b8cc..be7a4d1 100644 --- a/modbuslog.c +++ b/modbuslog.c @@ -88,6 +88,7 @@ int main(int argc, char *argv[]) { int modbus_data_bits; const char *modbus_parity; int modbus_stop_bits; + int modbus_retry; config_init(&cfg); @@ -103,7 +104,8 @@ int main(int argc, char *argv[]) { && config_lookup_int(&cfg, "modbus.baud", &modbus_baud_rate) && config_lookup_int(&cfg, "modbus.data_bits", &modbus_data_bits) && config_lookup_string(&cfg, "modbus.parity", &modbus_parity) - && config_lookup_int(&cfg, "modbus.stop_bits", &modbus_stop_bits))) { + && config_lookup_int(&cfg, "modbus.stop_bits", &modbus_stop_bits) + && config_lookup_int(&cfg, "modbus.retry", &modbus_retry))) { fprintf(stderr, "Incomplete modbus configuration. Check configuration file.\n"); return -1; @@ -219,7 +221,7 @@ int main(int argc, char *argv[]) { fprintf(stderr, "ERROR: %s\n", modbus_strerror(errno)); } retry++; - } while ((rc != -1) && (retry < 2)); + } while ((rc != -1) && (retry < (modbus_retry+1))); //MODBUS_GET_HIGH_BYTE(data); //MODBUS_GET_LOW_BYTE(data); diff --git a/modbuslog.cfg b/modbuslog.cfg index 2451b3f..615cea4 100644 --- a/modbuslog.cfg +++ b/modbuslog.cfg @@ -8,6 +8,7 @@ modbus = { data_bits = 8; parity = "E" stop_bits = 1; + retry = 2; }; reading= ( |