mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-08-20 14:39:01 +00:00
Pause on the looking glass (#3261)
This commit is contained in:
@@ -401,7 +401,7 @@ GlassView::GlassView(
|
||||
&button_jump,
|
||||
&button_rst,
|
||||
&button_rssi,
|
||||
&freq_stats});
|
||||
&freq_stats, &button_play});
|
||||
|
||||
load_presets(); // Load available presets from TXT files (or default).
|
||||
preset_index = clip<uint8_t>(preset_index, 0, presets_db.size());
|
||||
@@ -557,6 +557,21 @@ GlassView::GlassView(
|
||||
reset_live_view();
|
||||
};
|
||||
|
||||
button_play.on_select = [this](ImageButton&) {
|
||||
paused = !paused;
|
||||
if (paused) {
|
||||
button_play.set_foreground(Theme::getInstance()->fg_red->foreground);
|
||||
button_play.set_background(Theme::getInstance()->fg_red->background);
|
||||
baseband::spectrum_streaming_stop();
|
||||
button_play.set_bitmap(&bitmap_play);
|
||||
} else {
|
||||
button_play.set_foreground(Theme::getInstance()->fg_green->foreground);
|
||||
button_play.set_background(Theme::getInstance()->fg_green->background);
|
||||
baseband::spectrum_streaming_start();
|
||||
button_play.set_bitmap(&bitmap_stop);
|
||||
}
|
||||
};
|
||||
|
||||
display.scroll_set_area(109, screen_height - 1); // Restart scroll on the correct coordinates
|
||||
|
||||
// trigger:
|
||||
|
||||
@@ -130,6 +130,8 @@ class GlassView : public View {
|
||||
void populate_presets();
|
||||
void launch_audio(rf::Frequency center_freq);
|
||||
|
||||
bool paused{false};
|
||||
|
||||
rf::Frequency search_span{0};
|
||||
rf::Frequency f_center{0};
|
||||
rf::Frequency f_center_ini{0};
|
||||
@@ -222,6 +224,12 @@ class GlassView : public View {
|
||||
{UI_POS_X_RIGHT(8), UI_POS_Y(2.25), UI_POS_WIDTH(8), UI_POS_HEIGHT(0.5)},
|
||||
""};
|
||||
|
||||
ImageButton button_play{
|
||||
{UI_POS_X_RIGHT(2), UI_POS_Y(3.25) - 2, UI_POS_WIDTH(2), UI_POS_HEIGHT(0.5)},
|
||||
&bitmap_stop,
|
||||
Theme::getInstance()->fg_green->foreground,
|
||||
Theme::getInstance()->fg_green->background};
|
||||
|
||||
TextField field_marker{
|
||||
{UI_POS_X(12), UI_POS_Y(3), UI_POS_WIDTH(9), UI_POS_HEIGHT(1)},
|
||||
""};
|
||||
|
||||
Reference in New Issue
Block a user