Hi @JayjJay
It is not documented, but you can change ADR only after a successful join.
I put the call to change ADR into my join_callback and it works.
Example code
/**
* @brief Callback after join request cycle
*
* @param status Join result
*/
void joinCallback(int32_t status)
{
// MYLOG("JOIN-CB", "Join result %d", status);
if (status != 0)
{
if (!(ret = api.lorawan.join()))
{
MYLOG("JOIN-CB", "Join fail! \r\n");
// if (found_sensors[OLED_ID].found_sensor)
// {
// rak1921_add_line("Join NW failed");
// }
}
}
else
{
MYLOG("JOIN-CB", "DR %s", api.lorawan.dr.set(g_lorawan_settings.data_rate) ? "Success" : "Fail");
MYLOG("JOIN-CB", "ADR %s", api.lorawan.adr.set(g_lorawan_settings.adr_enabled ? 1 : 0) ? "Success" : "Fail");
MYLOG("JOIN-CB", "Joined! \r\n");
digitalWrite(LED_BLUE, LOW);
// if (found_sensors[OLED_ID].found_sensor)
// {
// rak1921_add_line("Joined NW");
// }
digitalWrite(LED_BLUE, LOW);
}
}
...
void setup()
{
...
api.lorawan.registerJoinCallback(joinCallback);
...
}