Add RSSI toggle button to looking glass (#3204)

This commit is contained in:
Synray
2026-05-31 02:24:24 -07:00
committed by GitHub
parent 2bb3b415d1
commit 4e56d0f420
2 changed files with 27 additions and 6 deletions
@@ -164,11 +164,13 @@ void GlassView::add_spectrum_pixel(uint8_t power) {
display.fill_rectangle({{xpos, screen_height - point}, {1, point}}, gradient.lut[spectrum_data[xpos]]); display.fill_rectangle({{xpos, screen_height - point}, {1, point}}, gradient.lut[spectrum_data[xpos]]);
} }
// indicate RSSI min and max power // indicate RSSI min and max power
display.fill_rectangle({{0, screen_height - map(raw_min, 0, 255, 0, spectrum_height)}, {screen_width, 1}}, -gradient.lut[raw_min]); if (show_rssi_guides) {
display.fill_rectangle({{0, screen_height - map(raw_max, 0, 255, 0, spectrum_height)}, {screen_width, 1}}, -gradient.lut[raw_max]); display.fill_rectangle({{0, screen_height - map(raw_min, 0, 255, 0, spectrum_height)}, {screen_width, 1}}, -gradient.lut[raw_min]);
display.fill_rectangle({{0, screen_height - map(raw_max, 0, 255, 0, spectrum_height)}, {screen_width, 1}}, -gradient.lut[raw_max]);
}
if (last_max_freq != max_freq_hold) { if (last_max_freq != max_freq_hold) {
last_max_freq = max_freq_hold; last_max_freq = max_freq_hold;
freq_stats.set("MAX HOLD: " + to_string_short_freq(max_freq_hold)); freq_stats.set("MAX: " + to_string_short_freq(max_freq_hold));
} }
plot_marker(marker_pixel_index); plot_marker(marker_pixel_index);
} else { } else {
@@ -394,6 +396,7 @@ GlassView::GlassView(
&button_marker_plus, &button_marker_plus,
&button_jump, &button_jump,
&button_rst, &button_rst,
&button_rssi,
&freq_stats}); &freq_stats});
load_presets(); // Load available presets from TXT files (or default). load_presets(); // Load available presets from TXT files (or default).
@@ -448,6 +451,7 @@ GlassView::GlassView(
freq_stats.hidden(true); freq_stats.hidden(true);
button_jump.hidden(true); button_jump.hidden(true);
button_rst.hidden(true); button_rst.hidden(true);
button_rssi.hidden(true);
display.scroll_set_area(109, screen_height - 1); // Restart scroll on the correct coordinates. display.scroll_set_area(109, screen_height - 1); // Restart scroll on the correct coordinates.
break; break;
@@ -458,6 +462,7 @@ GlassView::GlassView(
freq_stats.hidden(false); freq_stats.hidden(false);
button_jump.hidden(false); button_jump.hidden(false);
button_rst.hidden(false); button_rst.hidden(false);
button_rssi.hidden(false);
break; break;
case 2: // PEAK case 2: // PEAK
@@ -468,6 +473,7 @@ GlassView::GlassView(
freq_stats.hidden(false); freq_stats.hidden(false);
button_jump.hidden(false); button_jump.hidden(false);
button_rst.hidden(false); button_rst.hidden(false);
button_rssi.hidden(false);
break; break;
} }
@@ -537,6 +543,16 @@ GlassView::GlassView(
reset_live_view(); reset_live_view();
}; };
button_rssi.on_select = [this](Button& button) {
show_rssi_guides = !show_rssi_guides;
if (show_rssi_guides) {
button.set_style(Theme::getInstance()->fg_green);
} else {
button.set_style(Theme::getInstance()->bg_darkest);
}
reset_live_view();
};
display.scroll_set_area(109, screen_height - 1); // Restart scroll on the correct coordinates display.scroll_set_area(109, screen_height - 1); // Restart scroll on the correct coordinates
// trigger: // trigger:
@@ -164,6 +164,7 @@ class GlassView : public View {
uint8_t bin_length = screen_width; uint8_t bin_length = screen_width;
uint8_t offset = 0; uint8_t offset = 0;
uint8_t ignore_dc = 0; uint8_t ignore_dc = 0;
bool show_rssi_guides = false;
// start of spectrum area // start of spectrum area
static constexpr int spectrum_y = (108 + 16); static constexpr int spectrum_y = (108 + 16);
@@ -288,15 +289,19 @@ class GlassView : public View {
}}; }};
Button button_jump{ Button button_jump{
{screen_width - 4 * 8, 5 * 16, 4 * 8, 16}, {UI_POS_X_RIGHT(4), UI_POS_Y(5), UI_POS_WIDTH(4), UI_POS_HEIGHT(1)},
"JMP"}; "JMP"};
Button button_rst{ Button button_rst{
{screen_width - 9 * 8, 5 * 16, 4 * 8, 16}, {UI_POS_X_RIGHT(9), UI_POS_Y(5), UI_POS_WIDTH(4), UI_POS_HEIGHT(1)},
"RST"}; "RST"};
Button button_rssi{
{UI_POS_X_RIGHT(15), UI_POS_Y(5), UI_POS_WIDTH(5), UI_POS_HEIGHT(1)},
"RSSI"};
Text freq_stats{ Text freq_stats{
{UI_POS_X(0), 5 * 16, screen_width - 10 * 8, 8}, {UI_POS_X(0), UI_POS_Y(5), UI_POS_WIDTH(14), UI_POS_HEIGHT(1)},
""}; ""};
MessageHandlerRegistration message_handler_spectrum_config{ MessageHandlerRegistration message_handler_spectrum_config{