Skip to content

Commit 1c00f25

Browse files
committed
Fix reset of ADR
1 parent 53c9dad commit 1c00f25

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/TheThingsNetwork.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ void TheThingsNetwork::reset(bool adr)
424424
{
425425
sendMacSet(MAC_ADR, "off");
426426
}
427+
this->adr = adr;
427428
}
428429

429430
void TheThingsNetwork::saveState()
@@ -442,7 +443,7 @@ void TheThingsNetwork::onMessage(void (*cb)(const uint8_t *payload, size_t size,
442443

443444
bool TheThingsNetwork::personalize(const char *devAddr, const char *nwkSKey, const char *appSKey)
444445
{
445-
reset();
446+
reset(adr);
446447
if (strlen(devAddr) != 8 || strlen(appSKey) != 32 || strlen(nwkSKey) != 32)
447448
{
448449
debugPrintMessage(ERR_MESSAGE, ERR_KEY_LENGTH);
@@ -473,7 +474,7 @@ bool TheThingsNetwork::personalize()
473474

474475
bool TheThingsNetwork::provision(const char *appEui, const char *appKey)
475476
{
476-
reset();
477+
reset(adr);
477478
if (strlen(appEui) != 16 || strlen(appKey) != 32)
478479
{
479480
debugPrintMessage(ERR_MESSAGE, ERR_KEY_LENGTH);
@@ -661,7 +662,7 @@ void TheThingsNetwork::configureUS915(uint8_t sf, uint8_t fsb)
661662

662663
void TheThingsNetwork::configureAS920_923(uint8_t sf)
663664
{
664-
sendMacSet(MAC_ADR, "off"); // TODO: remove when ADR is implemented for this plan
665+
sendMacSet(MAC_ADR, "off"); // TODO: remove when ADR is implemented for this plan
665666
sendMacSet(MAC_RX2, "2 923200000");
666667

667668
char buf[10];

src/TheThingsNetwork.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#define TTN_PWRIDX_EU868 "1"
1616
#define TTN_PWRIDX_US915 "5"
17-
#define TTN_PWRIDX_AS920_923 "1" // TODO: should be 0, but the current RN2903AS firmware doesn't accept that value (probably still using EU868: 1=14dBm)
17+
#define TTN_PWRIDX_AS920_923 "1" // TODO: should be 0, but the current RN2903AS firmware doesn't accept that value (probably still using EU868: 1=14dBm)
1818

1919
#define TTN_BUFFER_SIZE 300
2020

@@ -43,6 +43,7 @@ class TheThingsNetwork
4343
ttn_fp_t fp;
4444
uint8_t sf;
4545
uint8_t fsb;
46+
bool adr;
4647
char buffer[512];
4748
bool baudDetermined = false;
4849
void (*messageCallback)(const uint8_t *payload, size_t size, port_t port);

0 commit comments

Comments
 (0)