Skip to content

Commit c5a9c2e

Browse files
committed
Fix addressing bug in _doSign bitfield
1 parent 4e70a2c commit c5a9c2e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

libraries/MySensors/MySensor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525
#ifdef MY_SIGNING_FEATURE
2626
// Macros for manipulating signing requirement table
27-
#define DO_SIGN(node) (node == 0 ? (~doSign[0]&1) : (~doSign[node>>4]&(node%16)))
28-
#define SET_SIGN(node) (node == 0 ? (doSign[0]&=~1) : (doSign[node>>4]&=~(node%16)))
29-
#define CLEAR_SIGN(node) (node == 0 ? (doSign[0]|=1) : (doSign[node>>4]|=(node%16)))
27+
#define DO_SIGN(node) (~_doSign[node>>3]&(1<<(node%8)))
28+
#define SET_SIGN(node) (_doSign[node>>3]&=~(1<<(node%8)))
29+
#define CLEAR_SIGN(node) (_doSign[node>>3]|=(1<<(node%8)))
3030
#endif
3131

3232
// Inline function and macros

libraries/MySensors/MySensor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ class MySensor
366366

367367
MyTransport& radio;
368368
#ifdef MY_SIGNING_FEATURE
369-
uint16_t doSign[16]; // Bitfield indicating which sensors require signed communication
369+
uint8_t doSign[32]; // Bitfield indicating which sensors require signed communication
370370
MyMessage msgSign; // Buffer for message to sign.
371371
MySigning& signer;
372372
#endif

0 commit comments

Comments
 (0)