Enable/disable ADR

This commit is contained in:
Manuel Bl 2020-07-31 17:48:11 +02:00
parent 513ac44268
commit b73ed23a97
2 changed files with 28 additions and 1 deletions

View File

@ -221,12 +221,29 @@ public:
*
* This value is added to RSSI measured prior to decision. It must include the guardband.
* Ignored in US, EU, IN and other countries where LBT is not required.
* Default to 10 dB.
* Defaults to 10 dB.
*
* @param rssiCal RSSI calibration value, in dB
*/
void setRSSICal(int8_t rssiCal);
/**
* Returns whether Adaptive Data Rate (ADR) is enabled.
* @return true if enabled
* @return false if disabled
*/
bool adrEnabled();
/**
* @brief Enables or disabled Adaptive Data Rate (ADR).
*
* ADR is enabled by default. It optimizes data rate, airtime and energy consumption
* for devices with stable RF conditions. It should be turned off for mobile devices.
*
* @param enabled `true` to enable, `false` to disable
*/
void setAdrEnabled(bool enabled);
private:
TTNMessageCallback messageCallback;

View File

@ -265,6 +265,16 @@ void TheThingsNetwork::setRSSICal(int8_t rssiCal)
ttn_hal.rssiCal = rssiCal;
}
bool TheThingsNetwork::adrEnabled()
{
return LMIC.adrEnabled != 0;
}
void TheThingsNetwork::setAdrEnabled(bool enabled)
{
LMIC_setAdrMode(enabled);
}
// --- Callbacks ---