aboutsummaryrefslogtreecommitdiffstats
path: root/modbuslog.c
diff options
context:
space:
mode:
Diffstat (limited to 'modbuslog.c')
-rw-r--r--modbuslog.c6
1 files changed, 4 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);