ver1
Diff: plans/ChannelPlan_IN865.cpp
- Revision:
- 167:09fd17fee0f5
- Parent:
- 157:8e9b1e84ffac
- Child:
- 172:7ec44396a51b
--- a/plans/ChannelPlan_IN865.cpp Tue Jul 17 09:45:05 2018 -0500 +++ b/plans/ChannelPlan_IN865.cpp Fri Jul 20 11:05:53 2018 -0500 @@ -102,9 +102,7 @@ dr.Index++; } - // Add DR6 - dr.SpreadingFactor = SF_7; - dr.Bandwidth = BW_250; + // Skip DR6 AddDatarate(-1, dr); dr.Index++; @@ -232,7 +230,8 @@ int8_t pwr = 0; - pwr = std::min < int8_t > (GetSettings()->Session.TxPower, (max_pwr - GetSettings()->Network.AntennaGain)); + pwr = std::min < int8_t > (GetSettings()->Session.TxPower, max_pwr); + pwr -= GetSettings()->Network.AntennaGain; for (int i = 20; i >= 0; i--) { if (RADIO_POWERS[i] <= pwr) { @@ -608,7 +607,7 @@ return status; } - if (datarate > _maxDatarate) { + if (datarate > _maxDatarate || datarate == DR_6) { logWarning("ADR Datarate KO - outside allowed range"); status &= 0xFD; // Datarate KO } @@ -992,3 +991,24 @@ return LORA_ERROR; } +//in865 skips dr6 rfu + +void ChannelPlan_IN865::IncrementDatarate() { + uint8_t dr = GetSettings()->Session.TxDatarate; + if (dr < _maxDatarate) + dr++; + if(dr == DR_6) + dr= DR_7; + GetSettings()->Session.TxDatarate = dr; + +} + +void ChannelPlan_IN865::DecrementDatarate() { + uint8_t dr = GetSettings()->Session.TxDatarate; + if (dr > _minDatarate) + dr--; + if(dr == DR_6) + dr= DR_5; + GetSettings()->Session.TxDatarate = dr; +} +