Merge pull request #130 from cyberman54/master

sync dev to master
This commit is contained in:
Verkehrsrot 2018-08-02 12:50:12 +02:00 committed by GitHub
commit 862c339166
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 15 deletions

View File

@ -53,7 +53,7 @@ build_flags =
-D_lmic_config_h_ -D_lmic_config_h_
-include "src/paxcounter.conf" -include "src/paxcounter.conf"
-include "src/hal/${PIOENV}.h" -include "src/hal/${PIOENV}.h"
; -w -w
[env:test] [env:test]
platform = ${common_env_data.platform_espressif32} platform = ${common_env_data.platform_espressif32}

View File

@ -107,18 +107,6 @@ void get_hard_deveui(uint8_t *pdeveui) {
#ifdef VERBOSE #ifdef VERBOSE
// Display a key
void printKey(const char *name, const uint8_t *key, uint8_t len, bool lsb) {
const uint8_t *p;
char keystring[len + 1] = "", keybyte[3];
for (uint8_t i = 0; i < len; i++) {
p = lsb ? key + len - i - 1 : key + i;
sprintf(keybyte, "%02X", *p);
strncat(keystring, keybyte, 2);
}
ESP_LOGI(TAG, "%s: %s", name, keystring);
}
// Display OTAA keys // Display OTAA keys
void printKeys(void) { void printKeys(void) {
// LMIC may not have used callback to fill // LMIC may not have used callback to fill

View File

@ -14,7 +14,6 @@ void os_getDevKey(u1_t *buf);
void os_getArtEui(u1_t *buf); void os_getArtEui(u1_t *buf);
void os_getDevEui(u1_t *buf); void os_getDevEui(u1_t *buf);
void printKeys(void); void printKeys(void);
void printKey(const char *name, const uint8_t *key, uint8_t len, bool lsb);
void lorawan_loop(void *pvParameters); void lorawan_loop(void *pvParameters);
#endif #endif

View File

@ -24,6 +24,18 @@ int8_t isBeacon(uint64_t mac) {
return -1; return -1;
} }
// Display a key
void printKey(const char *name, const uint8_t *key, uint8_t len, bool lsb) {
const uint8_t *p;
char keystring[len + 1] = "", keybyte[3];
for (uint8_t i = 0; i < len; i++) {
p = lsb ? key + len - i - 1 : key + i;
sprintf(keybyte, "%02X", *p);
strncat(keystring, keybyte, 2);
}
ESP_LOGI(TAG, "%s: %s", name, keystring);
}
uint64_t macConvert(uint8_t *paddr) { uint64_t macConvert(uint8_t *paddr) {
return ((uint64_t)paddr[0]) | ((uint64_t)paddr[1] << 8) | return ((uint64_t)paddr[0]) | ((uint64_t)paddr[1] << 8) |
((uint64_t)paddr[2] << 16) | ((uint64_t)paddr[3] << 24) | ((uint64_t)paddr[2] << 16) | ((uint64_t)paddr[3] << 24) |

View File

@ -15,5 +15,6 @@
uint16_t reset_salt(void); uint16_t reset_salt(void);
uint64_t macConvert(uint8_t *paddr); uint64_t macConvert(uint8_t *paddr);
bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type); bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type);
void printKey(const char *name, const uint8_t *key, uint8_t len, bool lsb);
#endif #endif