ver1
Diff: plans/ChannelPlan_AS923.cpp
- Revision:
- 109:41d16d4ab0f0
- Parent:
- 82:0f5a742a08cd
- Child:
- 115:bcd44682ac1e
--- a/plans/ChannelPlan_AS923.cpp Thu Sep 21 14:20:14 2017 -0500 +++ b/plans/ChannelPlan_AS923.cpp Mon Nov 13 09:34:56 2017 -0600 @@ -620,6 +620,12 @@ logWarning("ADR Datarate KO - outside allowed range"); status &= 0xFD; // Datarate KO } + + if (GetSettings()->Session.UplinkDwelltime != 0 && datarate < DR_2) { + logWarning("ADR Datarate KO - TxDwelltime != 0 and DR < 2"); + status &= 0xFD; // Datarate KO + } + if (power < _minTxPower || power > _maxTxPower) { logWarning("ADR TX Power KO - outside allowed range"); status &= 0xFB; // TxPower KO @@ -1046,3 +1052,15 @@ return LORA_OK; } +void ChannelPlan_AS923::DecrementDatarate() { + if(GetSettings()->Session.UplinkDwelltime == 0) { + _minDatarate = lora::DR_0; + } else { + _minDatarate = lora::DR_2; + } + + if (GetSettings()->Session.TxDatarate > _minDatarate) { + GetSettings()->Session.TxDatarate--; + } +} +