From 9d383432a596d8a4aeb5f67df720d50b8ccc5f23 Mon Sep 17 00:00:00 2001 From: pascallanger Date: Wed, 24 Apr 2024 07:00:44 +0200 Subject: [PATCH] Update SGF22_nrf24l01.ino --- Multiprotocol/SGF22_nrf24l01.ino | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Multiprotocol/SGF22_nrf24l01.ino b/Multiprotocol/SGF22_nrf24l01.ino index 4b4ea1372..00e563ee1 100644 --- a/Multiprotocol/SGF22_nrf24l01.ino +++ b/Multiprotocol/SGF22_nrf24l01.ino @@ -93,9 +93,10 @@ static void __attribute__((unused)) SGF22_send_packet() static void __attribute__((unused)) SGF22_initialize_txid() { - rx_tx_addr[2] &=0x7F; - rx_tx_addr[3] &=0x7F; - uint8_t val = (( (uint16_t) rx_tx_addr[2] << 8 ) | rx_tx_addr[3])%5; + uint16_t val = ( rx_tx_addr[2] << 8 ) | rx_tx_addr[3]; + if ( rx_tx_addr[2] > ( 0xFF - rx_tx_addr[3]) ) + val--; + val %= 5; const uint8_t hop[5][4] = { { 0x0C, 0x2A, 0x1B, 0x39 },