JayjJay
(Jay)
1
Hello team,
i’m testing the Arduino BSP, and uploaded the LoRaWan_OTTA sketch and noticed that
if (!api.lorawan.adr.set(1)) {
Serial.printf
("LoRaWan OTAA - set adaptive data rate is incorrect! \r\n");
}
always fails
i’m running: AT+VER=3.4.2-rui3_22q1_update.112
Cheers,
Jay
beegee
(Bernd Giesecke)
2
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);
...
}
system
(system)
Closed
3
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.