Skip to content

Commit 1f73b8b

Browse files
committed
Support for IN865_867
1 parent 20d6964 commit 1f73b8b

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

src/TheThingsNetwork.cpp

100755100644
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,38 @@ void TheThingsNetwork::configureKR920_923()
748748
}
749749
sendMacSet(MAC_PWRIDX, TTN_PWRIDX_KR920_923);
750750
}
751+
void TheThingsNetwork::configureIN865_867()
752+
{
753+
sendMacSet(MAC_ADR, "off"); // TODO: remove when ADR is implemented for this plan
754+
sendMacSet(MAC_RX2, "2 866550000"); // SF10
755+
//disable two default LoRaWAN channels
756+
sendChSet(MAC_CHANNEL_STATUS, 0, "off");
757+
sendChSet(MAC_CHANNEL_STATUS, 1, "off");
758+
sendChSet(MAC_CHANNEL_STATUS, 2, "off");
759+
751760

761+
char buf[10];
762+
uint32_t freq = 865062500;
763+
uint8_t ch;
764+
for (ch = 3; ch < 6; ch++)
765+
{
766+
sendChSet(MAC_CHANNEL_DCYCLE, ch, "799");
767+
sprintf(buf, "%lu", freq);
768+
sendChSet(MAC_CHANNEL_FREQ, ch, buf);
769+
sendChSet(MAC_CHANNEL_DRRANGE, ch, "0 6");
770+
sendChSet(MAC_CHANNEL_STATUS, ch, "on");
771+
switch(ch)
772+
{
773+
case 4:
774+
freq = 865402500;
775+
break;
776+
case 5:
777+
freq = 865985000;
778+
break;
779+
}
780+
}
781+
sendMacSet(MAC_PWRIDX, TTN_PWRIDX_IN865_867);
782+
}
752783
void TheThingsNetwork::configureChannels(uint8_t fsb)
753784
{
754785
switch (fp)
@@ -768,6 +799,9 @@ void TheThingsNetwork::configureChannels(uint8_t fsb)
768799
case TTN_FP_KR920_923:
769800
configureKR920_923();
770801
break;
802+
case TTN_FP_IN865_867:
803+
configureIN865_867();
804+
break;
771805
default:
772806
debugPrintMessage(ERR_MESSAGE, ERR_INVALID_FP);
773807
break;
@@ -781,6 +815,7 @@ bool TheThingsNetwork::setSF(uint8_t sf)
781815
switch (fp)
782816
{
783817
case TTN_FP_EU868:
818+
case TTN_FP_IN865_867:
784819
case TTN_FP_AS920_923:
785820
case TTN_FP_AS923_925:
786821
case TTN_FP_KR920_923:

src/TheThingsNetwork.h

100755100644
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#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
#define TTN_PWRIDX_AS923_925 "1" // TODO: should be 0
1919
#define TTN_PWRIDX_KR920_923 "1" // TODO: should be 0
20+
#define TTN_PWRIDX_IN865_867 "1" // TODO: should be 0
2021

2122
#define TTN_BUFFER_SIZE 300
2223

@@ -36,7 +37,8 @@ enum ttn_fp_t
3637
TTN_FP_US915,
3738
TTN_FP_AS920_923,
3839
TTN_FP_AS923_925,
39-
TTN_FP_KR920_923
40+
TTN_FP_KR920_923,
41+
TTN_FP_IN865_867
4042
};
4143

4244
class TheThingsNetwork
@@ -66,6 +68,7 @@ class TheThingsNetwork
6668
void configureAS920_923();
6769
void configureAS923_925();
6870
void configureKR920_923();
71+
void configureIN865_867();
6972
void configureChannels(uint8_t fsb);
7073
bool setSF(uint8_t sf);
7174
bool waitForOk();

0 commit comments

Comments
 (0)