Skip to content

Commit

Permalink
Fix the SF10 size related to MAC Command for US915 preventing communi…
Browse files Browse the repository at this point in the history
…cations. Also force setting of the DR after JOIN as this one has been a bit strange on E5 and fix the Join estimate DC duration for US915.
  • Loading branch information
disk91 committed Jul 18, 2022
1 parent 2b0ab36 commit 0f28537
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions LoRaComE5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,11 @@ bool processTx(void) {
}
}
}

} else if ( startsWith(loraContext.bufResponse,"+CMSGHEX: Length err") ) {
// current request is not corresponding to the max frame size
// this may be due to a LoRaWan additional content like MAC command
state.cState = EMPTY_DWNLINK; // next time we send a smaller frame
return true; // even if an error, make it as a success.
} else {
// unprocessed lines
}
Expand Down Expand Up @@ -669,20 +673,29 @@ void do_send(uint8_t port, uint8_t * data, uint8_t sz, uint8_t _dr, uint8_t pwr,
// make it simple, the first frame will be lost during join
// 1% based on SF and data size (24 Bytes)
// @TODO also consider ack
switch (_dr) {
case 7: loraContext.estimatedDCMs = 8200; break;
case 8: loraContext.estimatedDCMs = 14400; break;
case 9: loraContext.estimatedDCMs = 26700; break;
case 10: loraContext.estimatedDCMs = 49400; break;
case 11: loraContext.estimatedDCMs = 106900; break;
case 12: loraContext.estimatedDCMs = 197400; break;
default:
LOGLN(("Invalid SF"));
return;
}
if ( loraConf.zone == ZONE_EU868 ) {
switch (_dr) {
case 7: loraContext.estimatedDCMs = 8200; break;
case 8: loraContext.estimatedDCMs = 14400; break;
case 9: loraContext.estimatedDCMs = 26700; break;
case 10: loraContext.estimatedDCMs = 49400; break;
case 11: loraContext.estimatedDCMs = 106900; break;
case 12: loraContext.estimatedDCMs = 197400; break;
default:
LOGLN(("Invalid SF"));
return;
}
} else {
// No Duty Cycle zones, set a minimum time
loraContext.estimatedDCMs = NONDCZONE_DUTYCYCLE_MS;
}
sendATCommand("AT+JOIN","+JOIN: Network joined","+JOIN: Join failed","+JOIN: Done",JOIN_TIMEOUT,true,NULL);
loraContext.isJoining = true;
state.cState = JOINING;
loraContext.lastDr = -1; // Apparently, after the Join the DR needs to be reset or the frame size becomes too long for US915 (or it is service stuff ?)
loraContext.lastPower = -100;
loraContext.lastRetry = -1;

} else {

loraContext.estimatedDCMs = interFrameDutyCycleEstimate(_dr,1);
Expand Down

0 comments on commit 0f28537

Please sign in to comment.