fix(bluetooth): Corrected use of bt_addr_le_cmp
* Properly compare to zero when comparing LE addresses.
This commit is contained in:
parent
73e1b526d5
commit
ed400c4feb
1 changed files with 2 additions and 2 deletions
|
@ -281,14 +281,14 @@ int zmk_ble_put_peripheral_addr(const bt_addr_le_t *addr) {
|
|||
for (int i = 0; i < ZMK_SPLIT_BLE_PERIPHERAL_COUNT; i++) {
|
||||
// If the address is recognized and already stored in settings, return
|
||||
// index and no additional action is necessary.
|
||||
if (!bt_addr_le_cmp(&peripheral_addrs[i], addr)) {
|
||||
if (bt_addr_le_cmp(&peripheral_addrs[i], addr) == 0) {
|
||||
return i;
|
||||
}
|
||||
|
||||
// If the peripheral address slot is open, store new peripheral in the
|
||||
// slot and return index. This compares against BT_ADDR_LE_ANY as that
|
||||
// is the zero value.
|
||||
if (!bt_addr_le_cmp(&peripheral_addrs[i], BT_ADDR_LE_ANY)) {
|
||||
if (bt_addr_le_cmp(&peripheral_addrs[i], BT_ADDR_LE_ANY) == 0) {
|
||||
char addr_str[BT_ADDR_LE_STR_LEN];
|
||||
bt_addr_le_to_str(addr, addr_str, sizeof(addr_str));
|
||||
LOG_DBG("Storing peripheral %s in slot %d", addr_str, i);
|
||||
|
|
Loading…
Add table
Reference in a new issue