Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/serialapi/Serialapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ BYTE SupportsSerialAPISetup_func(BYTE subcmd)
"beyond 1st byte of Extended Z-Wave API Setup Supported Sub"
"Commands bitmask, which is not supported.\n", subcmd);
} else if (subcmd > 8) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend something closer to the source code of the Z-Wave stack:

    uint8_t index = (subcmd - 1) / 8 + 1; // +1 because the sub command bitmask start at index 1 instead of 0.
    uint8_t mask = (1 << ((x - 1) % 8));
    return capabilities.supported_serialapi_bitmask[index] & mask;

return (is_bit_num_set_in_byte(subcmd - 8, capabilities.supported_serialapi_bitmask[2]));
return (is_bit_num_set_in_byte(subcmd - 9, capabilities.supported_serialapi_bitmask[2]));
} else if (subcmd > 0) {
return (is_bit_num_set_in_byte(subcmd ,capabilities.supported_serialapi_bitmask[1]));
return (is_bit_num_set_in_byte(subcmd - 1,capabilities.supported_serialapi_bitmask[1]));
}
} else { // Check the bitflag as only one bit is set
return (capabilities.supported_serialapi_bitmask[0] & subcmd);
Expand Down