Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
EchterAgo committed Sep 19, 2023
1 parent fd1bace commit 721718b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/apc_modbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define DRIVER_NAME "NUT APC Modbus driver"
#define DRIVER_VERSION "0.01"

#define MODBUS_SLAVE_ID 1
#define MODBUS_DEFAULT_SLAVE_ID 1

/* Variables */
static modbus_t *modbus_ctx = NULL;
Expand Down Expand Up @@ -192,11 +192,11 @@ void upsdrv_initups(void)
fatalx(EXIT_FAILURE, "Unable to create the libmodbus context");
}

// TODO: getval for slave id, this is configurable on some devices and can be useful where
r = modbus_set_slave(modbus_ctx, MODBUS_SLAVE_ID); /* slave ID */
// TODO: getval for slave id, this is configurable on some devices and can be useful where multiple UPS are connected to an actual bus
r = modbus_set_slave(modbus_ctx, MODBUS_DEFAULT_SLAVE_ID); /* slave ID */
if (r < 0) {
modbus_free(modbus_ctx);
fatalx(EXIT_FAILURE, "Invalid modbus slave ID %d",MODBUS_SLAVE_ID);
fatalx(EXIT_FAILURE, "Invalid modbus slave ID %d",MODBUS_DEFAULT_SLAVE_ID);
}

if (modbus_connect(modbus_ctx) == -1) {
Expand Down

0 comments on commit 721718b

Please sign in to comment.