mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-10 07:30:08 -04:00
Simplify CLKOUT frequency entry (#1668)
This commit is contained in:
parent
f42ad5ffc6
commit
4eb5c4603e
2 changed files with 8 additions and 32 deletions
|
@ -133,7 +133,6 @@ SetRadioView::SetRadioView(
|
||||||
&check_clkout,
|
&check_clkout,
|
||||||
&field_clkout_freq,
|
&field_clkout_freq,
|
||||||
&labels_clkout_khz,
|
&labels_clkout_khz,
|
||||||
&value_freq_step,
|
|
||||||
&labels_bias,
|
&labels_bias,
|
||||||
&check_bias,
|
&check_bias,
|
||||||
&disable_external_tcxo, // TODO: always show?
|
&disable_external_tcxo, // TODO: always show?
|
||||||
|
@ -186,28 +185,11 @@ SetRadioView::SetRadioView(
|
||||||
};
|
};
|
||||||
|
|
||||||
field_clkout_freq.set_value(pmem::clkout_freq());
|
field_clkout_freq.set_value(pmem::clkout_freq());
|
||||||
value_freq_step.set_style(&Styles::light_grey);
|
field_clkout_freq.on_change = [this](SymField&) {
|
||||||
|
if (field_clkout_freq.to_integer() < 10)
|
||||||
field_clkout_freq.on_select = [this](NumberField&) {
|
field_clkout_freq.set_value(10);
|
||||||
freq_step_khz++;
|
if (field_clkout_freq.to_integer() > 60000)
|
||||||
if (freq_step_khz > 3) {
|
field_clkout_freq.set_value(60000);
|
||||||
freq_step_khz = 0;
|
|
||||||
}
|
|
||||||
switch (freq_step_khz) {
|
|
||||||
case 0:
|
|
||||||
value_freq_step.set(" |");
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
value_freq_step.set(" | ");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
value_freq_step.set(" | ");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
value_freq_step.set("| ");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
field_clkout_freq.set_step(pow(10, freq_step_khz));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
check_bias.set_value(get_antenna_bias());
|
check_bias.set_value(get_antenna_bias());
|
||||||
|
@ -248,7 +230,7 @@ void SetRadioView::form_init(const SetFrequencyCorrectionModel& model) {
|
||||||
SetFrequencyCorrectionModel SetRadioView::form_collect() {
|
SetFrequencyCorrectionModel SetRadioView::form_collect() {
|
||||||
return {
|
return {
|
||||||
.ppm = static_cast<int8_t>(field_ppm.value()),
|
.ppm = static_cast<int8_t>(field_ppm.value()),
|
||||||
.freq = static_cast<uint32_t>(field_clkout_freq.value()),
|
.freq = static_cast<uint32_t>(field_clkout_freq.to_integer()),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,20 +163,14 @@ class SetRadioView : public View {
|
||||||
13,
|
13,
|
||||||
"Enable CLKOUT"};
|
"Enable CLKOUT"};
|
||||||
|
|
||||||
NumberField field_clkout_freq{
|
SymField field_clkout_freq{
|
||||||
{20 * 8, 6 * 16},
|
{20 * 8, 6 * 16},
|
||||||
5,
|
5,
|
||||||
{10, 60000},
|
SymField::Type::Dec};
|
||||||
1000,
|
|
||||||
' '};
|
|
||||||
|
|
||||||
Labels labels_clkout_khz{
|
Labels labels_clkout_khz{
|
||||||
{{26 * 8, 6 * 16}, "kHz", Color::light_grey()}};
|
{{26 * 8, 6 * 16}, "kHz", Color::light_grey()}};
|
||||||
|
|
||||||
Text value_freq_step{
|
|
||||||
{21 * 8, (7 * 16), 4 * 8, 16},
|
|
||||||
"| "};
|
|
||||||
|
|
||||||
Labels labels_bias{
|
Labels labels_bias{
|
||||||
{{4 * 8 + 4, 8 * 16}, "CAUTION: Ensure that all", Color::red()},
|
{{4 * 8 + 4, 8 * 16}, "CAUTION: Ensure that all", Color::red()},
|
||||||
{{5 * 8 + 0, 9 * 16}, "devices attached to the", Color::red()},
|
{{5 * 8 + 0, 9 * 16}, "devices attached to the", Color::red()},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue