mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-15 00:27:40 +00:00
Radio state initialization (#1236)
* WIP RadioState init * TX/RX cleanup * Update all apps using RadioState and setting modulation mode * Set apps to use AM mode * Don't push modulation update in RadioState. * Support passing overrides to Audio and MicTX * Support set_nearest on OptionsField, fix recon step * Fix audio, typo --------- Co-authored-by: kallanreed <kylereed@manzana.lan> Co-authored-by: kallanreed <kallanreed@noreply.github.com>
This commit is contained in:
@@ -1001,8 +1001,6 @@ bool debug_dump() {
|
||||
// transmitter_model
|
||||
pmem_dump_file.write_line("\n[Transmitter Model]");
|
||||
pmem_dump_file.write_line("target_frequency: " + to_string_dec_uint(transmitter_model.target_frequency()));
|
||||
pmem_dump_file.write_line("lna: " + to_string_dec_int(transmitter_model.lna()));
|
||||
pmem_dump_file.write_line("vga: " + to_string_dec_int(transmitter_model.vga()));
|
||||
pmem_dump_file.write_line("rf_amp: " + to_string_dec_int(transmitter_model.rf_amp()));
|
||||
pmem_dump_file.write_line("baseband_bandwidth: " + to_string_dec_uint(transmitter_model.baseband_bandwidth()));
|
||||
pmem_dump_file.write_line("sampling_rate: " + to_string_dec_uint(transmitter_model.sampling_rate()));
|
||||
|
@@ -1524,6 +1524,24 @@ void OptionsField::set_by_value(value_t v) {
|
||||
set_selected_index(0);
|
||||
}
|
||||
|
||||
void OptionsField::set_by_nearest_value(value_t v) {
|
||||
size_t new_index = 0;
|
||||
size_t curr_index = 0;
|
||||
int32_t min_diff = INT32_MAX;
|
||||
|
||||
for (const auto& option : options) {
|
||||
auto diff = abs(v - option.second);
|
||||
if (diff < min_diff) {
|
||||
min_diff = diff;
|
||||
new_index = curr_index;
|
||||
}
|
||||
|
||||
curr_index++;
|
||||
}
|
||||
|
||||
set_selected_index(new_index);
|
||||
}
|
||||
|
||||
void OptionsField::set_options(options_t new_options) {
|
||||
options = new_options;
|
||||
|
||||
|
@@ -624,6 +624,7 @@ class OptionsField : public Widget {
|
||||
void set_selected_index(const size_t new_index, bool trigger_change = true);
|
||||
|
||||
void set_by_value(value_t v);
|
||||
void set_by_nearest_value(value_t v);
|
||||
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
|
Reference in New Issue
Block a user