centralize display writes (part 4)

This commit is contained in:
Klaus K Wilting 2018-04-16 00:05:11 +02:00
parent 4bc888d78d
commit 52142c9d05
2 changed files with 12 additions and 10 deletions

View File

@ -287,8 +287,8 @@ void loadConfig() {
nvs_close(my_handle); nvs_close(my_handle);
ESP_LOGI(TAG, "Done"); ESP_LOGI(TAG, "Done");
// put actions to be triggered on loaded config here // put actions to be triggered after config loaded here
u8x8.setPowerSave(!cfg.screenon); // set display on/off
#ifdef HAS_ANTENNA_SWITCH // set antenna type, if device has one #ifdef HAS_ANTENNA_SWITCH // set antenna type, if device has one
antenna_select(cfg.wifiant); antenna_select(cfg.wifiant);
#endif #endif

View File

@ -292,7 +292,7 @@ void sniffer_loop(void * pvParameters) {
salt_reset(); // get new salt for salting hashes salt_reset(); // get new salt for salting hashes
} }
// wait until payload is sent, while wifi scanning and mac counting task continues // check if payload is sent
lorawait = 0; lorawait = 0;
while(LMIC.opmode & OP_TXRXPEND) { while(LMIC.opmode & OP_TXRXPEND) {
if(!lorawait) if(!lorawait)
@ -306,8 +306,7 @@ void sniffer_loop(void * pvParameters) {
vTaskDelay(1000/portTICK_PERIOD_MS); vTaskDelay(1000/portTICK_PERIOD_MS);
yield(); yield();
} }
sprintf(display_lora, " "); // clear LoRa wait message fromd display
u8x8.clearLine(6);
// TBD: need to check if long 2000ms pause causes stack problems while scanning continues // TBD: need to check if long 2000ms pause causes stack problems while scanning continues
if (cfg.screenon && cfg.screensaver) { if (cfg.screenon && cfg.screensaver) {
@ -524,7 +523,10 @@ void loop() {
#ifdef HAS_DISPLAY #ifdef HAS_DISPLAY
// display counters (lines 0-4) // set display on/off according to current device configuration
u8x8.setPowerSave(!cfg.screenon);
// write counters (lines 0-4)
char buff[16]; char buff[16];
snprintf(buff, sizeof(buff), "PAX:%-4d", (int) macs.size()); // convert 16-bit MAC counter to decimal counter value snprintf(buff, sizeof(buff), "PAX:%-4d", (int) macs.size()); // convert 16-bit MAC counter to decimal counter value
u8x8.draw2x2String(0, 0, buff); // display number on unique macs total Wifi + BLE u8x8.draw2x2String(0, 0, buff); // display number on unique macs total Wifi + BLE
@ -535,19 +537,19 @@ void loop() {
u8x8.printf("BLTH: %-4d", (int) bles.size()); u8x8.printf("BLTH: %-4d", (int) bles.size());
#endif #endif
// display actual wifi channel (line 4) // write actual wifi channel (line 4)
u8x8.setCursor(11,4); u8x8.setCursor(11,4);
u8x8.printf("ch:%02i", channel); u8x8.printf("ch:%02i", channel);
// display RSSI status (line 5) // write RSSI status (line 5)
u8x8.setCursor(0,5); u8x8.setCursor(0,5);
u8x8.printf(!cfg.rssilimit ? "RLIM: off" : "RLIM: %-3d", cfg.rssilimit); u8x8.printf(!cfg.rssilimit ? "RLIM: off" : "RLIM: %-3d", cfg.rssilimit);
// display LoRa status (line 6) // write LoRa status (line 6)
u8x8.setCursor(0,6); u8x8.setCursor(0,6);
u8x8.printf("%-16s", display_lora); u8x8.printf("%-16s", display_lora);
// display LMiC event (line 7) // write LMiC event (line 7)
u8x8.setCursor(0,7); u8x8.setCursor(0,7);
u8x8.printf("%-16s", display_lmic); u8x8.printf("%-16s", display_lmic);