mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Gps default frequency (#1309)
* Default frequency * Default frequency * Use sample rate from .ini file if present * Eliminate unneeded sampling_rate variable * Eliminate unneeded sampling_rate variable
This commit is contained in:
parent
195a6224a0
commit
37aa9c046f
@ -63,17 +63,15 @@ void GpsSimAppView::on_file_changed(const fs::path& new_file_path) {
|
|||||||
|
|
||||||
if (metadata) {
|
if (metadata) {
|
||||||
field_frequency.set_value(metadata->center_frequency);
|
field_frequency.set_value(metadata->center_frequency);
|
||||||
sample_rate = metadata->sample_rate;
|
transmitter_model.set_sampling_rate(metadata->sample_rate);
|
||||||
} else {
|
|
||||||
sample_rate = 2600000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UI Fixup.
|
// UI Fixup.
|
||||||
text_sample_rate.set(unit_auto_scale(sample_rate, 3, 1) + "Hz");
|
text_sample_rate.set(unit_auto_scale(transmitter_model.sampling_rate(), 3, 1) + "Hz");
|
||||||
progressbar.set_max(file_size);
|
progressbar.set_max(file_size);
|
||||||
text_filename.set(truncate(file_path.filename().string(), 12));
|
text_filename.set(truncate(file_path.filename().string(), 12));
|
||||||
|
|
||||||
auto duration = ms_duration(file_size, sample_rate, 2);
|
auto duration = ms_duration(file_size, transmitter_model.sampling_rate(), 2);
|
||||||
text_duration.set(to_string_time_ms(duration));
|
text_duration.set(to_string_time_ms(duration));
|
||||||
|
|
||||||
button_play.focus();
|
button_play.focus();
|
||||||
@ -129,7 +127,6 @@ void GpsSimAppView::start() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
transmitter_model.set_sampling_rate(sample_rate);
|
|
||||||
transmitter_model.enable();
|
transmitter_model.enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,6 +173,11 @@ GpsSimAppView::GpsSimAppView(
|
|||||||
&waterfall,
|
&waterfall,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!settings_.loaded()) {
|
||||||
|
field_frequency.set_value(initial_target_frequency);
|
||||||
|
transmitter_model.set_sampling_rate(2600000);
|
||||||
|
}
|
||||||
|
|
||||||
field_frequency.set_step(5000);
|
field_frequency.set_step(5000);
|
||||||
|
|
||||||
button_play.on_select = [this](ImageButton&) {
|
button_play.on_select = [this](ImageButton&) {
|
||||||
|
@ -54,6 +54,8 @@ class GpsSimAppView : public View {
|
|||||||
std::string title() const override { return "GPS Sim TX"; };
|
std::string title() const override { return "GPS Sim TX"; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static constexpr uint32_t initial_target_frequency = 1575420000;
|
||||||
|
|
||||||
NavigationView& nav_;
|
NavigationView& nav_;
|
||||||
RxRadioState radio_state_{
|
RxRadioState radio_state_{
|
||||||
3000000 /* bandwidth */,
|
3000000 /* bandwidth */,
|
||||||
@ -64,7 +66,6 @@ class GpsSimAppView : public View {
|
|||||||
|
|
||||||
static constexpr ui::Dim header_height = 3 * 16;
|
static constexpr ui::Dim header_height = 3 * 16;
|
||||||
|
|
||||||
uint32_t sample_rate = 0;
|
|
||||||
int32_t tx_gain{47};
|
int32_t tx_gain{47};
|
||||||
bool rf_amp{true}; // aux private var to store temporal, same as Replay App rf_amp user selection.
|
bool rf_amp{true}; // aux private var to store temporal, same as Replay App rf_amp user selection.
|
||||||
static constexpr uint32_t baseband_bandwidth = 3000000; // filter bandwidth
|
static constexpr uint32_t baseband_bandwidth = 3000000; // filter bandwidth
|
||||||
|
Loading…
Reference in New Issue
Block a user