Skip to content

Commit c0bd403

Browse files
committed
Fix datatypes
1 parent 0f04954 commit c0bd403

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/ModbusClient.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,13 @@ long ModbusClient::inputRegisterRead(int id, int address)
163163
return value;
164164
}
165165

166-
long ModbusClient::slaveIdRead(int id)
166+
long ModbusClient::slaveIdRead(uint8_t id)
167167
{
168-
uint16_t value;
168+
uint8_t value;
169169

170170
modbus_set_slave(_mb, id);
171171

172-
if (modbus_report_slave_id(_mb, 1, &value); < 0) {
172+
if (modbus_report_slave_id(_mb, 1, &value) < 0) {
173173
return -1;
174174
}
175175

src/ModbusClient.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ class ModbusClient {
8282
long inputRegisterRead(int address);
8383
long inputRegisterRead(int id, int address);
8484

85-
/**
85+
/**
8686
* Perform a "Read Slave ID" operation for a single slave id.
8787
*
8888
* @param id (slave) id of target, defaults to 0x00 if not specified
8989
*
9090
* @return slave id on success, -1 on failure.
9191
*/
92-
long slaveIdRead(int id);
92+
long slaveIdRead(uint8_t id);
9393

9494
/**
9595
* Perform a "Write Single Coil" operation for the specified address and

0 commit comments

Comments
 (0)