Formatted code (#1007)

* Updated style

* Updated files

* fixed new line

* Updated spacing

* File fix WIP

* Updated to clang 13

* updated comment style

* Removed old comment code
This commit is contained in:
jLynx 2023-05-19 08:16:05 +12:00 committed by GitHub
parent 7aca7ce74d
commit 033c4e9a5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
599 changed files with 70746 additions and 66896 deletions

View file

@ -34,110 +34,103 @@ using namespace portapack;
namespace ui {
void SigGenView::focus() {
options_shape.focus();
options_shape.focus();
}
SigGenView::~SigGenView() {
transmitter_model.disable();
baseband::shutdown();
transmitter_model.disable();
baseband::shutdown();
}
void SigGenView::update_config() {
if(checkbox_stop.value())
baseband::set_siggen_config(transmitter_model.channel_bandwidth(), options_shape.selected_index_value(), field_stop.value());
else
baseband::set_siggen_config(transmitter_model.channel_bandwidth(), options_shape.selected_index_value(), 0);
if (checkbox_stop.value())
baseband::set_siggen_config(transmitter_model.channel_bandwidth(), options_shape.selected_index_value(), field_stop.value());
else
baseband::set_siggen_config(transmitter_model.channel_bandwidth(), options_shape.selected_index_value(), 0);
}
void SigGenView::update_tone() {
baseband::set_siggen_tone(symfield_tone.value_dec_u32());
baseband::set_siggen_tone(symfield_tone.value_dec_u32());
}
void SigGenView::start_tx() {
transmitter_model.set_sampling_rate(1536000);
// transmitter_model.set_rf_amp(true);
transmitter_model.set_baseband_bandwidth(1750000);
transmitter_model.enable();
update_tone();
/*auto duration = field_stop.value();
if (!checkbox_auto.value())
duration = 0;*/
update_config();
transmitter_model.set_sampling_rate(1536000);
// transmitter_model.set_rf_amp(true);
transmitter_model.set_baseband_bandwidth(1750000);
transmitter_model.enable();
update_tone();
/*auto duration = field_stop.value();
if (!checkbox_auto.value())
duration = 0;*/
update_config();
}
void SigGenView::on_tx_progress(const uint32_t progress, const bool done) {
(void) progress;
if (done) {
transmitter_model.disable();
tx_view.set_transmitting(false);
}
(void)progress;
if (done) {
transmitter_model.disable();
tx_view.set_transmitting(false);
}
}
SigGenView::SigGenView(
NavigationView& nav
)
{
baseband::run_image(portapack::spi_flash::image_tag_siggen);
add_children({
&labels,
&options_shape,
&text_shape,
&symfield_tone,
&button_update,
&checkbox_auto,
&checkbox_stop,
&field_stop,
&tx_view
});
options_shape.on_change = [this](size_t, OptionsField::value_t v) {
text_shape.set(shape_strings[v]);
if (auto_update)
update_config();
};
options_shape.set_selected_index(0);
text_shape.set(shape_strings[0]);
field_stop.set_value(1);
symfield_tone.set_sym(1, 1); // Default: 1000 Hz
symfield_tone.on_change = [this]() {
if (auto_update)
update_tone();
};
button_update.on_select = [this](Button&) {
update_tone();
update_config();
};
checkbox_auto.on_select = [this](Checkbox&, bool v) {
auto_update = v;
};
tx_view.on_edit_frequency = [this, &nav]() {
auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency());
new_view->on_changed = [this](rf::Frequency f) {
receiver_model.set_tuning_frequency(f);
};
};
tx_view.on_start = [this]() {
start_tx();
tx_view.set_transmitting(true);
};
tx_view.on_stop = [this]() {
transmitter_model.disable();
tx_view.set_transmitting(false);
};
NavigationView& nav) {
baseband::run_image(portapack::spi_flash::image_tag_siggen);
add_children({&labels,
&options_shape,
&text_shape,
&symfield_tone,
&button_update,
&checkbox_auto,
&checkbox_stop,
&field_stop,
&tx_view});
options_shape.on_change = [this](size_t, OptionsField::value_t v) {
text_shape.set(shape_strings[v]);
if (auto_update)
update_config();
};
options_shape.set_selected_index(0);
text_shape.set(shape_strings[0]);
field_stop.set_value(1);
symfield_tone.set_sym(1, 1); // Default: 1000 Hz
symfield_tone.on_change = [this]() {
if (auto_update)
update_tone();
};
button_update.on_select = [this](Button&) {
update_tone();
update_config();
};
checkbox_auto.on_select = [this](Checkbox&, bool v) {
auto_update = v;
};
tx_view.on_edit_frequency = [this, &nav]() {
auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency());
new_view->on_changed = [this](rf::Frequency f) {
receiver_model.set_tuning_frequency(f);
};
};
tx_view.on_start = [this]() {
start_tx();
tx_view.set_transmitting(true);
};
tx_view.on_stop = [this]() {
transmitter_model.disable();
tx_view.set_transmitting(false);
};
}
} /* namespace ui */