testing
This commit is contained in:
parent
4246359c30
commit
d2330fb5b1
27
src/main.cpp
27
src/main.cpp
@ -259,21 +259,16 @@ void wifi_sniffer_loop(void * pvParameters) {
|
|||||||
channel = (channel % WIFI_CHANNEL_MAX) + 1; // rotates variable channel 1..WIFI_CHANNEL_MAX
|
channel = (channel % WIFI_CHANNEL_MAX) + 1; // rotates variable channel 1..WIFI_CHANNEL_MAX
|
||||||
wifi_sniffer_set_channel(channel);
|
wifi_sniffer_set_channel(channel);
|
||||||
ESP_LOGI(TAG, "Wifi set channel %d", channel);
|
ESP_LOGI(TAG, "Wifi set channel %d", channel);
|
||||||
|
|
||||||
#ifdef HAS_DISPLAY
|
|
||||||
u8x8.setCursor(0,5);
|
u8x8.setCursor(0,5);
|
||||||
u8x8.printf(!cfg.rssilimit ? "RLIM: off" : "RLIM: %4i", cfg.rssilimit);
|
u8x8.printf(!cfg.rssilimit ? "RLIM: off" : "RLIM: %4i", cfg.rssilimit);
|
||||||
u8x8.setCursor(11,5);
|
u8x8.setCursor(11,5);
|
||||||
u8x8.printf("ch:%02i", channel);
|
u8x8.printf("ch:%02i", channel);
|
||||||
u8x8.setCursor(0,4);
|
u8x8.setCursor(0,4);
|
||||||
u8x8.printf("MAC#: %-5i", wifis.size());
|
u8x8.printf("MAC#: %-5i", wifis.size());
|
||||||
#endif
|
|
||||||
|
|
||||||
// duration of one wifi scan loop reached? then send data and begin new scan cycle
|
// duration of one wifi scan loop reached? then send data and begin new scan cycle
|
||||||
if( nloop >= ( (100 / cfg.wifichancycle) * (cfg.wifiscancycle * 2)) +1 ) {
|
if( nloop >= ( (100 / cfg.wifichancycle) * (cfg.wifiscancycle * 2)) +1 ) {
|
||||||
#ifdef HAS_DISPLAY
|
|
||||||
u8x8.setPowerSave(!cfg.screenon); // set display on if enabled
|
u8x8.setPowerSave(!cfg.screenon); // set display on if enabled
|
||||||
#endif
|
|
||||||
nloop=0; channel=0; // reset wifi scan + channel loop counter
|
nloop=0; channel=0; // reset wifi scan + channel loop counter
|
||||||
do_send(&sendjob); // Prepare and execute LoRaWAN data upload
|
do_send(&sendjob); // Prepare and execute LoRaWAN data upload
|
||||||
vTaskDelay(500/portTICK_PERIOD_MS);
|
vTaskDelay(500/portTICK_PERIOD_MS);
|
||||||
@ -287,19 +282,15 @@ void wifi_sniffer_loop(void * pvParameters) {
|
|||||||
bles.clear(); // clear BLE macs counter
|
bles.clear(); // clear BLE macs counter
|
||||||
#endif
|
#endif
|
||||||
salt = random(65536); // get new 16bit random for salting hashes
|
salt = random(65536); // get new 16bit random for salting hashes
|
||||||
#ifdef HAS_DISPLAY
|
|
||||||
u8x8.clearLine(0); u8x8.clearLine(1); // clear Display counter
|
u8x8.clearLine(0); u8x8.clearLine(1); // clear Display counter
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait until payload is sent, while wifi scanning and mac counting task continues
|
// wait until payload is sent, while wifi scanning and mac counting task continues
|
||||||
lorawait = 0;
|
lorawait = 0;
|
||||||
while(LMIC.opmode & OP_TXRXPEND) {
|
while(LMIC.opmode & OP_TXRXPEND) {
|
||||||
#ifdef HAS_DISPLAY
|
if(!lorawait)
|
||||||
if(!lorawait) {
|
|
||||||
u8x8.drawString(0,6,"LoRa wait ");
|
u8x8.drawString(0,6,"LoRa wait ");
|
||||||
}
|
|
||||||
#endif
|
|
||||||
lorawait++;
|
lorawait++;
|
||||||
// in case sending really fails: reset and rejoin network
|
// in case sending really fails: reset and rejoin network
|
||||||
if( (lorawait % MAXLORARETRY ) == 0) {
|
if( (lorawait % MAXLORARETRY ) == 0) {
|
||||||
@ -310,17 +301,12 @@ void wifi_sniffer_loop(void * pvParameters) {
|
|||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAS_DISPLAY
|
|
||||||
u8x8.clearLine(6);
|
u8x8.clearLine(6);
|
||||||
|
|
||||||
if (cfg.screenon && cfg.screensaver) {
|
if (cfg.screenon && cfg.screensaver)
|
||||||
vTaskDelay(2000/portTICK_PERIOD_MS); // pause for displaying results
|
vTaskDelay(2000/portTICK_PERIOD_MS); // pause for displaying results
|
||||||
}
|
|
||||||
yield();
|
yield();
|
||||||
u8x8.setPowerSave(1 && cfg.screensaver); // set display off if screensaver is enabled
|
u8x8.setPowerSave(1 && cfg.screensaver); // set display off if screensaver is enabled
|
||||||
#else
|
|
||||||
yield();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // end of send data cycle
|
} // end of send data cycle
|
||||||
else {
|
else {
|
||||||
@ -346,8 +332,6 @@ uint64_t uptime() {
|
|||||||
|
|
||||||
// Print a key on display
|
// Print a key on display
|
||||||
void DisplayKey(const uint8_t * key, uint8_t len, bool lsb) {
|
void DisplayKey(const uint8_t * key, uint8_t len, bool lsb) {
|
||||||
#ifdef HAS_DISPLAY
|
|
||||||
|
|
||||||
uint8_t start=lsb?len:0;
|
uint8_t start=lsb?len:0;
|
||||||
uint8_t end = lsb?0:len;
|
uint8_t end = lsb?0:len;
|
||||||
const uint8_t * p ;
|
const uint8_t * p ;
|
||||||
@ -356,10 +340,11 @@ void DisplayKey(const uint8_t * key, uint8_t len, bool lsb) {
|
|||||||
u8x8.printf("%02X", *p);
|
u8x8.printf("%02X", *p);
|
||||||
}
|
}
|
||||||
u8x8.printf("\n");
|
u8x8.printf("\n");
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_display(const char *Productname, const char *Version) {
|
void init_display(const char *Productname, const char *Version) {
|
||||||
|
u8x8.begin();
|
||||||
|
u8x8.setFont(u8x8_font_chroma48medium8_r);
|
||||||
#ifdef HAS_DISPLAY
|
#ifdef HAS_DISPLAY
|
||||||
u8x8.begin();
|
u8x8.begin();
|
||||||
u8x8.setFont(u8x8_font_chroma48medium8_r);
|
u8x8.setFont(u8x8_font_chroma48medium8_r);
|
||||||
@ -497,13 +482,11 @@ void setup() {
|
|||||||
#endif // MCP 24AA02E64
|
#endif // MCP 24AA02E64
|
||||||
|
|
||||||
// initialize display
|
// initialize display
|
||||||
#ifdef HAS_DISPLAY
|
|
||||||
init_display(PROGNAME, PROGVERSION);
|
init_display(PROGNAME, PROGVERSION);
|
||||||
u8x8.setPowerSave(!cfg.screenon); // set display off if disabled
|
u8x8.setPowerSave(!cfg.screenon); // set display off if disabled
|
||||||
u8x8.setCursor(0,5);
|
u8x8.setCursor(0,5);
|
||||||
u8x8.printf(!cfg.rssilimit ? "RLIM: off" : "RLIM: %4i", cfg.rssilimit);
|
u8x8.printf(!cfg.rssilimit ? "RLIM: off" : "RLIM: %4i", cfg.rssilimit);
|
||||||
u8x8.drawString(0,6,"Join Wait ");
|
u8x8.drawString(0,6,"Join Wait ");
|
||||||
#endif
|
|
||||||
|
|
||||||
// output LoRaWAN keys to console
|
// output LoRaWAN keys to console
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
|
Loading…
Reference in New Issue
Block a user