diff --git a/src/main.cpp b/src/main.cpp index adc4109e..2d64f6eb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,7 +46,7 @@ int macnum = 0, blenum = 0; uint64_t uptimecounter = 0; bool joinstate = false; -std::set macs; // storage holds MAC frames +std::set macs; // associative container holds filtered MAC adresses // this variable will be changed in the ISR, and read in main loop static volatile bool ButtonTriggered = false; @@ -70,13 +70,27 @@ void loadConfig(void); /* begin LMIC specific parts ------------------------------------------------------------ */ +// LMIC enhanced Pin mapping +const lmic_pinmap lmic_pins = { + .mosi = PIN_SPI_MOSI, + .miso = PIN_SPI_MISO, + .sck = PIN_SPI_SCK, + .nss = PIN_SPI_SS, + .rxtx = LMIC_UNUSED_PIN, + .rst = RST, + .dio = {DIO0, DIO1, DIO2} +}; + // defined in lorawan.cpp void gen_lora_deveui(uint8_t * pdeveui); void RevBytes(unsigned char* b, size_t c); - #ifdef VERBOSE void printKeys(void); -#endif // VERBOSE +#endif + +// LMIC functions +void onEvent(ev_t ev); +void do_send(osjob_t* j); // LMIC callback functions void os_getDevKey (u1_t *buf) { @@ -99,21 +113,6 @@ void os_getDevEui (u1_t* buf) { gen_lora_deveui(buf); // generate DEVEUI from device's MAC } -// LMIC enhanced Pin mapping -extern const lmic_pinmap lmic_pins = { - .mosi = PIN_SPI_MOSI, - .miso = PIN_SPI_MISO, - .sck = PIN_SPI_SCK, - .nss = PIN_SPI_SS, - .rxtx = LMIC_UNUSED_PIN, - .rst = RST, - .dio = {DIO0, DIO1, DIO2} -}; - -// LMIC functions -void onEvent(ev_t ev); -void do_send(osjob_t* j); - // LoRaWAN Initjob static void lora_init (osjob_t* j) { // reset MAC state diff --git a/src/main.h b/src/main.h index d7b41626..2e67f211 100644 --- a/src/main.h +++ b/src/main.h @@ -1,5 +1,5 @@ // program version -#define PROGVERSION "1.2.52" // use max 10 chars here! +#define PROGVERSION "1.2.53" // use max 10 chars here! #define PROGNAME "PAXCNT" // Verbose enables serial output @@ -16,8 +16,10 @@ #define SEND_SECS 120 // [seconds/2] -> 240 sec. // WiFi sniffer config -#define WIFI_CHANNEL_MAX 13 -#define WIFI_CHANNEL_SWITCH_INTERVAL 50 // [seconds/100] -> 0,5 sec. +#define WIFI_CHANNEL_MIN 1 // start channel number where scan begings +#define WIFI_CHANNEL_MAX 13 // total channel number to scan +#define WIFI_MY_COUNTRY "EU" // for Wifi RF settings +#define WIFI_CHANNEL_SWITCH_INTERVAL 50 // [seconds/100] -> 0,5 sec. // Default LoRa Spreadfactor #define LORASFDEFAULT 9 // 7 ... 12 diff --git a/src/wifisniffer.cpp b/src/wifisniffer.cpp index e6ac174f..a68aba6f 100644 --- a/src/wifisniffer.cpp +++ b/src/wifisniffer.cpp @@ -14,7 +14,7 @@ // Local logging tag static const char *TAG = "wifisniffer"; -static wifi_country_t wifi_country = {.cc="EU", .schan=1, .nchan=13, .policy=WIFI_COUNTRY_POLICY_AUTO}; +static wifi_country_t wifi_country = {.cc=WIFI_MY_COUNTRY, .schan=WIFI_CHANNEL_MIN, .nchan=WIFI_CHANNEL_MAX, .policy=WIFI_COUNTRY_POLICY_MANUAL}; typedef struct { unsigned frame_ctrl:16;