fixed error in DEVEUI parsing

This commit is contained in:
Klaus K Wilting 2018-03-23 11:57:19 +01:00
parent 8f49d76569
commit 09e2cba909
2 changed files with 14 additions and 8 deletions

View File

@ -82,18 +82,24 @@ void RevBytes(unsigned char* b, size_t c);
#endif // VERBOSE #endif // VERBOSE
// LMIC callback functions // LMIC callback functions
void os_getDevKey (u1_t *buf) { memcpy(buf, APPKEY, 16);} void os_getDevKey (u1_t *buf) {
memcpy(buf, APPKEY, 16);
}
void os_getArtEui (u1_t *buf) { void os_getArtEui (u1_t *buf) {
memcpy(buf, APPEUI, 8); memcpy(buf, APPEUI, 8);
RevBytes(buf, 8); // TTN requires it in LSB First order, so we swap bytes RevBytes(buf, 8); // TTN requires it in LSB First order, so we swap bytes
} }
void os_getDevEui (u1_t* buf) { void os_getDevEui (u1_t* buf) {
#ifdef DEVEUI int i=0, k=0;
memcpy(buf, DEVEUI, 8); memcpy(buf, DEVEUI, 8); // get fixed DEVEUI from loraconf.h
RevBytes(buf, 8); // TTN requires it in LSB First order, so we swap bytes for (i=0; i<8 ; i++)
#else k += buf[i];
gen_lora_deveui(buf); if (k)
#endif RevBytes(buf, 8); // use fixed DEVEUI and swap bytes to LSB format
else
gen_lora_deveui(buf); // generate DEVEUI from device's MAC
} }
// LMIC enhanced Pin mapping // LMIC enhanced Pin mapping

View File

@ -1,5 +1,5 @@
// program version // program version
#define PROGVERSION "1.2.32" // use max 10 chars here! #define PROGVERSION "1.2.33" // use max 10 chars here!
#define PROGNAME "PAXCNT" #define PROGNAME "PAXCNT"
// Verbose enables serial output // Verbose enables serial output