Lora-net / SWL2001

LoRa Basics Modem LoRaWAN stack
BSD 3-Clause Clear License
104 stars 60 forks source link

LR-FHSS datarate decay certification test failing for LBM 4.3.0 #33

Closed lbm-team closed 6 months ago

lbm-team commented 8 months ago

In the EU868 region the data rate decay does not work properly.

DR9->DR8->DR0 is OK DR11->DR10->DR0 is NOT OK when DR8-DR9 are still enabled

Below is the proposed fix to resolve the issue:

diff --git a/lbm_lib/smtc_modem_core/lr1mac/src/smtc_real/src/smtc_real.c b/lbm_lib/smtc_modem_core/lr1mac/src/smtc_real/src/smtc_real.c
index 2103d198cd79b72f1759798138425cfe224b1b91..a54583a74d2dfef31249ea9338f0bdb464f0c918 100644
--- a/lbm_lib/smtc_modem_core/lr1mac/src/smtc_real/src/smtc_real.c
+++ b/lbm_lib/smtc_modem_core/lr1mac/src/smtc_real/src/smtc_real.c
@@ -1192,8 +1192,12 @@ void smtc_real_decrement_dr( smtc_real_t* real, dr_strategy_t adr_mode_select, u

     if( *tx_data_rate_adr != smtc_real_get_min_tx_channel_dr( real ) )
     {
-        *tx_data_rate_adr = smtc_real_decrement_dr_simulation( real, *tx_data_rate_adr );
-        return;
+        uint8_t dr_tmp = smtc_real_decrement_dr_simulation( real, *tx_data_rate_adr );
+        if( *tx_data_rate_adr != dr_tmp )
+        {
+            *tx_data_rate_adr = dr_tmp;
+            return;
+        }
     }

     //  nb_trans must set to 1 and all default channels re-enabled
lbm-team commented 6 months ago

Fixed in v4.3.1