Added TX packet display to waterfall

This commit is contained in:
Mark Qvist 2024-10-05 16:44:44 +02:00
parent 9ce280f207
commit e8dd7dbc93
2 changed files with 21 additions and 3 deletions

View File

@ -98,6 +98,7 @@ uint32_t last_unblank_event = 0;
uint32_t display_blanking_timeout = DISPLAY_BLANKING_TIMEOUT; uint32_t display_blanking_timeout = DISPLAY_BLANKING_TIMEOUT;
uint8_t display_unblank_intensity = display_intensity; uint8_t display_unblank_intensity = display_intensity;
bool display_blanked = false; bool display_blanked = false;
bool display_tx = false;
uint8_t disp_target_fps = 7; uint8_t disp_target_fps = 7;
int disp_update_interval = 1000/disp_target_fps; int disp_update_interval = 1000/disp_target_fps;
uint32_t last_page_flip = 0; uint32_t last_page_flip = 0;
@ -446,6 +447,8 @@ void draw_signal_bars(int px, int py) {
} }
} }
#define WF_TX_SIZE 5
#define WF_TX_WIDTH 5
#define WF_RSSI_MAX -60 #define WF_RSSI_MAX -60
#define WF_RSSI_MIN -135 #define WF_RSSI_MIN -135
#define WF_RSSI_SPAN (WF_RSSI_MAX-WF_RSSI_MIN) #define WF_RSSI_SPAN (WF_RSSI_MAX-WF_RSSI_MIN)
@ -455,9 +458,16 @@ void draw_waterfall(int px, int py) {
if (rssi_val < WF_RSSI_MIN) rssi_val = WF_RSSI_MIN; if (rssi_val < WF_RSSI_MIN) rssi_val = WF_RSSI_MIN;
if (rssi_val > WF_RSSI_MAX) rssi_val = WF_RSSI_MAX; if (rssi_val > WF_RSSI_MAX) rssi_val = WF_RSSI_MAX;
int rssi_normalised = ((rssi_val - WF_RSSI_MIN)*(1.0/WF_RSSI_SPAN))*WF_PIXEL_WIDTH; int rssi_normalised = ((rssi_val - WF_RSSI_MIN)*(1.0/WF_RSSI_SPAN))*WF_PIXEL_WIDTH;
if (display_tx) {
waterfall[waterfall_head++] = rssi_normalised; for (uint8_t i; i < WF_TX_SIZE; i++) {
if (waterfall_head >= WATERFALL_SIZE) waterfall_head = 0; waterfall[waterfall_head++] = -1;
if (waterfall_head >= WATERFALL_SIZE) waterfall_head = 0;
}
display_tx = false;
} else {
waterfall[waterfall_head++] = rssi_normalised;
if (waterfall_head >= WATERFALL_SIZE) waterfall_head = 0;
}
stat_area.fillRect(px,py,WF_PIXEL_WIDTH, WATERFALL_SIZE, SSD1306_BLACK); stat_area.fillRect(px,py,WF_PIXEL_WIDTH, WATERFALL_SIZE, SSD1306_BLACK);
for (int i = 0; i < WATERFALL_SIZE; i++){ for (int i = 0; i < WATERFALL_SIZE; i++){
@ -465,6 +475,11 @@ void draw_waterfall(int px, int py) {
int ws = waterfall[wi]; int ws = waterfall[wi];
if (ws > 0) { if (ws > 0) {
stat_area.drawLine(px, py+i, px+ws-1, py+i, SSD1306_WHITE); stat_area.drawLine(px, py+i, px+ws-1, py+i, SSD1306_WHITE);
} else if (ws == -1) {
uint8_t o = i%2;
for (uint8_t ti = 0; ti < WF_PIXEL_WIDTH/2; ti++) {
stat_area.drawPixel(px+ti*2+o, py+i, SSD1306_WHITE);
}
} }
} }
} }

View File

@ -500,6 +500,9 @@ void flushQueue(void) {
update_airtime(); update_airtime();
#endif #endif
queue_flushing = false; queue_flushing = false;
#if HAS_DISPLAY
display_tx = true;
#endif
} }
#define PHY_HEADER_LORA_SYMBOLS 8 #define PHY_HEADER_LORA_SYMBOLS 8