mirror of
https://github.com/markqvist/RNode_Firmware.git
synced 2024-12-27 16:39:42 -05:00
Clear signal bars on BLE device disconnect
This commit is contained in:
parent
0f0a711cd7
commit
e5028c88d6
11
Display.h
11
Display.h
@ -309,6 +309,8 @@ void draw_battery_bars(int px, int py) {
|
||||
#define Q_SNR_MIN_BASE -9.0
|
||||
#define Q_SNR_MAX 6.0
|
||||
void draw_quality_bars(int px, int py) {
|
||||
stat_area.fillRect(px, py, 13, 7, SSD1306_BLACK);
|
||||
if (radio_online) {
|
||||
signed char t_snr = (signed int)last_snr_raw;
|
||||
int snr_int = (int)t_snr;
|
||||
float snr_min = Q_SNR_MIN_BASE-(int)lora_sf*Q_SNR_STEP;
|
||||
@ -318,7 +320,6 @@ void draw_quality_bars(int px, int py) {
|
||||
if (quality > 100.0) quality = 100.0;
|
||||
if (quality < 0.0) quality = 0.0;
|
||||
|
||||
stat_area.fillRect(px, py, 13, 7, SSD1306_BLACK);
|
||||
// Serial.printf("Last SNR: %.2f\n, quality: %.2f\n", snr, quality);
|
||||
if (quality > 0) stat_area.drawLine(px+0*2, py+7, px+0*2, py+6, SSD1306_WHITE);
|
||||
if (quality > 15) stat_area.drawLine(px+1*2, py+7, px+1*2, py+5, SSD1306_WHITE);
|
||||
@ -328,11 +329,15 @@ void draw_quality_bars(int px, int py) {
|
||||
if (quality > 75) stat_area.drawLine(px+5*2, py+7, px+5*2, py+1, SSD1306_WHITE);
|
||||
if (quality > 90) stat_area.drawLine(px+6*2, py+7, px+6*2, py+0, SSD1306_WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
#define S_RSSI_MIN -135.0
|
||||
#define S_RSSI_MAX -75.0
|
||||
#define S_RSSI_SPAN (S_RSSI_MAX-S_RSSI_MIN)
|
||||
void draw_signal_bars(int px, int py) {
|
||||
stat_area.fillRect(px, py, 13, 7, SSD1306_BLACK);
|
||||
|
||||
if (radio_online) {
|
||||
int rssi_val = last_rssi;
|
||||
if (rssi_val < S_RSSI_MIN) rssi_val = S_RSSI_MIN;
|
||||
if (rssi_val > S_RSSI_MAX) rssi_val = S_RSSI_MAX;
|
||||
@ -341,7 +346,6 @@ void draw_signal_bars(int px, int py) {
|
||||
if (signal > 100.0) signal = 100.0;
|
||||
if (signal < 0.0) signal = 0.0;
|
||||
|
||||
stat_area.fillRect(px, py, 13, 7, SSD1306_BLACK);
|
||||
// Serial.printf("Last SNR: %.2f\n, quality: %.2f\n", snr, quality);
|
||||
if (signal > 85) stat_area.drawLine(px+0*2, py+7, px+0*2, py+0, SSD1306_WHITE);
|
||||
if (signal > 72) stat_area.drawLine(px+1*2, py+7, px+1*2, py+1, SSD1306_WHITE);
|
||||
@ -351,6 +355,7 @@ void draw_signal_bars(int px, int py) {
|
||||
if (signal > 20) stat_area.drawLine(px+5*2, py+7, px+5*2, py+5, SSD1306_WHITE);
|
||||
if (signal > 7) stat_area.drawLine(px+6*2, py+7, px+6*2, py+6, SSD1306_WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
#define WF_RSSI_MAX -60
|
||||
#define WF_RSSI_MIN -135
|
||||
@ -388,9 +393,9 @@ void draw_stat_area() {
|
||||
draw_lora_icon(45, 8);
|
||||
draw_mw_icon(45, 30);
|
||||
draw_battery_bars(4, 58);
|
||||
if (radio_online) {
|
||||
draw_quality_bars(28, 56);
|
||||
draw_signal_bars(44, 56);
|
||||
if (radio_online) {
|
||||
draw_waterfall(27, 4);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user