mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-03-12 18:06:29 -04:00
Compare commits
7 Commits
9540776afd
...
c9c438824d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c9c438824d | ||
![]() |
95eb1e6d59 | ||
![]() |
1f32367495 | ||
![]() |
0ed5e6542e | ||
![]() |
7240d45a4f | ||
![]() |
17250304e0 | ||
![]() |
835bc49999 |
@ -42,425 +42,524 @@ using namespace portapack;
|
|||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
SetDateTimeView::SetDateTimeView(
|
SetDateTimeView::SetDateTimeView(
|
||||||
NavigationView& nav
|
NavigationView& nav
|
||||||
) {
|
) {
|
||||||
button_save.on_select = [&nav, this](Button&){
|
button_save.on_select = [&nav, this](Button&){
|
||||||
const auto model = this->form_collect();
|
const auto model = this->form_collect();
|
||||||
const rtc::RTC new_datetime {
|
const rtc::RTC new_datetime {
|
||||||
model.year, model.month, model.day,
|
model.year, model.month, model.day,
|
||||||
model.hour, model.minute, model.second
|
model.hour, model.minute, model.second
|
||||||
|
};
|
||||||
|
rtcSetTime(&RTCD1, &new_datetime);
|
||||||
|
nav.pop();
|
||||||
|
},
|
||||||
|
|
||||||
|
button_cancel.on_select = [&nav](Button&){
|
||||||
|
nav.pop();
|
||||||
|
},
|
||||||
|
|
||||||
|
add_children({
|
||||||
|
&labels,
|
||||||
|
&field_year,
|
||||||
|
&field_month,
|
||||||
|
&field_day,
|
||||||
|
&field_hour,
|
||||||
|
&field_minute,
|
||||||
|
&field_second,
|
||||||
|
&button_save,
|
||||||
|
&button_cancel,
|
||||||
|
});
|
||||||
|
|
||||||
|
rtc::RTC datetime;
|
||||||
|
rtcGetTime(&RTCD1, &datetime);
|
||||||
|
SetDateTimeModel model {
|
||||||
|
datetime.year(),
|
||||||
|
datetime.month(),
|
||||||
|
datetime.day(),
|
||||||
|
datetime.hour(),
|
||||||
|
datetime.minute(),
|
||||||
|
datetime.second()
|
||||||
};
|
};
|
||||||
rtcSetTime(&RTCD1, &new_datetime);
|
|
||||||
nav.pop();
|
|
||||||
},
|
|
||||||
|
|
||||||
button_cancel.on_select = [&nav](Button&){
|
form_init(model);
|
||||||
nav.pop();
|
|
||||||
},
|
|
||||||
|
|
||||||
add_children({
|
|
||||||
&labels,
|
|
||||||
&field_year,
|
|
||||||
&field_month,
|
|
||||||
&field_day,
|
|
||||||
&field_hour,
|
|
||||||
&field_minute,
|
|
||||||
&field_second,
|
|
||||||
&button_save,
|
|
||||||
&button_cancel,
|
|
||||||
});
|
|
||||||
|
|
||||||
rtc::RTC datetime;
|
|
||||||
rtcGetTime(&RTCD1, &datetime);
|
|
||||||
SetDateTimeModel model {
|
|
||||||
datetime.year(),
|
|
||||||
datetime.month(),
|
|
||||||
datetime.day(),
|
|
||||||
datetime.hour(),
|
|
||||||
datetime.minute(),
|
|
||||||
datetime.second()
|
|
||||||
};
|
|
||||||
|
|
||||||
form_init(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetDateTimeView::focus() {
|
|
||||||
button_cancel.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetDateTimeView::form_init(const SetDateTimeModel& model) {
|
|
||||||
field_year.set_value(model.year);
|
|
||||||
field_month.set_value(model.month);
|
|
||||||
field_day.set_value(model.day);
|
|
||||||
field_hour.set_value(model.hour);
|
|
||||||
field_minute.set_value(model.minute);
|
|
||||||
field_second.set_value(model.second);
|
|
||||||
}
|
|
||||||
|
|
||||||
SetDateTimeModel SetDateTimeView::form_collect() {
|
|
||||||
return {
|
|
||||||
.year = static_cast<uint16_t>(field_year.value()),
|
|
||||||
.month = static_cast<uint8_t>(field_month.value()),
|
|
||||||
.day = static_cast<uint8_t>(field_day.value()),
|
|
||||||
.hour = static_cast<uint8_t>(field_hour.value()),
|
|
||||||
.minute = static_cast<uint8_t>(field_minute.value()),
|
|
||||||
.second = static_cast<uint8_t>(field_second.value())
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
SetRadioView::SetRadioView(
|
|
||||||
NavigationView& nav
|
|
||||||
) {
|
|
||||||
button_cancel.on_select = [&nav](Button&){
|
|
||||||
nav.pop();
|
|
||||||
};
|
|
||||||
|
|
||||||
const auto reference = portapack::clock_manager.get_reference();
|
|
||||||
|
|
||||||
std::string source_name("---");
|
|
||||||
switch(reference.source) {
|
|
||||||
case ClockManager::ReferenceSource::Xtal: source_name = "HackRF"; break;
|
|
||||||
case ClockManager::ReferenceSource::PortaPack: source_name = "PortaPack"; break;
|
|
||||||
case ClockManager::ReferenceSource::External: source_name = "External"; break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
value_source.set(source_name);
|
void SetDateTimeView::focus() {
|
||||||
value_source_frequency.set(to_string_dec_uint(reference.frequency / 1000000, 2) + "." + to_string_dec_uint((reference.frequency % 1000000) / 100, 4, '0') + " MHz");
|
button_cancel.focus();
|
||||||
|
}
|
||||||
|
|
||||||
label_source.set_style(&style_text);
|
void SetDateTimeView::form_init(const SetDateTimeModel& model) {
|
||||||
value_source.set_style(&style_text);
|
field_year.set_value(model.year);
|
||||||
value_source_frequency.set_style(&style_text);
|
field_month.set_value(model.month);
|
||||||
|
field_day.set_value(model.day);
|
||||||
|
field_hour.set_value(model.hour);
|
||||||
|
field_minute.set_value(model.minute);
|
||||||
|
field_second.set_value(model.second);
|
||||||
|
}
|
||||||
|
|
||||||
add_children({
|
SetDateTimeModel SetDateTimeView::form_collect() {
|
||||||
&label_source,
|
return {
|
||||||
&value_source,
|
.year = static_cast<uint16_t>(field_year.value()),
|
||||||
&value_source_frequency,
|
.month = static_cast<uint8_t>(field_month.value()),
|
||||||
});
|
.day = static_cast<uint8_t>(field_day.value()),
|
||||||
|
.hour = static_cast<uint8_t>(field_hour.value()),
|
||||||
|
.minute = static_cast<uint8_t>(field_minute.value()),
|
||||||
|
.second = static_cast<uint8_t>(field_second.value())
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
SetRadioView::SetRadioView(
|
||||||
|
NavigationView& nav
|
||||||
|
) {
|
||||||
|
button_cancel.on_select = [&nav](Button&){
|
||||||
|
nav.pop();
|
||||||
|
};
|
||||||
|
|
||||||
|
const auto reference = portapack::clock_manager.get_reference();
|
||||||
|
|
||||||
|
std::string source_name("---");
|
||||||
|
switch(reference.source) {
|
||||||
|
case ClockManager::ReferenceSource::Xtal: source_name = "HackRF"; break;
|
||||||
|
case ClockManager::ReferenceSource::PortaPack: source_name = "PortaPack"; break;
|
||||||
|
case ClockManager::ReferenceSource::External: source_name = "External"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
value_source.set(source_name);
|
||||||
|
value_source_frequency.set(to_string_dec_uint(reference.frequency / 1000000, 2) + "." + to_string_dec_uint((reference.frequency % 1000000) / 100, 4, '0') + " MHz");
|
||||||
|
|
||||||
|
label_source.set_style(&style_text);
|
||||||
|
value_source.set_style(&style_text);
|
||||||
|
value_source_frequency.set_style(&style_text);
|
||||||
|
|
||||||
if( reference.source == ClockManager::ReferenceSource::Xtal ) {
|
|
||||||
add_children({
|
add_children({
|
||||||
&labels_correction,
|
&label_source,
|
||||||
&field_ppm,
|
&value_source,
|
||||||
});
|
&value_source_frequency,
|
||||||
|
});
|
||||||
|
|
||||||
|
if( reference.source == ClockManager::ReferenceSource::Xtal ) {
|
||||||
|
add_children({
|
||||||
|
&labels_correction,
|
||||||
|
&field_ppm,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
add_children({
|
||||||
|
&check_clkout,
|
||||||
|
&field_clkout_freq,
|
||||||
|
&labels_clkout_khz,
|
||||||
|
&value_freq_step,
|
||||||
|
&labels_bias,
|
||||||
|
&check_bias,
|
||||||
|
&button_save,
|
||||||
|
&button_cancel
|
||||||
|
});
|
||||||
|
|
||||||
|
SetFrequencyCorrectionModel model {
|
||||||
|
static_cast<int8_t>(portapack::persistent_memory::correction_ppb() / 1000) , 0
|
||||||
|
};
|
||||||
|
|
||||||
|
form_init(model);
|
||||||
|
|
||||||
|
check_clkout.set_value(portapack::persistent_memory::clkout_enabled());
|
||||||
|
check_clkout.on_select = [this](Checkbox&, bool v) {
|
||||||
|
clock_manager.enable_clock_output(v);
|
||||||
|
portapack::persistent_memory::set_clkout_enabled(v);
|
||||||
|
StatusRefreshMessage message { };
|
||||||
|
EventDispatcher::send_message(message);
|
||||||
|
};
|
||||||
|
|
||||||
|
field_clkout_freq.set_value(portapack::persistent_memory::clkout_freq());
|
||||||
|
value_freq_step.set_style(&style_text);
|
||||||
|
|
||||||
|
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));
|
||||||
|
};
|
||||||
|
|
||||||
|
check_bias.set_value(portapack::get_antenna_bias());
|
||||||
|
check_bias.on_select = [this](Checkbox&, bool v) {
|
||||||
|
portapack::set_antenna_bias(v);
|
||||||
|
StatusRefreshMessage message { };
|
||||||
|
EventDispatcher::send_message(message);
|
||||||
|
};
|
||||||
|
|
||||||
|
button_save.on_select = [this, &nav](Button&){
|
||||||
|
const auto model = this->form_collect();
|
||||||
|
portapack::persistent_memory::set_correction_ppb(model.ppm * 1000);
|
||||||
|
portapack::persistent_memory::set_clkout_freq(model.freq);
|
||||||
|
clock_manager.enable_clock_output(portapack::persistent_memory::clkout_enabled());
|
||||||
|
nav.pop();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
add_children({
|
void SetRadioView::focus() {
|
||||||
&check_clkout,
|
button_save.focus();
|
||||||
&field_clkout_freq,
|
}
|
||||||
&labels_clkout_khz,
|
|
||||||
&value_freq_step,
|
|
||||||
&labels_bias,
|
|
||||||
&check_bias,
|
|
||||||
&button_save,
|
|
||||||
&button_cancel
|
|
||||||
});
|
|
||||||
|
|
||||||
SetFrequencyCorrectionModel model {
|
void SetRadioView::form_init(const SetFrequencyCorrectionModel& model) {
|
||||||
static_cast<int8_t>(portapack::persistent_memory::correction_ppb() / 1000) , 0
|
field_ppm.set_value(model.ppm);
|
||||||
};
|
}
|
||||||
|
|
||||||
form_init(model);
|
SetFrequencyCorrectionModel SetRadioView::form_collect() {
|
||||||
|
return {
|
||||||
check_clkout.set_value(portapack::persistent_memory::clkout_enabled());
|
.ppm = static_cast<int8_t>(field_ppm.value()),
|
||||||
check_clkout.on_select = [this](Checkbox&, bool v) {
|
.freq = static_cast<uint32_t>(field_clkout_freq.value()),
|
||||||
clock_manager.enable_clock_output(v);
|
};
|
||||||
portapack::persistent_memory::set_clkout_enabled(v);
|
|
||||||
StatusRefreshMessage message { };
|
|
||||||
EventDispatcher::send_message(message);
|
|
||||||
};
|
|
||||||
|
|
||||||
field_clkout_freq.set_value(portapack::persistent_memory::clkout_freq());
|
|
||||||
value_freq_step.set_style(&style_text);
|
|
||||||
|
|
||||||
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));
|
|
||||||
};
|
|
||||||
|
|
||||||
check_bias.set_value(portapack::get_antenna_bias());
|
|
||||||
check_bias.on_select = [this](Checkbox&, bool v) {
|
|
||||||
portapack::set_antenna_bias(v);
|
|
||||||
StatusRefreshMessage message { };
|
|
||||||
EventDispatcher::send_message(message);
|
|
||||||
};
|
|
||||||
|
|
||||||
button_save.on_select = [this, &nav](Button&){
|
|
||||||
const auto model = this->form_collect();
|
|
||||||
portapack::persistent_memory::set_correction_ppb(model.ppm * 1000);
|
|
||||||
portapack::persistent_memory::set_clkout_freq(model.freq);
|
|
||||||
clock_manager.enable_clock_output(portapack::persistent_memory::clkout_enabled());
|
|
||||||
nav.pop();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetRadioView::focus() {
|
|
||||||
button_save.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetRadioView::form_init(const SetFrequencyCorrectionModel& model) {
|
|
||||||
field_ppm.set_value(model.ppm);
|
|
||||||
}
|
|
||||||
|
|
||||||
SetFrequencyCorrectionModel SetRadioView::form_collect() {
|
|
||||||
return {
|
|
||||||
.ppm = static_cast<int8_t>(field_ppm.value()),
|
|
||||||
.freq = static_cast<uint32_t>(field_clkout_freq.value()),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SetUIView::SetUIView(NavigationView& nav) {
|
|
||||||
add_children({
|
|
||||||
&checkbox_disable_touchscreen,
|
|
||||||
&checkbox_speaker,
|
|
||||||
&checkbox_bloff,
|
|
||||||
&options_bloff,
|
|
||||||
&checkbox_showsplash,
|
|
||||||
&checkbox_showclock,
|
|
||||||
&options_clockformat,
|
|
||||||
&checkbox_guireturnflag,
|
|
||||||
&button_save,
|
|
||||||
&button_cancel
|
|
||||||
});
|
|
||||||
|
|
||||||
checkbox_disable_touchscreen.set_value(persistent_memory::disable_touchscreen());
|
|
||||||
checkbox_speaker.set_value(persistent_memory::config_speaker());
|
|
||||||
checkbox_showsplash.set_value(persistent_memory::config_splash());
|
|
||||||
checkbox_showclock.set_value(!persistent_memory::hide_clock());
|
|
||||||
checkbox_guireturnflag.set_value(persistent_memory::show_gui_return_icon());
|
|
||||||
|
|
||||||
const auto backlight_config = persistent_memory::config_backlight_timer();
|
|
||||||
checkbox_bloff.set_value(backlight_config.timeout_enabled());
|
|
||||||
options_bloff.set_by_value(backlight_config.timeout_enum());
|
|
||||||
|
|
||||||
if (persistent_memory::clock_with_date()) {
|
|
||||||
options_clockformat.set_selected_index(1);
|
|
||||||
} else {
|
|
||||||
options_clockformat.set_selected_index(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
button_save.on_select = [&nav, this](Button&) {
|
SetUIView::SetUIView(NavigationView& nav) {
|
||||||
persistent_memory::set_config_backlight_timer({
|
add_children({
|
||||||
(persistent_memory::backlight_timeout_t)options_bloff.selected_index_value(),
|
&checkbox_disable_touchscreen,
|
||||||
checkbox_bloff.value()
|
&checkbox_speaker,
|
||||||
});
|
&checkbox_bloff,
|
||||||
|
&options_bloff,
|
||||||
if (checkbox_showclock.value()){
|
&checkbox_showsplash,
|
||||||
if (options_clockformat.selected_index() == 1)
|
&checkbox_showclock,
|
||||||
persistent_memory::set_clock_with_date(true);
|
&options_clockformat,
|
||||||
else
|
&checkbox_guireturnflag,
|
||||||
persistent_memory::set_clock_with_date(false);
|
&button_save,
|
||||||
|
&button_cancel
|
||||||
|
});
|
||||||
|
|
||||||
|
checkbox_disable_touchscreen.set_value(persistent_memory::disable_touchscreen());
|
||||||
|
checkbox_speaker.set_value(persistent_memory::config_speaker());
|
||||||
|
checkbox_showsplash.set_value(persistent_memory::config_splash());
|
||||||
|
checkbox_showclock.set_value(!persistent_memory::hide_clock());
|
||||||
|
checkbox_guireturnflag.set_value(persistent_memory::show_gui_return_icon());
|
||||||
|
|
||||||
|
const auto backlight_config = persistent_memory::config_backlight_timer();
|
||||||
|
checkbox_bloff.set_value(backlight_config.timeout_enabled());
|
||||||
|
options_bloff.set_by_value(backlight_config.timeout_enum());
|
||||||
|
|
||||||
|
if (persistent_memory::clock_with_date()) {
|
||||||
|
options_clockformat.set_selected_index(1);
|
||||||
|
} else {
|
||||||
|
options_clockformat.set_selected_index(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkbox_speaker.value()) audio::output::speaker_mute(); //Just mute audio if speaker is disabled
|
|
||||||
persistent_memory::set_config_speaker(checkbox_speaker.value()); //Store Speaker status
|
|
||||||
StatusRefreshMessage message { }; //Refresh status bar with/out speaker
|
|
||||||
EventDispatcher::send_message(message);
|
|
||||||
|
|
||||||
persistent_memory::set_config_splash(checkbox_showsplash.value());
|
|
||||||
persistent_memory::set_clock_hidden(!checkbox_showclock.value());
|
|
||||||
persistent_memory::set_gui_return_icon(checkbox_guireturnflag.value());
|
|
||||||
persistent_memory::set_disable_touchscreen(checkbox_disable_touchscreen.value());
|
|
||||||
nav.pop();
|
|
||||||
};
|
|
||||||
button_cancel.on_select = [&nav, this](Button&) {
|
|
||||||
nav.pop();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetUIView::focus() {
|
button_save.on_select = [&nav, this](Button&) {
|
||||||
button_save.focus();
|
persistent_memory::set_config_backlight_timer({
|
||||||
}
|
(persistent_memory::backlight_timeout_t)options_bloff.selected_index_value(),
|
||||||
|
checkbox_bloff.value()
|
||||||
|
});
|
||||||
|
|
||||||
|
if (checkbox_showclock.value()){
|
||||||
|
if (options_clockformat.selected_index() == 1)
|
||||||
|
persistent_memory::set_clock_with_date(true);
|
||||||
|
else
|
||||||
|
persistent_memory::set_clock_with_date(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkbox_speaker.value()) audio::output::speaker_mute(); //Just mute audio if speaker is disabled
|
||||||
|
persistent_memory::set_config_speaker(checkbox_speaker.value()); //Store Speaker status
|
||||||
|
StatusRefreshMessage message { }; //Refresh status bar with/out speaker
|
||||||
|
EventDispatcher::send_message(message);
|
||||||
|
|
||||||
|
persistent_memory::set_config_splash(checkbox_showsplash.value());
|
||||||
|
persistent_memory::set_clock_hidden(!checkbox_showclock.value());
|
||||||
|
persistent_memory::set_gui_return_icon(checkbox_guireturnflag.value());
|
||||||
|
persistent_memory::set_disable_touchscreen(checkbox_disable_touchscreen.value());
|
||||||
|
nav.pop();
|
||||||
|
};
|
||||||
|
button_cancel.on_select = [&nav, this](Button&) {
|
||||||
|
nav.pop();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetUIView::focus() {
|
||||||
|
button_save.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
// Appl. Settings
|
// Appl. Settings
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
SetAppSettingsView::SetAppSettingsView(NavigationView& nav) {
|
SetAppSettingsView::SetAppSettingsView(NavigationView& nav) {
|
||||||
add_children({
|
add_children({
|
||||||
&checkbox_load_app_settings,
|
&checkbox_load_app_settings,
|
||||||
&checkbox_save_app_settings,
|
&checkbox_save_app_settings,
|
||||||
&button_save,
|
&button_save,
|
||||||
&button_cancel
|
&button_cancel
|
||||||
});
|
});
|
||||||
|
|
||||||
checkbox_load_app_settings.set_value(persistent_memory::load_app_settings());
|
checkbox_load_app_settings.set_value(persistent_memory::load_app_settings());
|
||||||
checkbox_save_app_settings.set_value(persistent_memory::save_app_settings());
|
checkbox_save_app_settings.set_value(persistent_memory::save_app_settings());
|
||||||
|
|
||||||
|
|
||||||
button_save.on_select = [&nav, this](Button&) {
|
button_save.on_select = [&nav, this](Button&) {
|
||||||
persistent_memory::set_load_app_settings(checkbox_load_app_settings.value());
|
persistent_memory::set_load_app_settings(checkbox_load_app_settings.value());
|
||||||
persistent_memory::set_save_app_settings(checkbox_save_app_settings.value());
|
persistent_memory::set_save_app_settings(checkbox_save_app_settings.value());
|
||||||
nav.pop();
|
nav.pop();
|
||||||
};
|
};
|
||||||
button_cancel.on_select = [&nav, this](Button&) {
|
button_cancel.on_select = [&nav, this](Button&) {
|
||||||
nav.pop();
|
nav.pop();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetAppSettingsView::focus() {
|
void SetAppSettingsView::focus() {
|
||||||
button_save.focus();
|
button_save.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
// Converter Settings
|
// Converter Settings
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
SetConverterSettingsView::SetConverterSettingsView(NavigationView& nav) {
|
SetConverterSettingsView::SetConverterSettingsView(NavigationView& nav) {
|
||||||
add_children({
|
add_children({
|
||||||
&check_show_converter,
|
&check_show_converter,
|
||||||
&check_converter,
|
&check_converter,
|
||||||
&converter_mode,
|
&converter_mode,
|
||||||
&button_converter_freq,
|
&button_converter_freq,
|
||||||
&button_save,
|
&button_save,
|
||||||
&button_cancel
|
&button_cancel
|
||||||
});
|
});
|
||||||
|
|
||||||
check_show_converter.set_value(!portapack::persistent_memory::config_hide_converter());
|
check_show_converter.set_value(!portapack::persistent_memory::config_hide_converter());
|
||||||
check_show_converter.on_select = [this](Checkbox&, bool v) {
|
check_show_converter.on_select = [this](Checkbox&, bool v) {
|
||||||
portapack::persistent_memory::set_config_hide_converter(!v);
|
portapack::persistent_memory::set_config_hide_converter(!v);
|
||||||
if( !v )
|
if( !v )
|
||||||
{
|
{
|
||||||
check_converter.set_value(false);
|
check_converter.set_value(false);
|
||||||
}
|
}
|
||||||
// Retune to take converter change in account
|
// Retune to take converter change in account
|
||||||
receiver_model.set_tuning_frequency( portapack::persistent_memory::tuned_frequency() );
|
receiver_model.set_tuning_frequency( portapack::persistent_memory::tuned_frequency() );
|
||||||
//Refresh status bar with/out converter
|
//Refresh status bar with/out converter
|
||||||
StatusRefreshMessage message { };
|
StatusRefreshMessage message { };
|
||||||
EventDispatcher::send_message(message);
|
EventDispatcher::send_message(message);
|
||||||
};
|
};
|
||||||
|
|
||||||
check_converter.set_value(portapack::persistent_memory::config_converter());
|
check_converter.set_value(portapack::persistent_memory::config_converter());
|
||||||
check_converter.on_select = [this](Checkbox&, bool v) {
|
check_converter.on_select = [this](Checkbox&, bool v) {
|
||||||
if( v )
|
if( v )
|
||||||
{
|
{
|
||||||
check_show_converter.set_value(true);
|
check_show_converter.set_value(true);
|
||||||
portapack::persistent_memory::set_config_hide_converter(false);
|
portapack::persistent_memory::set_config_hide_converter(false);
|
||||||
}
|
}
|
||||||
portapack::persistent_memory::set_config_converter(v);
|
portapack::persistent_memory::set_config_converter(v);
|
||||||
// Retune to take converter change in account
|
// Retune to take converter change in account
|
||||||
receiver_model.set_tuning_frequency( portapack::persistent_memory::tuned_frequency() );
|
receiver_model.set_tuning_frequency( portapack::persistent_memory::tuned_frequency() );
|
||||||
//Refresh status bar with/out converter
|
//Refresh status bar with/out converter
|
||||||
StatusRefreshMessage message { };
|
StatusRefreshMessage message { };
|
||||||
EventDispatcher::send_message(message);
|
EventDispatcher::send_message(message);
|
||||||
};
|
};
|
||||||
|
|
||||||
converter_mode.set_by_value( portapack::persistent_memory::config_updown_converter() );
|
converter_mode.set_by_value( portapack::persistent_memory::config_updown_converter() );
|
||||||
converter_mode.on_change = [this](size_t, OptionsField::value_t v) {
|
converter_mode.on_change = [this](size_t, OptionsField::value_t v) {
|
||||||
portapack::persistent_memory::set_config_updown_converter( v );
|
portapack::persistent_memory::set_config_updown_converter( v );
|
||||||
//Refresh status bar with icon up or down
|
//Refresh status bar with icon up or down
|
||||||
StatusRefreshMessage message { };
|
StatusRefreshMessage message { };
|
||||||
EventDispatcher::send_message(message);
|
EventDispatcher::send_message(message);
|
||||||
};
|
};
|
||||||
|
|
||||||
button_converter_freq.set_text( to_string_short_freq( portapack::persistent_memory::config_converter_freq() ) + "MHz");
|
|
||||||
button_converter_freq.on_select = [this, &nav](Button& button) {
|
|
||||||
auto new_view = nav.push<FrequencyKeypadView>(portapack::persistent_memory::config_converter_freq() );
|
|
||||||
new_view->on_changed = [this, &button](rf::Frequency f) {
|
|
||||||
portapack::persistent_memory::set_config_converter_freq( f );
|
|
||||||
// Retune to take converter change in account
|
|
||||||
receiver_model.set_tuning_frequency( portapack::persistent_memory::tuned_frequency() );
|
|
||||||
button_converter_freq.set_text( "<" + to_string_short_freq( f ) + " MHz>" );
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
button_save.on_select = [&nav, this](Button&) {
|
|
||||||
nav.pop();
|
|
||||||
};
|
|
||||||
button_cancel.on_select = [&nav, this](Button&) {
|
|
||||||
nav.pop();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetConverterSettingsView::focus() {
|
button_converter_freq.set_text( to_string_short_freq( portapack::persistent_memory::config_converter_freq() ) + "MHz");
|
||||||
button_save.focus();
|
button_converter_freq.on_select = [this, &nav](Button& button) {
|
||||||
}
|
auto new_view = nav.push<FrequencyKeypadView>(portapack::persistent_memory::config_converter_freq() );
|
||||||
|
new_view->on_changed = [this, &button](rf::Frequency f) {
|
||||||
|
portapack::persistent_memory::set_config_converter_freq( f );
|
||||||
|
// Retune to take converter change in account
|
||||||
|
receiver_model.set_tuning_frequency( portapack::persistent_memory::tuned_frequency() );
|
||||||
|
button_converter_freq.set_text( "<" + to_string_short_freq( f ) + " MHz>" );
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
SetAudioView::SetAudioView(NavigationView& nav) {
|
button_save.on_select = [&nav, this](Button&) {
|
||||||
add_children({
|
nav.pop();
|
||||||
&labels,
|
};
|
||||||
&field_tone_mix,
|
button_cancel.on_select = [&nav, this](Button&) {
|
||||||
&button_save,
|
nav.pop();
|
||||||
&button_cancel
|
};
|
||||||
});
|
}
|
||||||
|
|
||||||
field_tone_mix.set_value(persistent_memory::tone_mix());
|
void SetConverterSettingsView::focus() {
|
||||||
|
button_save.focus();
|
||||||
button_save.on_select = [&nav, this](Button&) {
|
}
|
||||||
persistent_memory::set_tone_mix(field_tone_mix.value());
|
|
||||||
nav.pop();
|
|
||||||
};
|
|
||||||
|
|
||||||
button_cancel.on_select = [&nav, this](Button&) {
|
// ---------------------------------------------------------
|
||||||
nav.pop();
|
// Persistent Memory Settings
|
||||||
};
|
// ---------------------------------------------------------
|
||||||
}
|
SetPersistentMemoryView::SetPersistentMemoryView(NavigationView& nav) {
|
||||||
|
add_children({
|
||||||
|
&text_pmem_about,
|
||||||
|
&text_pmem_informations,
|
||||||
|
&text_pmem_status,
|
||||||
|
&check_load_mem_at_startup,
|
||||||
|
&button_save_mem_to_file,
|
||||||
|
&button_load_mem_from_file,
|
||||||
|
&button_return
|
||||||
|
});
|
||||||
|
|
||||||
void SetAudioView::focus() {
|
bool load_mem_at_startup = false ;
|
||||||
button_save.focus();
|
File pmem_flag_file_handle ;
|
||||||
}
|
std::string pmem_flag_file = "/SETTINGS/PMEM_FILEFLAG" ;
|
||||||
|
auto result = pmem_flag_file_handle.open(pmem_flag_file);
|
||||||
|
if(!result.is_valid())
|
||||||
|
{
|
||||||
|
load_mem_at_startup = true ;
|
||||||
|
}
|
||||||
|
check_load_mem_at_startup.set_value(load_mem_at_startup);
|
||||||
|
check_load_mem_at_startup.on_select = [this](Checkbox&, bool v) {
|
||||||
|
File pmem_flag_file_handle ;
|
||||||
|
std::string pmem_flag_file = "/SETTINGS/PMEM_FILEFLAG" ;
|
||||||
|
if( v )
|
||||||
|
{
|
||||||
|
auto result = pmem_flag_file_handle.open(pmem_flag_file);
|
||||||
|
if(result.is_valid())
|
||||||
|
{
|
||||||
|
auto result = pmem_flag_file_handle.create(pmem_flag_file); //third: create if it is not there
|
||||||
|
if( !result.is_valid() )
|
||||||
|
{
|
||||||
|
text_pmem_status.set("pmem flag file created");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text_pmem_status.set("!err. creating pmem flagfile!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text_pmem_status.set("pmem flag already present");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto result = delete_file( pmem_flag_file );
|
||||||
|
if( result != 0 )
|
||||||
|
{
|
||||||
|
text_pmem_status.set("!err. deleting pmem flagfile!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text_pmem_status.set("pmem flag file deleted");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
SetQRCodeView::SetQRCodeView(NavigationView& nav) {
|
button_save_mem_to_file.on_select = [&nav, this](Button&) {
|
||||||
add_children({
|
if( !portapack::persistent_memory::save_persistent_settings_to_file("SETTINGS/pmem_settings") )
|
||||||
&checkbox_bigger_qr,
|
{
|
||||||
&button_save,
|
text_pmem_status.set("!problem saving settings!");
|
||||||
&button_cancel
|
}
|
||||||
});
|
else
|
||||||
|
{
|
||||||
|
text_pmem_status.set("settings saved");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
checkbox_bigger_qr.set_value(persistent_memory::show_bigger_qr_code());
|
button_load_mem_from_file.on_select = [&nav, this](Button&) {
|
||||||
|
if( !portapack::persistent_memory::load_persistent_settings_from_file("SETTINGS/pmem_settings") )
|
||||||
button_save.on_select = [&nav, this](Button&) {
|
{
|
||||||
persistent_memory::set_show_bigger_qr_code(checkbox_bigger_qr.value());
|
text_pmem_status.set("!problem loading settings!");
|
||||||
nav.pop();
|
}
|
||||||
};
|
else
|
||||||
|
{
|
||||||
|
text_pmem_status.set("settings loaded");
|
||||||
|
//Refresh status bar with icon up or down
|
||||||
|
StatusRefreshMessage message { };
|
||||||
|
EventDispatcher::send_message(message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
button_cancel.on_select = [&nav, this](Button&) {
|
|
||||||
nav.pop();
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
button_return.on_select = [&nav, this](Button&) {
|
||||||
|
nav.pop();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
void SetQRCodeView::focus() {
|
void SetPersistentMemoryView::focus() {
|
||||||
button_save.focus();
|
button_return.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
//
|
||||||
// Settings main menu
|
// Audio settings
|
||||||
// ---------------------------------------------------------
|
//
|
||||||
SettingsMenuView::SettingsMenuView(NavigationView& nav) {
|
SetAudioView::SetAudioView(NavigationView& nav) {
|
||||||
if( portapack::persistent_memory::show_gui_return_icon() )
|
add_children({
|
||||||
{
|
&labels,
|
||||||
add_items( { { "..", ui::Color::light_grey(),&bitmap_icon_previous, [&nav](){ nav.pop(); } } } );
|
&field_tone_mix,
|
||||||
}
|
&button_save,
|
||||||
add_items({
|
&button_cancel
|
||||||
{ "Audio", ui::Color::dark_cyan(), &bitmap_icon_speaker, [&nav](){ nav.push<SetAudioView>(); } },
|
});
|
||||||
{ "Radio", ui::Color::dark_cyan(), &bitmap_icon_options_radio, [&nav](){ nav.push<SetRadioView>(); } },
|
|
||||||
{ "User Interface", ui::Color::dark_cyan(), &bitmap_icon_options_ui, [&nav](){ nav.push<SetUIView>(); } },
|
field_tone_mix.set_value(persistent_memory::tone_mix());
|
||||||
{ "Date/Time", ui::Color::dark_cyan(), &bitmap_icon_options_datetime, [&nav](){ nav.push<SetDateTimeView>(); } },
|
|
||||||
{ "Calibration", ui::Color::dark_cyan(), &bitmap_icon_options_touch, [&nav](){ nav.push<TouchCalibrationView>(); } },
|
button_save.on_select = [&nav, this](Button&) {
|
||||||
{ "App Settings", ui::Color::dark_cyan(), &bitmap_icon_setup, [&nav](){ nav.push<SetAppSettingsView>(); } },
|
persistent_memory::set_tone_mix(field_tone_mix.value());
|
||||||
{ "Converter", ui::Color::dark_cyan(), &bitmap_icon_options_radio, [&nav](){ nav.push<SetConverterSettingsView>(); } },
|
nav.pop();
|
||||||
{ "QR Code", ui::Color::dark_cyan(), &bitmap_icon_qr_code, [&nav](){ nav.push<SetQRCodeView>(); } }
|
};
|
||||||
});
|
|
||||||
set_max_rows(2); // allow wider buttons
|
button_cancel.on_select = [&nav, this](Button&) {
|
||||||
}
|
nav.pop();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetAudioView::focus() {
|
||||||
|
button_save.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
SetQRCodeView::SetQRCodeView(NavigationView& nav) {
|
||||||
|
add_children({
|
||||||
|
&checkbox_bigger_qr,
|
||||||
|
&button_save,
|
||||||
|
&button_cancel
|
||||||
|
});
|
||||||
|
|
||||||
|
checkbox_bigger_qr.set_value(persistent_memory::show_bigger_qr_code());
|
||||||
|
|
||||||
|
button_save.on_select = [&nav, this](Button&) {
|
||||||
|
persistent_memory::set_show_bigger_qr_code(checkbox_bigger_qr.value());
|
||||||
|
nav.pop();
|
||||||
|
};
|
||||||
|
|
||||||
|
button_cancel.on_select = [&nav, this](Button&) {
|
||||||
|
nav.pop();
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetQRCodeView::focus() {
|
||||||
|
button_save.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
// Settings main menu
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
SettingsMenuView::SettingsMenuView(NavigationView& nav) {
|
||||||
|
if( portapack::persistent_memory::show_gui_return_icon() )
|
||||||
|
{
|
||||||
|
add_items( { { "..", ui::Color::light_grey(),&bitmap_icon_previous, [&nav](){ nav.pop(); } } } );
|
||||||
|
}
|
||||||
|
add_items({
|
||||||
|
{ "Audio", ui::Color::dark_cyan(), &bitmap_icon_speaker, [&nav](){ nav.push<SetAudioView>(); } },
|
||||||
|
{ "Radio", ui::Color::dark_cyan(), &bitmap_icon_options_radio, [&nav](){ nav.push<SetRadioView>(); } },
|
||||||
|
{ "User Interface", ui::Color::dark_cyan(), &bitmap_icon_options_ui, [&nav](){ nav.push<SetUIView>(); } },
|
||||||
|
{ "Date/Time", ui::Color::dark_cyan(), &bitmap_icon_options_datetime, [&nav](){ nav.push<SetDateTimeView>(); } },
|
||||||
|
{ "Calibration", ui::Color::dark_cyan(), &bitmap_icon_options_touch, [&nav](){ nav.push<TouchCalibrationView>(); } },
|
||||||
|
{ "App Settings", ui::Color::dark_cyan(), &bitmap_icon_setup, [&nav](){ nav.push<SetAppSettingsView>(); } },
|
||||||
|
{ "Converter", ui::Color::dark_cyan(), &bitmap_icon_options_radio, [&nav](){ nav.push<SetConverterSettingsView>(); } },
|
||||||
|
{ "QR Code", ui::Color::dark_cyan(), &bitmap_icon_qr_code, [&nav](){ nav.push<SetQRCodeView>(); } },
|
||||||
|
{ "P.Memory Mgmt", ui::Color::dark_cyan(), &bitmap_icon_memory, [&nav](){ nav.push<SetPersistentMemoryView>(); } },
|
||||||
|
});
|
||||||
|
set_max_rows(2); // allow wider buttons
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace ui */
|
} /* namespace ui */
|
||||||
|
@ -432,6 +432,54 @@ private:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SetPersistentMemoryView : public View {
|
||||||
|
public:
|
||||||
|
SetPersistentMemoryView(NavigationView& nav);
|
||||||
|
|
||||||
|
void focus() override;
|
||||||
|
|
||||||
|
std::string title() const override { return "P.Mem Mgmt"; };
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
Text text_pmem_about {
|
||||||
|
{ 0, 1 * 16, 240 , 16 },
|
||||||
|
"PersistentMemory from/to SD"
|
||||||
|
};
|
||||||
|
|
||||||
|
Text text_pmem_informations {
|
||||||
|
{ 0, 2 * 16, 240 , 16 },
|
||||||
|
"use: when no/dead coin bat."
|
||||||
|
};
|
||||||
|
|
||||||
|
Text text_pmem_status {
|
||||||
|
{ 0, 3 * 16, 240 , 16 },
|
||||||
|
""
|
||||||
|
};
|
||||||
|
|
||||||
|
Checkbox check_load_mem_at_startup {
|
||||||
|
{ 18, 6 * 16},
|
||||||
|
19,
|
||||||
|
"load from sd at startup"
|
||||||
|
};
|
||||||
|
|
||||||
|
Button button_save_mem_to_file {
|
||||||
|
{ 0, 9 * 16, 240, 32 },
|
||||||
|
"save p.mem to sdcard"
|
||||||
|
};
|
||||||
|
|
||||||
|
Button button_load_mem_from_file {
|
||||||
|
{ 0, 12 * 16, 240, 32 },
|
||||||
|
"load p.mem from sdcard"
|
||||||
|
};
|
||||||
|
|
||||||
|
Button button_return {
|
||||||
|
{ 16 * 8, 16 * 16, 12 * 8, 32 },
|
||||||
|
"Return",
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class SettingsMenuView : public BtnGridView {
|
class SettingsMenuView : public BtnGridView {
|
||||||
public:
|
public:
|
||||||
SettingsMenuView(NavigationView& nav);
|
SettingsMenuView(NavigationView& nav);
|
||||||
|
@ -722,6 +722,14 @@ SystemView::SystemView(
|
|||||||
|
|
||||||
navigation_view.push<SystemMenuView>();
|
navigation_view.push<SystemMenuView>();
|
||||||
|
|
||||||
|
File pmem_flag_file_handle ;
|
||||||
|
std::string pmem_flag_file = "/SETTINGS/PMEM_FILEFLAG" ;
|
||||||
|
auto result = pmem_flag_file_handle.open(pmem_flag_file);
|
||||||
|
if(!result.is_valid())
|
||||||
|
{
|
||||||
|
portapack::persistent_memory::load_persistent_settings_from_file("SETTINGS/pmem_settings");
|
||||||
|
}
|
||||||
|
|
||||||
if (portapack::persistent_memory::config_splash())
|
if (portapack::persistent_memory::config_splash())
|
||||||
{
|
{
|
||||||
navigation_view.push<BMPView>();
|
navigation_view.push<BMPView>();
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -36,187 +36,193 @@ using namespace modems;
|
|||||||
using namespace serializer;
|
using namespace serializer;
|
||||||
|
|
||||||
namespace portapack {
|
namespace portapack {
|
||||||
namespace persistent_memory {
|
|
||||||
|
|
||||||
enum backlight_timeout_t {
|
namespace persistent_memory {
|
||||||
Timeout5Sec = 0,
|
|
||||||
Timeout15Sec = 1,
|
|
||||||
Timeout30Sec = 2,
|
|
||||||
Timeout60Sec = 3,
|
|
||||||
Timeout180Sec = 4,
|
|
||||||
Timeout300Sec = 5,
|
|
||||||
Timeout600Sec = 6,
|
|
||||||
Timeout3600Sec = 7,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct backlight_config_t {
|
enum backlight_timeout_t {
|
||||||
public:
|
Timeout5Sec = 0,
|
||||||
backlight_config_t() :
|
Timeout15Sec = 1,
|
||||||
_timeout_enum(backlight_timeout_t::Timeout600Sec),
|
Timeout30Sec = 2,
|
||||||
_timeout_enabled(false)
|
Timeout60Sec = 3,
|
||||||
{
|
Timeout180Sec = 4,
|
||||||
}
|
Timeout300Sec = 5,
|
||||||
|
Timeout600Sec = 6,
|
||||||
|
Timeout3600Sec = 7,
|
||||||
|
};
|
||||||
|
|
||||||
backlight_config_t(
|
struct backlight_config_t {
|
||||||
backlight_timeout_t timeout_enum,
|
public:
|
||||||
bool timeout_enabled
|
backlight_config_t() :
|
||||||
) :
|
_timeout_enum(backlight_timeout_t::Timeout600Sec),
|
||||||
_timeout_enum(timeout_enum),
|
_timeout_enabled(false)
|
||||||
_timeout_enabled(timeout_enabled)
|
{
|
||||||
{
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool timeout_enabled() const {
|
backlight_config_t(
|
||||||
return _timeout_enabled;
|
backlight_timeout_t timeout_enum,
|
||||||
}
|
bool timeout_enabled
|
||||||
|
) :
|
||||||
|
_timeout_enum(timeout_enum),
|
||||||
|
_timeout_enabled(timeout_enabled)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
backlight_timeout_t timeout_enum() const {
|
bool timeout_enabled() const {
|
||||||
return _timeout_enum;
|
return _timeout_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t timeout_seconds() const {
|
backlight_timeout_t timeout_enum() const {
|
||||||
switch(timeout_enum()) {
|
return _timeout_enum;
|
||||||
case Timeout5Sec: return 5;
|
}
|
||||||
case Timeout15Sec: return 15;
|
|
||||||
case Timeout30Sec: return 30;
|
|
||||||
case Timeout60Sec: return 60;
|
|
||||||
case Timeout180Sec: return 180;
|
|
||||||
case Timeout300Sec: return 300;
|
|
||||||
default:
|
|
||||||
case Timeout600Sec: return 600;
|
|
||||||
case Timeout3600Sec: return 3600;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
uint32_t timeout_seconds() const {
|
||||||
backlight_timeout_t _timeout_enum;
|
switch(timeout_enum()) {
|
||||||
bool _timeout_enabled;
|
case Timeout5Sec: return 5;
|
||||||
};
|
case Timeout15Sec: return 15;
|
||||||
|
case Timeout30Sec: return 30;
|
||||||
|
case Timeout60Sec: return 60;
|
||||||
|
case Timeout180Sec: return 180;
|
||||||
|
case Timeout300Sec: return 300;
|
||||||
|
default:
|
||||||
|
case Timeout600Sec: return 600;
|
||||||
|
case Timeout3600Sec: return 3600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace cache {
|
private:
|
||||||
|
backlight_timeout_t _timeout_enum;
|
||||||
|
bool _timeout_enabled;
|
||||||
|
};
|
||||||
|
|
||||||
/* Set values in cache to sensible defaults. */
|
namespace cache {
|
||||||
void defaults();
|
|
||||||
|
|
||||||
/* Load cached settings from values in persistent RAM, replacing with defaults
|
/* Set values in cache to sensible defaults. */
|
||||||
* if persistent RAM contents appear to be invalid. */
|
void defaults();
|
||||||
void init();
|
|
||||||
|
|
||||||
/* Calculate a check value for cached settings, and copy the check value and
|
/* Load cached settings from values in persistent RAM, replacing with defaults
|
||||||
* settings into persistent RAM. Intended to be called periodically to update
|
* if persistent RAM contents appear to be invalid. */
|
||||||
* persistent settings with current settings. */
|
void init();
|
||||||
void persist();
|
|
||||||
|
|
||||||
} /* namespace cache */
|
/* Calculate a check value for cached settings, and copy the check value and
|
||||||
|
* settings into persistent RAM. Intended to be called periodically to update
|
||||||
|
* persistent settings with current settings. */
|
||||||
|
void persist();
|
||||||
|
|
||||||
using ppb_t = int32_t;
|
} /* namespace cache */
|
||||||
|
|
||||||
rf::Frequency tuned_frequency();
|
using ppb_t = int32_t;
|
||||||
void set_tuned_frequency(const rf::Frequency new_value);
|
|
||||||
|
|
||||||
ppb_t correction_ppb();
|
rf::Frequency tuned_frequency();
|
||||||
void set_correction_ppb(const ppb_t new_value);
|
void set_tuned_frequency(const rf::Frequency new_value);
|
||||||
|
|
||||||
void set_touch_calibration(const touch::Calibration& new_value);
|
ppb_t correction_ppb();
|
||||||
const touch::Calibration& touch_calibration();
|
void set_correction_ppb(const ppb_t new_value);
|
||||||
|
|
||||||
serial_format_t serial_format();
|
void set_touch_calibration(const touch::Calibration& new_value);
|
||||||
void set_serial_format(const serial_format_t new_value);
|
const touch::Calibration& touch_calibration();
|
||||||
|
|
||||||
int32_t tone_mix();
|
serial_format_t serial_format();
|
||||||
void set_tone_mix(const int32_t new_value);
|
void set_serial_format(const serial_format_t new_value);
|
||||||
|
|
||||||
int32_t afsk_mark_freq();
|
int32_t tone_mix();
|
||||||
void set_afsk_mark(const int32_t new_value);
|
void set_tone_mix(const int32_t new_value);
|
||||||
|
|
||||||
int32_t afsk_space_freq();
|
int32_t afsk_mark_freq();
|
||||||
void set_afsk_space(const int32_t new_value);
|
void set_afsk_mark(const int32_t new_value);
|
||||||
|
|
||||||
int32_t modem_baudrate();
|
int32_t afsk_space_freq();
|
||||||
void set_modem_baudrate(const int32_t new_value);
|
void set_afsk_space(const int32_t new_value);
|
||||||
|
|
||||||
uint8_t modem_repeat();
|
int32_t modem_baudrate();
|
||||||
void set_modem_repeat(const uint32_t new_value);
|
void set_modem_baudrate(const int32_t new_value);
|
||||||
|
|
||||||
uint32_t playing_dead();
|
uint8_t modem_repeat();
|
||||||
void set_playing_dead(const uint32_t new_value);
|
void set_modem_repeat(const uint32_t new_value);
|
||||||
|
|
||||||
uint32_t playdead_sequence();
|
uint32_t playing_dead();
|
||||||
void set_playdead_sequence(const uint32_t new_value);
|
void set_playing_dead(const uint32_t new_value);
|
||||||
|
|
||||||
bool stealth_mode();
|
uint32_t playdead_sequence();
|
||||||
void set_stealth_mode(const bool v);
|
void set_playdead_sequence(const uint32_t new_value);
|
||||||
|
|
||||||
uint8_t config_cpld();
|
bool stealth_mode();
|
||||||
void set_config_cpld(uint8_t i);
|
void set_stealth_mode(const bool v);
|
||||||
|
|
||||||
bool config_splash();
|
uint8_t config_cpld();
|
||||||
bool config_hide_converter();
|
void set_config_cpld(uint8_t i);
|
||||||
bool config_converter();
|
|
||||||
bool config_updown_converter();
|
|
||||||
int64_t config_converter_freq();
|
|
||||||
bool show_gui_return_icon();
|
|
||||||
bool load_app_settings();
|
|
||||||
bool save_app_settings();
|
|
||||||
bool show_bigger_qr_code();
|
|
||||||
bool hide_clock();
|
|
||||||
bool clock_with_date();
|
|
||||||
bool config_login();
|
|
||||||
bool config_speaker();
|
|
||||||
backlight_config_t config_backlight_timer();
|
|
||||||
bool disable_touchscreen();
|
|
||||||
|
|
||||||
void set_gui_return_icon(bool v);
|
bool config_splash();
|
||||||
void set_load_app_settings(bool v);
|
bool config_hide_converter();
|
||||||
void set_save_app_settings(bool v);
|
bool config_converter();
|
||||||
void set_show_bigger_qr_code(bool v);
|
bool config_updown_converter();
|
||||||
void set_config_splash(bool v);
|
int64_t config_converter_freq();
|
||||||
void set_config_hide_converter(bool v);
|
bool show_gui_return_icon();
|
||||||
void set_config_converter(bool v);
|
bool load_app_settings();
|
||||||
void set_config_updown_converter(const bool v);
|
bool save_app_settings();
|
||||||
void set_config_converter_freq(const int64_t v );
|
bool show_bigger_qr_code();
|
||||||
void set_clock_hidden(bool v);
|
bool hide_clock();
|
||||||
void set_clock_with_date(bool v);
|
bool clock_with_date();
|
||||||
void set_config_login(bool v);
|
bool config_login();
|
||||||
void set_config_speaker(bool v);
|
bool config_speaker();
|
||||||
void set_config_backlight_timer(const backlight_config_t& new_value);
|
backlight_config_t config_backlight_timer();
|
||||||
void set_disable_touchscreen(bool v);
|
bool disable_touchscreen();
|
||||||
|
|
||||||
//uint8_t ui_config_textentry();
|
void set_gui_return_icon(bool v);
|
||||||
//void set_config_textentry(uint8_t new_value);
|
void set_load_app_settings(bool v);
|
||||||
|
void set_save_app_settings(bool v);
|
||||||
|
void set_show_bigger_qr_code(bool v);
|
||||||
|
void set_config_splash(bool v);
|
||||||
|
void set_config_hide_converter(bool v);
|
||||||
|
void set_config_converter(bool v);
|
||||||
|
void set_config_updown_converter(const bool v);
|
||||||
|
void set_config_converter_freq(const int64_t v );
|
||||||
|
void set_clock_hidden(bool v);
|
||||||
|
void set_clock_with_date(bool v);
|
||||||
|
void set_config_login(bool v);
|
||||||
|
void set_config_speaker(bool v);
|
||||||
|
void set_config_backlight_timer(const backlight_config_t& new_value);
|
||||||
|
void set_disable_touchscreen(bool v);
|
||||||
|
|
||||||
uint32_t pocsag_last_address();
|
//uint8_t ui_config_textentry();
|
||||||
void set_pocsag_last_address(uint32_t address);
|
//void set_config_textentry(uint8_t new_value);
|
||||||
|
|
||||||
uint32_t pocsag_ignore_address();
|
uint32_t pocsag_last_address();
|
||||||
void set_pocsag_ignore_address(uint32_t address);
|
void set_pocsag_last_address(uint32_t address);
|
||||||
|
|
||||||
bool clkout_enabled();
|
uint32_t pocsag_ignore_address();
|
||||||
void set_clkout_enabled(bool v);
|
void set_pocsag_ignore_address(uint32_t address);
|
||||||
uint32_t clkout_freq();
|
|
||||||
void set_clkout_freq(uint32_t freq);
|
|
||||||
|
|
||||||
/* Recon app */
|
bool clkout_enabled();
|
||||||
bool recon_autosave_freqs();
|
void set_clkout_enabled(bool v);
|
||||||
bool recon_autostart_recon();
|
uint32_t clkout_freq();
|
||||||
bool recon_continuous();
|
void set_clkout_freq(uint32_t freq);
|
||||||
bool recon_clear_output();
|
|
||||||
bool recon_load_freqs();
|
/* Recon app */
|
||||||
bool recon_load_ranges();
|
bool recon_autosave_freqs();
|
||||||
bool recon_update_ranges_when_recon();
|
bool recon_autostart_recon();
|
||||||
bool recon_load_hamradios();
|
bool recon_continuous();
|
||||||
bool recon_match_mode();
|
bool recon_clear_output();
|
||||||
void set_recon_autosave_freqs(const bool v);
|
bool recon_load_freqs();
|
||||||
void set_recon_autostart_recon(const bool v);
|
bool recon_load_ranges();
|
||||||
void set_recon_continuous(const bool v);
|
bool recon_update_ranges_when_recon();
|
||||||
void set_recon_clear_output(const bool v);
|
bool recon_load_hamradios();
|
||||||
void set_recon_load_freqs(const bool v);
|
bool recon_match_mode();
|
||||||
void set_recon_load_ranges(const bool v);
|
void set_recon_autosave_freqs(const bool v);
|
||||||
void set_recon_update_ranges_when_recon(const bool v);
|
void set_recon_autostart_recon(const bool v);
|
||||||
void set_recon_load_hamradios(const bool v );
|
void set_recon_continuous(const bool v);
|
||||||
void set_recon_match_mode( const bool v );
|
void set_recon_clear_output(const bool v);
|
||||||
|
void set_recon_load_freqs(const bool v);
|
||||||
|
void set_recon_load_ranges(const bool v);
|
||||||
|
void set_recon_update_ranges_when_recon(const bool v);
|
||||||
|
void set_recon_load_hamradios(const bool v );
|
||||||
|
void set_recon_match_mode( const bool v );
|
||||||
|
|
||||||
|
// sd persisting settings
|
||||||
|
int save_persistent_settings_to_file( std::string filename );
|
||||||
|
int load_persistent_settings_from_file( std::string filename );
|
||||||
|
|
||||||
|
} /* namespace persistent_memory */
|
||||||
|
|
||||||
} /* namespace persistent_memory */
|
|
||||||
} /* namespace portapack */
|
} /* namespace portapack */
|
||||||
|
|
||||||
#endif/*__PORTAPACK_PERSISTENT_MEMORY_H__*/
|
#endif/*__PORTAPACK_PERSISTENT_MEMORY_H__*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user