mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-13 03:34:35 +00:00
Fixing colorisation of wait/lockwait fields (#1026)
* Fixing colorisation of wait/lockwait field
This commit is contained in:
parent
c0ff5715de
commit
0e86e63e97
@ -29,6 +29,29 @@ using portapack::memory::map::backup_ram;
|
||||
|
||||
namespace ui {
|
||||
|
||||
void ReconView::colorize_waits() {
|
||||
// colorize wait on match
|
||||
if (wait == 0) {
|
||||
field_wait.set_style(&style_blue);
|
||||
} else if (wait >= 500) {
|
||||
field_wait.set_style(&style_white);
|
||||
} else if (wait > -500 && wait < 500) {
|
||||
field_wait.set_style(&style_red);
|
||||
} else if (wait <= -500) {
|
||||
field_wait.set_style(&style_green);
|
||||
}
|
||||
// colorize lock time if in SPARSE mode as in continuous the lock_wait time is disarmed at first lock count
|
||||
if (recon_match_mode == RECON_MATCH_SPARSE) {
|
||||
if ((recon_lock_duration / STATS_UPDATE_INTERVAL) <= recon_lock_nb_match) {
|
||||
field_lock_wait.set_style(&style_yellow);
|
||||
} else {
|
||||
field_lock_wait.set_style(&style_white);
|
||||
}
|
||||
} else {
|
||||
field_lock_wait.set_style(&style_white);
|
||||
}
|
||||
}
|
||||
|
||||
bool ReconView::ReconSaveFreq(const std::string& freq_file_path, size_t freq_index, bool warn_if_exists) {
|
||||
File recon_file;
|
||||
|
||||
@ -778,7 +801,9 @@ ReconView::ReconView(NavigationView& nav)
|
||||
|
||||
update_ranges = persistent_memory::recon_update_ranges_when_recon();
|
||||
|
||||
field_wait.set_value(wait);
|
||||
field_lock_wait.set_value(recon_lock_duration);
|
||||
colorize_waits();
|
||||
|
||||
frequency_file_load(false);
|
||||
if (autostart) {
|
||||
@ -794,29 +819,12 @@ ReconView::ReconView(NavigationView& nav)
|
||||
|
||||
field_wait.on_change = [this](int32_t v) {
|
||||
wait = v;
|
||||
if (wait == 0) {
|
||||
field_wait.set_style(&style_blue);
|
||||
} else if (wait >= 500) {
|
||||
field_wait.set_style(&style_white);
|
||||
} else if (wait > -500 && wait < 500) {
|
||||
field_wait.set_style(&style_red);
|
||||
} else if (wait <= -500) {
|
||||
field_wait.set_style(&style_green);
|
||||
}
|
||||
colorize_waits();
|
||||
};
|
||||
|
||||
field_lock_wait.on_change = [this](uint32_t v) {
|
||||
recon_lock_duration = v;
|
||||
if (recon_match_mode == RECON_MATCH_CONTINUOUS) {
|
||||
if ((v / STATS_UPDATE_INTERVAL) > recon_lock_nb_match) {
|
||||
field_lock_wait.set_style(&style_white);
|
||||
} else if ((v / STATS_UPDATE_INTERVAL) == recon_lock_nb_match) {
|
||||
field_lock_wait.set_style(&style_yellow);
|
||||
}
|
||||
} else // RECON_MATCH_SPARSE
|
||||
{
|
||||
field_lock_wait.set_style(&style_white);
|
||||
}
|
||||
colorize_waits();
|
||||
};
|
||||
|
||||
field_squelch.on_change = [this](int32_t v) {
|
||||
@ -839,6 +847,8 @@ ReconView::ReconView(NavigationView& nav)
|
||||
field_squelch.set_value(squelch);
|
||||
field_wait.set_value(wait);
|
||||
field_lock_wait.set_value(recon_lock_duration);
|
||||
colorize_waits();
|
||||
|
||||
field_volume.set_value((receiver_model.headphone_volume() - audio::headphone::volume_range().max).decibel() + 99);
|
||||
|
||||
// fill modulation and step options
|
||||
@ -860,7 +870,6 @@ ReconView::ReconView(NavigationView& nav)
|
||||
} else {
|
||||
recon_pause();
|
||||
}
|
||||
|
||||
recon_redraw();
|
||||
}
|
||||
|
||||
|
@ -109,6 +109,7 @@ class ReconView : public View {
|
||||
void on_headphone_volume_changed(int32_t v);
|
||||
void on_index_delta(int32_t v);
|
||||
void on_stepper_delta(int32_t v);
|
||||
void colorize_waits();
|
||||
void recon_redraw();
|
||||
void handle_retune();
|
||||
void handle_coded_squelch(const uint32_t value);
|
||||
|
Loading…
Reference in New Issue
Block a user