diff --git a/src/TheThingsNetwork.cpp b/src/TheThingsNetwork.cpp old mode 100755 new mode 100644 index eb2beb0f..fe8b203b --- a/src/TheThingsNetwork.cpp +++ b/src/TheThingsNetwork.cpp @@ -773,6 +773,37 @@ void TheThingsNetwork::configureKR920_923() sendMacSet(MAC_PWRIDX, TTN_PWRIDX_KR920_923); } +void TheThingsNetwork::configureIN865_867() +{ + sendMacSet(MAC_ADR, "off"); // TODO: remove when ADR is implemented for this plan + sendMacSet(MAC_RX2, "2 866550000"); // SF10 + + // Disable the three default LoRaWAN channels + sendChSet(MAC_CHANNEL_STATUS, 0, "off"); + sendChSet(MAC_CHANNEL_STATUS, 1, "off"); + sendChSet(MAC_CHANNEL_STATUS, 2, "off"); + + // Channel 3 + sendChSet(MAC_CHANNEL_DCYCLE, 3, "299"); + sendChSet(MAC_CHANNEL_FREQ, 3, "865062500"); + sendChSet(MAC_CHANNEL_DRRANGE, 3, "0 5"); + sendChSet(MAC_CHANNEL_STATUS, 3, "on"); + + // Channel 4 + sendChSet(MAC_CHANNEL_DCYCLE, 4, "299"); + sendChSet(MAC_CHANNEL_FREQ, 4, "865402500"); + sendChSet(MAC_CHANNEL_DRRANGE, 4, "0 5"); + sendChSet(MAC_CHANNEL_STATUS, 4, "on"); + + // Channel 5 + sendChSet(MAC_CHANNEL_DCYCLE, 5, "299"); + sendChSet(MAC_CHANNEL_FREQ, 5, "865985000"); + sendChSet(MAC_CHANNEL_DRRANGE, 5, "0 5"); + sendChSet(MAC_CHANNEL_STATUS, 5, "on"); + + sendMacSet(MAC_PWRIDX, TTN_PWRIDX_IN865_867); +} + void TheThingsNetwork::configureChannels(uint8_t fsb) { switch (fp) @@ -795,6 +826,9 @@ void TheThingsNetwork::configureChannels(uint8_t fsb) case TTN_FP_KR920_923: configureKR920_923(); break; + case TTN_FP_IN865_867: + configureIN865_867(); + break; default: debugPrintMessage(ERR_MESSAGE, ERR_INVALID_FP); break; @@ -808,6 +842,7 @@ bool TheThingsNetwork::setSF(uint8_t sf) switch (fp) { case TTN_FP_EU868: + case TTN_FP_IN865_867: case TTN_FP_AS920_923: case TTN_FP_AS923_925: case TTN_FP_KR920_923: diff --git a/src/TheThingsNetwork.h b/src/TheThingsNetwork.h old mode 100755 new mode 100644 index de8a2631..92f84e13 --- a/src/TheThingsNetwork.h +++ b/src/TheThingsNetwork.h @@ -18,6 +18,7 @@ #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) #define TTN_PWRIDX_AS923_925 "1" // TODO: should be 0 #define TTN_PWRIDX_KR920_923 "1" // TODO: should be 0 +#define TTN_PWRIDX_IN865_867 "1" // TODO: should be 0 #define TTN_BUFFER_SIZE 300 @@ -38,7 +39,8 @@ enum ttn_fp_t TTN_FP_AU915, TTN_FP_AS920_923, TTN_FP_AS923_925, - TTN_FP_KR920_923 + TTN_FP_KR920_923, + TTN_FP_IN865_867 }; class TheThingsNetwork @@ -69,6 +71,7 @@ class TheThingsNetwork void configureAS920_923(); void configureAS923_925(); void configureKR920_923(); + void configureIN865_867(); void configureChannels(uint8_t fsb); bool setSF(uint8_t sf); bool waitForOk();