Skip to content

Commit 5d7267c

Browse files
authored
Merge pull request #801 from mcci-catena/issue800
Fix #800: tweaks to compliance sketch
2 parents 2c1053f + bb53f2f commit 5d7267c

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

examples/compliance-otaa-halconfig/compliance-otaa-halconfig.ino

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,28 @@ Author:
2222
#include <SPI.h>
2323
class cEventQueue;
2424

25-
#define APPLICATION_VERSION ARDUINO_LMIC_VERSION_CALC(3,0,99,10)
25+
#define APPLICATION_VERSION ARDUINO_LMIC_VERSION_CALC(4, 0, 0, 0)
2626

2727
//
2828
// For compliance tests with the RWC5020A, we use the default addresses
2929
// from the tester; except that we use APPKEY 0,..., 0, 2, to avoid
3030
// collisions with a registered app on TTN.
3131
//
3232

33-
// This EUI must be in little-endian format, so least-significant-byte
34-
// first. This corresponds to 0x0000000000000001
35-
// static const u1_t PROGMEM APPEUI[8]= { 1, 0, 0, 0, 0, 0, 0, 0 };
36-
void os_getArtEui (u1_t* buf) { memset(buf, 0, 8); buf[0] = 1; }
33+
// AppEUI: must be in little-endian format, so least-significant-byte
34+
// first. This corresponds to 0x0000000000000000
35+
static const u1_t PROGMEM APPEUI[8]= { 0, 0, 0, 0, 0, 0, 0, 0 };
36+
void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8); }
3737

38-
// This should also be in little endian format, see above.
38+
// DevEUI: This should also be in little endian format, see above.
3939
// This corresponds to 0x0000000000000001
40-
// static const u1_t PROGMEM DEVEUI[8]= { 1, 0, 0, 0, 0, 0, 0, 0 };
41-
void os_getDevEui (u1_t* buf) { memset(buf, 0, 8); buf[0] = 1; }
40+
static const u1_t PROGMEM DEVEUI[8]= { 1, 0, 0, 0, 0, 0, 0, 0 };
41+
void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI, 8); }
4242

4343
// This key should be in big endian format (or, since it is not really a
4444
// number but a block of memory, endianness does not really apply).
45-
// static const u1_t PROGMEM APPKEY[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 };
46-
void os_getDevKey (u1_t* buf) { memset(buf, 0, 16); buf[15] = 2; }
45+
static const u1_t PROGMEM APPKEY[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 };
46+
void os_getDevKey (u1_t* buf) { memcpy_P(buf, APPKEY, 16); }
4747

4848
// this data must be kept short -- max is 11 bytes for US DR0
4949
static uint8_t mydata[] = { 0xCA, 0xFE, 0xF0, 0x0D };
@@ -765,16 +765,22 @@ void setup_printSignOn()
765765
printVersion(ARDUINO_LMIC_VERSION);
766766
Serial.print(F(" configured for region "));
767767
Serial.print(CFG_region);
768+
769+
#if defined(ARDUINO_LMIC_CFG_SUBBAND) && ARDUINO_LMIC_CFG_SUBBAND != -1
770+
Serial.print(F(" subband[0:7] "));
771+
Serial.print(unsigned(ARDUINO_LMIC_CFG_SUBBAND));
772+
#endif // defined(ARDUINO_LMIC_CFG_SUBBAND) && ARDUINO_LMIC_CFG_SUBBAND != -1
773+
768774
Serial.println(F(".\nRemember to select 'Line Ending: Newline' at the bottom of the monitor window."));
769775

770776
setup_printSignOnDashLine();
771777
printNl();
772778
}
773779

774780
void setupForNetwork(bool preJoin) {
775-
#if CFG_LMIC_US_like
776-
LMIC_selectSubBand(0);
777-
#endif
781+
#if defined(ARDUINO_LMIC_CFG_SUBBAND) && ARDUINO_LMIC_CFG_SUBBAND != -1
782+
LMIC_selectSubBand(ARDUINO_LMIC_CFG_SUBBAND);
783+
#endif // defined(ARDUINO_LMIC_CFG_SUBBAND) && ARDUINO_LMIC_CFG_SUBBAND != -1
778784
}
779785

780786
void loop() {

0 commit comments

Comments
 (0)