Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #800: tweaks to compliance sketch #801

Merged
merged 3 commits into from
Oct 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions examples/compliance-otaa-halconfig/compliance-otaa-halconfig.ino
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,28 @@ Author:
#include <SPI.h>
class cEventQueue;

#define APPLICATION_VERSION ARDUINO_LMIC_VERSION_CALC(3,0,99,10)
#define APPLICATION_VERSION ARDUINO_LMIC_VERSION_CALC(4, 0, 0, 0)

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

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

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

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

// this data must be kept short -- max is 11 bytes for US DR0
static uint8_t mydata[] = { 0xCA, 0xFE, 0xF0, 0x0D };
Expand Down Expand Up @@ -765,16 +765,22 @@ void setup_printSignOn()
printVersion(ARDUINO_LMIC_VERSION);
Serial.print(F(" configured for region "));
Serial.print(CFG_region);

#if defined(ARDUINO_LMIC_CFG_SUBBAND) && ARDUINO_LMIC_CFG_SUBBAND != -1
Serial.print(F(" subband[0:7] "));
Serial.print(unsigned(ARDUINO_LMIC_CFG_SUBBAND));
#endif // defined(ARDUINO_LMIC_CFG_SUBBAND) && ARDUINO_LMIC_CFG_SUBBAND != -1

Serial.println(F(".\nRemember to select 'Line Ending: Newline' at the bottom of the monitor window."));

setup_printSignOnDashLine();
printNl();
}

void setupForNetwork(bool preJoin) {
#if CFG_LMIC_US_like
LMIC_selectSubBand(0);
#endif
#if defined(ARDUINO_LMIC_CFG_SUBBAND) && ARDUINO_LMIC_CFG_SUBBAND != -1
LMIC_selectSubBand(ARDUINO_LMIC_CFG_SUBBAND);
#endif // defined(ARDUINO_LMIC_CFG_SUBBAND) && ARDUINO_LMIC_CFG_SUBBAND != -1
}

void loop() {
Expand Down