UI to turn on antenna bias voltage.

This commit is contained in:
Jared Boone 2016-01-23 11:32:10 -08:00
parent 25fac90d4f
commit 60b8b38652
2 changed files with 75 additions and 1 deletions

View File

@ -25,6 +25,9 @@
#include "lpc43xx_cpp.hpp"
using namespace lpc43xx;
#include "portapack.hpp"
using portapack::receiver_model;
namespace ui {
SetDateTimeView::SetDateTimeView(
@ -141,6 +144,29 @@ SetFrequencyCorrectionModel SetFrequencyCorrectionView::form_collect() {
};
}
AntennaBiasSetupView::AntennaBiasSetupView(NavigationView& nav) {
add_children({ {
&text_title,
&text_description_1,
&text_description_2,
&text_description_3,
&text_description_4,
&options_bias,
&button_done,
} });
options_bias.set_by_value(receiver_model.antenna_bias() ? 1 : 0);
options_bias.on_change = [this](size_t, OptionsField::value_t v) {
receiver_model.set_antenna_bias(v);
};
button_done.on_select = [&nav](Button&){ nav.pop(); };
}
void AntennaBiasSetupView::focus() {
button_done.focus();
}
AboutView::AboutView(NavigationView& nav) {
add_children({ {
&text_title,
@ -158,9 +184,10 @@ void AboutView::focus() {
}
SetupMenuView::SetupMenuView(NavigationView& nav) {
add_items<3>({ {
add_items<4>({ {
{ "Date/Time", [&nav](){ nav.push<SetDateTimeView>(); } },
{ "Frequency Correction", [&nav](){ nav.push<SetFrequencyCorrectionView>(); } },
{ "Antenna Bias Voltage", [&nav](){ nav.push<AntennaBiasSetupView>(); } },
{ "Touch", [&nav](){ nav.push<NotImplementedView>(); } },
} });
on_left = [&nav](){ nav.pop(); };

View File

@ -176,6 +176,53 @@ private:
SetFrequencyCorrectionModel form_collect();
};
class AntennaBiasSetupView : public View {
public:
AntennaBiasSetupView(NavigationView& nav);
void focus() override;
private:
Text text_title {
{ 5 * 8, 3 * 16, 20 * 8, 16 },
"Antenna Bias Voltage"
};
Text text_description_1 {
{ 24, 6 * 16, 24 * 8, 16 },
"CAUTION: Ensure that all"
};
Text text_description_2 {
{ 28, 7 * 16, 23 * 8, 16 },
"devices attached to the"
};
Text text_description_3 {
{ 8, 8 * 16, 28 * 8, 16 },
"antenna connector can accept"
};
Text text_description_4 {
{ 68, 9 * 16, 13 * 8, 16 },
"a DC voltage!"
};
OptionsField options_bias {
{ 100, 12 * 16 },
5,
{
{ " Off ", 0 },
{ " On ", 1 },
}
};
Button button_done {
{ 72, 15 * 16, 96, 24 },
"Done"
};
};
class AboutView : public View {
public:
AboutView(NavigationView& nav);