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
// 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) {
memcpy(buf, APPEUI, 8);
RevBytes(buf, 8); // TTN requires it in LSB First order, so we swap bytes
}
void os_getDevEui (u1_t* buf) {
#ifdef DEVEUI
memcpy(buf, DEVEUI, 8);
RevBytes(buf, 8); // TTN requires it in LSB First order, so we swap bytes
#else
gen_lora_deveui(buf);
#endif
int i=0, k=0;
memcpy(buf, DEVEUI, 8); // get fixed DEVEUI from loraconf.h
for (i=0; i<8 ; i++)
k += buf[i];
if (k)
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

View File

@ -1,5 +1,5 @@
// 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"
// Verbose enables serial output