Added options for enabling CLKOUT.

- CLKOUT can be enabled in Radio settings and status bar.
- Fixed a typo(I believe) in ui_navigation.
This commit is contained in:
dqs105 2020-09-16 19:27:56 +08:00
parent 55783a60f5
commit b15b781039
8 changed files with 80 additions and 9 deletions

View file

@ -113,7 +113,7 @@ SystemStatusView::SystemStatusView(
&button_camera,
&button_sleep,
&button_bias_tee,
&image_clock_status,
&button_clock_status,
&sd_card_status_view,
});
@ -168,6 +168,10 @@ SystemStatusView::SystemStatusView(
DisplaySleepMessage message;
EventDispatcher::send_message(message);
};
button_clock_status.on_select = [this](ImageButton&) {
this->on_clk();
};
}
void SystemStatusView::refresh() {
@ -188,11 +192,16 @@ void SystemStatusView::refresh() {
}
if (portapack::clock_manager.get_reference().source == ClockManager::ReferenceSource::External) {
image_clock_status.set_bitmap(&bitmap_icon_clk_ext);
button_bias_tee.set_foreground(ui::Color::green());
button_clock_status.set_bitmap(&bitmap_icon_clk_ext);
// button_bias_tee.set_foreground(ui::Color::green()); Typo?
} else {
image_clock_status.set_bitmap(&bitmap_icon_clk_int);
button_bias_tee.set_foreground(ui::Color::light_grey());
button_clock_status.set_bitmap(&bitmap_icon_clk_int);
// button_bias_tee.set_foreground(ui::Color::green());
}
if(portapack::persistent_memory::clkout_enabled()) {
button_clock_status.set_foreground(ui::Color::green());
} else {
button_clock_status.set_foreground(ui::Color::light_grey());
}
set_dirty();
@ -302,6 +311,18 @@ void SystemStatusView::on_camera() {
}
}
void SystemStatusView::on_clk() {
bool v = portapack::persistent_memory::clkout_enabled();
if(v) {
v = false;
} else {
v = true;
}
portapack::clock_manager.enable_clock_output(v);
portapack::persistent_memory::set_clkout_enabled(v);
refresh();
}
void SystemStatusView::on_title() {
if(nav_.is_top())
nav_.push<AboutView>();