new display RF load & remove ch display

This commit is contained in:
Klaus K Wilting 2020-11-09 13:25:12 +01:00
parent 2e368a6d8d
commit 86a6341101
5 changed files with 16 additions and 14 deletions

View File

@ -63,17 +63,14 @@
enum sendprio_t { prio_low, prio_normal, prio_high }; enum sendprio_t { prio_low, prio_normal, prio_high };
enum timesource_t { _gps, _rtc, _lora, _unsynced }; enum timesource_t { _gps, _rtc, _lora, _unsynced };
enum snifftype_t { MAC_SNIFF_WIFI, MAC_SNIFF_BLE, MAC_SNIFF_BLE_ENS };
enum runmode_t { enum runmode_t {
RUNMODE_POWERCYCLE = 0, RUNMODE_POWERCYCLE,
RUNMODE_NORMAL, RUNMODE_NORMAL,
RUNMODE_WAKEUP, RUNMODE_WAKEUP,
RUNMODE_UPDATE RUNMODE_UPDATE
}; };
// sniffing types
enum snifftype_t { MAC_SNIFF_WIFI, MAC_SNIFF_BLE, MAC_SNIFF_BLE_ENS };
// Struct holding devices's runtime configuration // Struct holding devices's runtime configuration
// using packed to avoid compiler padding, because struct will be memcpy'd to // using packed to avoid compiler padding, because struct will be memcpy'd to
// byte array // byte array
@ -150,10 +147,10 @@ extern std::array<uint64_t, 0xff> beacons;
extern configData_t cfg; // current device configuration extern configData_t cfg; // current device configuration
extern char lmic_event_msg[LMIC_EVENTMSG_LEN]; // display buffer extern char lmic_event_msg[LMIC_EVENTMSG_LEN]; // display buffer
extern uint8_t volatile channel; // wifi channel rotation counter extern uint8_t volatile rf_load; // RF traffic indicator
extern uint8_t batt_level; // display value extern uint8_t batt_level; // display value
extern uint16_t volatile macs_wifi, macs_ble; // display values extern uint16_t volatile macs_wifi, macs_ble; // display values
extern bool volatile TimePulseTick; // 1sec pps flag set by GPS or RTC extern bool volatile TimePulseTick; // 1sec pps flag set by GPS or RTC
extern timesource_t timeSource; extern timesource_t timeSource;
extern hw_timer_t *displayIRQ, *matrixDisplayIRQ, *ppsIRQ; extern hw_timer_t *displayIRQ, *matrixDisplayIRQ, *ppsIRQ;
extern SemaphoreHandle_t I2Caccess; extern SemaphoreHandle_t I2Caccess;

View File

@ -292,7 +292,7 @@ void dp_drawPage(time_t t, bool nextpage) {
#endif #endif
dp_println(); dp_println();
// line 4: Battery + GPS status + Wifi channel // line 4: Battery + GPS status + RF traffic
// B:a.bcV Sats:ab ch:ab // B:a.bcV Sats:ab ch:ab
#if (defined BAT_MEASURE_ADC || defined HAS_PMU || defined HAS_IP5306) #if (defined BAT_MEASURE_ADC || defined HAS_PMU || defined HAS_IP5306)
if (batt_level == 0) if (batt_level == 0)
@ -310,7 +310,7 @@ void dp_drawPage(time_t t, bool nextpage) {
#else #else
dp_printf(" "); dp_printf(" ");
#endif #endif
dp_printf(" ch:%02d", channel); dp_printf(" due:%02d", rf_load);
dp_println(); dp_println();
// line 5: RSSI limiter + free memory // line 5: RSSI limiter + free memory

View File

@ -79,8 +79,12 @@ void mac_process(void *pvParameters) {
if (xQueueReceive(MacQueue, &MacBuffer, portMAX_DELAY) != pdTRUE) { if (xQueueReceive(MacQueue, &MacBuffer, portMAX_DELAY) != pdTRUE) {
ESP_LOGE(TAG, "Premature return from xQueueReceive() with no data!"); ESP_LOGE(TAG, "Premature return from xQueueReceive() with no data!");
continue; continue;
} else }
mac_analyze(MacBuffer);
// update traffic indicator
rf_load = uxQueueMessagesWaiting(MacQueue);
// process fetched mac
mac_analyze(MacBuffer);
} }
delay(2); // yield to CPU delay(2); // yield to CPU
} }

View File

@ -87,8 +87,8 @@ triggers pps 1 sec impulse
configData_t cfg; // struct holds current device configuration configData_t cfg; // struct holds current device configuration
char lmic_event_msg[LMIC_EVENTMSG_LEN]; // display buffer for LMIC event message char lmic_event_msg[LMIC_EVENTMSG_LEN]; // display buffer for LMIC event message
uint8_t volatile channel = 0; // channel rotation counter
uint8_t batt_level = 0; // display value uint8_t batt_level = 0; // display value
uint8_t volatile rf_load = 0; // RF traffic indicator
uint16_t volatile macs_wifi = 0, macs_ble = 0; // globals for display uint16_t volatile macs_wifi = 0, macs_ble = 0; // globals for display
hw_timer_t *ppsIRQ = NULL, *displayIRQ = NULL, *matrixDisplayIRQ = NULL; hw_timer_t *ppsIRQ = NULL, *displayIRQ = NULL, *matrixDisplayIRQ = NULL;

View File

@ -41,6 +41,7 @@ IRAM_ATTR void wifi_sniffer_packet_handler(void *buff,
// Software-timer driven Wifi channel rotation callback function // Software-timer driven Wifi channel rotation callback function
void switchWifiChannel(TimerHandle_t xTimer) { void switchWifiChannel(TimerHandle_t xTimer) {
static uint8_t channel = 0; // channel rotation counter
_ASSERT(xTimer != NULL); _ASSERT(xTimer != NULL);
channel = channel =
(channel % WIFI_CHANNEL_MAX) + 1; // rotate channel 1..WIFI_CHANNEL_MAX (channel % WIFI_CHANNEL_MAX) + 1; // rotate channel 1..WIFI_CHANNEL_MAX