forked from things-nyc/arduino-lmic
-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
7386286
commit b87bab1
Showing
6 changed files
with
509 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -557,6 +557,10 @@ scan_mac_cmds( | |
u1_t uprpt = opts[oidx+4] & MCMD_LADR_REPEAT_MASK; // up repeat count | ||
oidx += 5; | ||
|
||
// TODO([email protected]): LoRaWAN 1.1 requires us to process multiple | ||
// LADR requests, and only update if all pass. So this should check | ||
// ladrAns == 0, and only initialize if so. Need to repeat ACKs, so | ||
// we need to count the number we see. | ||
LMIC.ladrAns = 0x80 | // Include an answer into next frame up | ||
MCMD_LADR_ANS_POWACK | MCMD_LADR_ANS_CHACK | MCMD_LADR_ANS_DRACK; | ||
if( !LMICbandplan_mapChannels(chpage, chmap) ) | ||
|
@@ -569,6 +573,10 @@ scan_mac_cmds( | |
e_.info = Base::lsbf4(&d[pend]), | ||
e_.info2 = Base::msbf4(&opts[oidx-4]))); | ||
} | ||
// TODO([email protected]): see above; this needs to move outside the | ||
// txloop. And we need to have "consistent" ansswers for the block | ||
// of contiguous commands (whatever that means), and ignore the | ||
// data rate, NbTrans (uprpt) and txPow until the last one. | ||
if( (LMIC.ladrAns & 0x7F) == (MCMD_LADR_ANS_POWACK | MCMD_LADR_ANS_CHACK | MCMD_LADR_ANS_DRACK) ) { | ||
// Nothing went wrong - use settings | ||
LMIC.upRepeat = uprpt; | ||
|
@@ -672,6 +680,21 @@ scan_mac_cmds( | |
oidx += 4; | ||
continue; | ||
} /* end case */ | ||
case MCMD_TxParamSetupReq: { | ||
#if LMIC_ENABLE_TxParamSetupReq | ||
uint8_t txParam; | ||
txParam = opts[oidx+1]; | ||
|
||
// we don't allow unrecognized bits to come through | ||
txParam &= (MCMD_TxParam_RxDWELL_MASK| | ||
MCMD_TxParam_TxDWELL_MASK| | ||
MCMD_TxParam_MaxEIRP_MASK); | ||
LMIC.txParam = txParam; | ||
LMIC.txParamSetupAns = 1; | ||
#endif // LMIC_ENABLE_TxParamSetupReq | ||
oidx += 2; | ||
continue; | ||
} /* end case */ | ||
} /* end switch */ | ||
/* unrecognized mac commands fall out of switch to here */ | ||
EV(specCond, ERR, (e_.reason = EV::specCond_t::BAD_MAC_CMD, | ||
|
@@ -1222,6 +1245,13 @@ static void buildDataFrame (void) { | |
LMIC.snchAns = 0; | ||
} | ||
#endif // !DISABLE_MCMD_SNCH_REQ | ||
#if LMIC_ENABLE_TxParamSetupReq | ||
if ( LMIC.txParamSetupAns ) { | ||
LMIC.frame[end+0] = MCMD_TxParamSetupAns; | ||
end += 1; | ||
LMIC.txParamSetupAns = 0; | ||
} | ||
#endif | ||
ASSERT(end <= OFF_DAT_OPTS+16); | ||
|
||
u1_t flen = end + (txdata ? 5+dlen : 4); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.