mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-08-20 06:29:02 +00:00
Simplify CLKOUT frequency entry (#1668)
This commit is contained in:
@@ -133,7 +133,6 @@ SetRadioView::SetRadioView(
|
||||
&check_clkout,
|
||||
&field_clkout_freq,
|
||||
&labels_clkout_khz,
|
||||
&value_freq_step,
|
||||
&labels_bias,
|
||||
&check_bias,
|
||||
&disable_external_tcxo, // TODO: always show?
|
||||
@@ -186,28 +185,11 @@ SetRadioView::SetRadioView(
|
||||
};
|
||||
|
||||
field_clkout_freq.set_value(pmem::clkout_freq());
|
||||
value_freq_step.set_style(&Styles::light_grey);
|
||||
|
||||
field_clkout_freq.on_select = [this](NumberField&) {
|
||||
freq_step_khz++;
|
||||
if (freq_step_khz > 3) {
|
||||
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));
|
||||
field_clkout_freq.on_change = [this](SymField&) {
|
||||
if (field_clkout_freq.to_integer() < 10)
|
||||
field_clkout_freq.set_value(10);
|
||||
if (field_clkout_freq.to_integer() > 60000)
|
||||
field_clkout_freq.set_value(60000);
|
||||
};
|
||||
|
||||
check_bias.set_value(get_antenna_bias());
|
||||
@@ -248,7 +230,7 @@ void SetRadioView::form_init(const SetFrequencyCorrectionModel& model) {
|
||||
SetFrequencyCorrectionModel SetRadioView::form_collect() {
|
||||
return {
|
||||
.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()),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user