Skip to content

Commit 8938bea

Browse files
authored
Fix define ON OFF conflict with other libraries (arduino-libraries#77)
* Remove conflicting #define These defines conflict the use of ON with other arduino libraries. It is only used in one place in modbus.c
1 parent f912539 commit 8938bea

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

src/libmodbus/modbus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ int modbus_reply(modbus_t *ctx, const uint8_t *req,
864864
#else
865865
if (data == 0xFF00 || data == 0x0) {
866866
#endif
867-
mb_mapping->tab_bits[mapping_address] = data ? ON : OFF;
867+
mb_mapping->tab_bits[mapping_address] = data ? 1 : 0;
868868
memcpy(rsp, req, req_length);
869869
rsp_length = req_length;
870870
} else {

src/libmodbus/modbus.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,6 @@ MODBUS_BEGIN_DECLS
5050
#define TRUE 1
5151
#endif
5252

53-
#ifndef OFF
54-
#define OFF 0
55-
#endif
56-
57-
#ifndef ON
58-
#define ON 1
59-
#endif
6053

6154
/* Modbus function codes */
6255
#define MODBUS_FC_READ_COILS 0x01

0 commit comments

Comments
 (0)