mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-11 09:09:29 +00:00
Change current frequency display text to BigFrequency for better visuals (#3305)
This commit is contained in:
@@ -35,7 +35,7 @@ namespace ui::external_app::signal_hunter {
|
|||||||
// --- TAB 1: Main View ---
|
// --- TAB 1: Main View ---
|
||||||
HunterMainView::HunterMainView(Rect parent_rect, SignalHunterAppView& parent)
|
HunterMainView::HunterMainView(Rect parent_rect, SignalHunterAppView& parent)
|
||||||
: View(parent_rect), parent_app(parent) {
|
: View(parent_rect), parent_app(parent) {
|
||||||
add_children({&text_current_freq, &text_status, &button_start_stop, &text_hits});
|
add_children({&big_display, &text_status, &button_start_stop, &text_hits});
|
||||||
update_frequency(433920000);
|
update_frequency(433920000);
|
||||||
|
|
||||||
button_start_stop.on_select = [this](Button&) {
|
button_start_stop.on_select = [this](Button&) {
|
||||||
@@ -64,35 +64,29 @@ HunterMainView::HunterMainView(Rect parent_rect, SignalHunterAppView& parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HunterMainView::on_show() {
|
void HunterMainView::on_show() {
|
||||||
if (!parent_app.freq_hop_mode) {
|
if (!parent_app.freq_hop_mode)
|
||||||
current_freq_ = receiver_model.target_frequency();
|
current_freq_ = receiver_model.target_frequency();
|
||||||
}
|
big_display.set(current_freq_);
|
||||||
|
|
||||||
update_frequency(current_freq_); // force repaint
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HunterMainView::focus() {
|
void HunterMainView::focus() {
|
||||||
if (!parent_app.freq_hop_mode) {
|
if (!parent_app.freq_hop_mode)
|
||||||
current_freq_ = receiver_model.target_frequency();
|
current_freq_ = receiver_model.target_frequency();
|
||||||
}
|
big_display.set(current_freq_);
|
||||||
|
|
||||||
update_frequency(current_freq_);
|
|
||||||
button_start_stop.focus();
|
button_start_stop.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HunterMainView::set_recording_state(bool recording) {
|
void HunterMainView::set_recording_state(bool recording) {
|
||||||
if (recording)
|
if (recording)
|
||||||
text_current_freq.set_style(Theme::getInstance()->fg_red);
|
big_display.set_style(Theme::getInstance()->fg_red);
|
||||||
else
|
else
|
||||||
text_current_freq.set_style(Theme::getInstance()->fg_light);
|
big_display.set_style(Theme::getInstance()->fg_light);
|
||||||
|
big_display.set(current_freq_);
|
||||||
text_current_freq.set_dirty(); // force ui update
|
|
||||||
update_frequency(current_freq_); // repaint with the new color
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HunterMainView::update_frequency(rf::Frequency freq) {
|
void HunterMainView::update_frequency(rf::Frequency freq) {
|
||||||
current_freq_ = freq;
|
current_freq_ = freq;
|
||||||
text_current_freq.set(to_string_dec_uint(freq) + " Hz");
|
big_display.set(freq);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HunterMainView::update_status(const std::string& status, const Style* style) {
|
void HunterMainView::update_status(const std::string& status, const Style* style) {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class HunterMainView : public View {
|
|||||||
private:
|
private:
|
||||||
SignalHunterAppView& parent_app;
|
SignalHunterAppView& parent_app;
|
||||||
rf::Frequency current_freq_{433920000};
|
rf::Frequency current_freq_{433920000};
|
||||||
Text text_current_freq{{UI_POS_X_CENTER(14), UI_POS_Y(3), 112, 16}, ""};
|
BigFrequency big_display{{4, 24, 224, 52}, 0};
|
||||||
Text text_status{{UI_POS_X_CENTER(12), UI_POS_Y(6), 96, 16}, "IDLE"};
|
Text text_status{{UI_POS_X_CENTER(12), UI_POS_Y(6), 96, 16}, "IDLE"};
|
||||||
Button button_start_stop{{UI_POS_X_CENTER(10), UI_POS_Y(8), 80, 32}, "START"};
|
Button button_start_stop{{UI_POS_X_CENTER(10), UI_POS_Y(8), 80, 32}, "START"};
|
||||||
Text text_hits{{UI_POS_X_CENTER(10), UI_POS_Y(11), 80, 16}, "Hits: 0"};
|
Text text_hits{{UI_POS_X_CENTER(10), UI_POS_Y(11), 80, 16}, "Hits: 0"};
|
||||||
|
|||||||
Reference in New Issue
Block a user