Fork of Semtech LoRaWAN stack

Fork of LoRaWAN-lib by canuck lehead

Files at this revision

API Documentation at this revision

Comitter:
ubhat
Date:
Wed Nov 09 06:05:41 2016 +0000
Branch:
v4.2.0
Parent:
25:8d0a79bd607b
Child:
27:cda377b2a41f
Child:
28:307e6c4831ad
Commit message:
Validate Payload length before re-transmission upon missed ACK

Changed in this revision

LoRaMac.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/LoRaMac.cpp	Fri Oct 21 18:55:54 2016 +0000
+++ b/LoRaMac.cpp	Wed Nov 09 06:05:41 2016 +0000
@@ -1536,6 +1536,12 @@
                 if( ( AckTimeoutRetriesCounter % 2 ) == 1 )
                 {
                     ChannelsDatarate = MAX( ChannelsDatarate - 1, LORAMAC_TX_MIN_DATARATE );
+                    // Check if new datarate is valid for the Payload length
+					if( ValidatePayloadLength( LoRaMacBufferPktLen - 13, ChannelsDatarate, 0 ) == false )
+					{							
+						// If invalid payload length, then revert to previous datarate
+						ChannelsDatarate++;
+					}
                 }
                 LoRaMacFlags.Bits.MacDone = 0;
                 // Sends the same frame again