Skip to content

Commit d08c506

Browse files
Merge pull request #193 from tftelkamp/feature/as920_923
Changes to make library work with RN2903AS 1.0.3rc9
2 parents 014fffa + d5523f2 commit d08c506

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

src/TheThingsNetwork.cpp

100644100755
Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,15 @@ bool TheThingsNetwork::provision(const char *appEui, const char *appKey)
483483
sendMacSet(MAC_DEVEUI, buffer);
484484
sendMacSet(MAC_APPEUI, appEui);
485485
sendMacSet(MAC_APPKEY, appKey);
486-
saveState();
486+
switch (fp)
487+
{
488+
case TTN_FP_AS920_923:
489+
// TODO: temporarily removed 'mac save' because RN2903AS crashes on this command!
490+
break;
491+
default:
492+
saveState();
493+
break;
494+
}
487495
return true;
488496
}
489497

@@ -603,7 +611,7 @@ void TheThingsNetwork::configureEU868(uint8_t sf)
603611
sendChSet(MAC_CHANNEL_DCYCLE, ch, "799");
604612
if (ch > 2)
605613
{
606-
sprintf(buf, "%d", freq);
614+
sprintf(buf, "%lu", freq);
607615
sendChSet(MAC_CHANNEL_FREQ, ch, buf);
608616
sendChSet(MAC_CHANNEL_DRRANGE, ch, "0 5");
609617
sendChSet(MAC_CHANNEL_STATUS, ch, "on");
@@ -653,9 +661,8 @@ void TheThingsNetwork::configureUS915(uint8_t sf, uint8_t fsb)
653661

654662
void TheThingsNetwork::configureAS920_923(uint8_t sf)
655663
{
656-
// TODO: Check if this is necessary and a valid command. RX2 is SF10 at 923.2
664+
sendMacSet(MAC_ADR, "off"); // TODO: remove when ADR is implemented for this plan
657665
sendMacSet(MAC_RX2, "2 923200000");
658-
sendChSet(MAC_CHANNEL_DRRANGE, 1, "0 6");
659666

660667
char buf[10];
661668
uint32_t freq = 922000000;
@@ -665,13 +672,19 @@ void TheThingsNetwork::configureAS920_923(uint8_t sf)
665672
sendChSet(MAC_CHANNEL_DCYCLE, ch, "799");
666673
if (ch > 1)
667674
{
668-
sprintf(buf, "%d", freq);
675+
sprintf(buf, "%lu", freq);
669676
sendChSet(MAC_CHANNEL_FREQ, ch, buf);
670677
sendChSet(MAC_CHANNEL_DRRANGE, ch, "0 5");
671678
sendChSet(MAC_CHANNEL_STATUS, ch, "on");
672679
freq = freq + 200000;
673680
}
674681
}
682+
// TODO: SF7BW250/DR6 channel, not properly supported by RN2903AS yet
683+
//sendChSet(MAC_CHANNEL_DCYCLE, 8, "799");
684+
//sendChSet(MAC_CHANNEL_FREQ, 8, "922100000");
685+
//sendChSet(MAC_CHANNEL_DRRANGE, 8, "6 6");
686+
//sendChSet(MAC_CHANNEL_STATUS, 8, "on");
687+
// TODO: Add FSK channel
675688
sendMacSet(MAC_PWRIDX, TTN_PWRIDX_AS920_923);
676689
if (sf >= 7 && sf <= 12)
677690
{

src/TheThingsNetwork.h

100644100755
Lines changed: 1 addition & 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 "0"
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

0 commit comments

Comments
 (0)