mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-15 01:57:50 +00:00
Added support for multiple sample rates in IQ record
Support for any sample rate <= 500k in IQ replay Fixed bias-t power not activating in TX Removed RSSI pitch output option (awful code) Udated binary
This commit is contained in:
@@ -35,6 +35,7 @@ CaptureAppView::CaptureAppView(NavigationView& nav) {
|
||||
baseband::run_image(portapack::spi_flash::image_tag_capture);
|
||||
|
||||
add_children({
|
||||
&labels,
|
||||
&rssi,
|
||||
&channel,
|
||||
&field_frequency,
|
||||
@@ -42,6 +43,7 @@ CaptureAppView::CaptureAppView(NavigationView& nav) {
|
||||
&field_rf_amp,
|
||||
&field_lna,
|
||||
&field_vga,
|
||||
&option_bandwidth,
|
||||
&record_view,
|
||||
&waterfall,
|
||||
});
|
||||
@@ -65,6 +67,16 @@ CaptureAppView::CaptureAppView(NavigationView& nav) {
|
||||
receiver_model.set_frequency_step(v);
|
||||
this->field_frequency.set_step(v);
|
||||
};
|
||||
|
||||
option_bandwidth.on_change = [this](size_t, uint32_t divider) {
|
||||
sampling_rate = 4000000 / divider;
|
||||
|
||||
waterfall.on_hide();
|
||||
set_target_frequency(target_frequency());
|
||||
record_view.set_sampling_rate(sampling_rate);
|
||||
radio::set_baseband_rate(sampling_rate);
|
||||
waterfall.on_show();
|
||||
};
|
||||
|
||||
radio::enable({
|
||||
tuning_frequency(),
|
||||
@@ -75,8 +87,9 @@ CaptureAppView::CaptureAppView(NavigationView& nav) {
|
||||
static_cast<int8_t>(receiver_model.lna()),
|
||||
static_cast<int8_t>(receiver_model.vga()),
|
||||
});
|
||||
|
||||
option_bandwidth.set_selected_index(4); // 500k
|
||||
|
||||
record_view.set_sampling_rate(sampling_rate / 8);
|
||||
record_view.on_error = [&nav](std::string message) {
|
||||
nav.display_modal("Error", message);
|
||||
};
|
||||
|
@@ -47,9 +47,9 @@ public:
|
||||
std::string title() const override { return "Capture"; };
|
||||
|
||||
private:
|
||||
static constexpr ui::Dim header_height = 2 * 16;
|
||||
static constexpr ui::Dim header_height = 3 * 16;
|
||||
|
||||
static constexpr uint32_t sampling_rate = 4000000;
|
||||
uint32_t sampling_rate = 0;
|
||||
static constexpr uint32_t baseband_bandwidth = 2500000;
|
||||
|
||||
void on_target_frequency_changed(rf::Frequency f);
|
||||
@@ -59,6 +59,10 @@ private:
|
||||
|
||||
rf::Frequency tuning_frequency() const;
|
||||
|
||||
Labels labels {
|
||||
{ { 0 * 8, 1 * 16 }, "Rate:", Color::light_grey() },
|
||||
};
|
||||
|
||||
RSSI rssi {
|
||||
{ 24 * 8, 0, 6 * 8, 4 },
|
||||
};
|
||||
@@ -87,8 +91,20 @@ private:
|
||||
{ 21 * 8, 0 * 16 }
|
||||
};
|
||||
|
||||
OptionsField option_bandwidth {
|
||||
{ 5 * 8, 1 * 16 },
|
||||
4,
|
||||
{
|
||||
{ " 25k", 20 },
|
||||
{ " 50k", 10 },
|
||||
{ "100k", 5 },
|
||||
{ "250k", 2 },
|
||||
{ "500k", 1 }
|
||||
}
|
||||
};
|
||||
|
||||
RecordView record_view {
|
||||
{ 0 * 8, 1 * 16, 30 * 8, 1 * 16 },
|
||||
{ 0 * 8, 2 * 16, 30 * 8, 1 * 16 },
|
||||
u"BBD_????", RecordView::FileType::RawS16, 16384, 3
|
||||
};
|
||||
|
||||
|
@@ -51,30 +51,40 @@ void ReplayAppView::on_file_changed(std::filesystem::path new_file_path) {
|
||||
|
||||
file_path = new_file_path;
|
||||
|
||||
auto file_size = data_file.size();
|
||||
auto duration = (file_size * 1000) / (2 * 2 * sampling_rate / 8);
|
||||
|
||||
progressbar.set_max(file_size);
|
||||
text_filename.set(file_path.filename().string().substr(0, 19));
|
||||
text_duration.set(to_string_time_ms(duration));
|
||||
|
||||
// Get original record frequency if available
|
||||
std::filesystem::path info_file_path = file_path;
|
||||
info_file_path.replace_extension(u".TXT");
|
||||
|
||||
sample_rate = 500000;
|
||||
|
||||
auto info_open_error = info_file.open("/" + info_file_path.string());
|
||||
if (!info_open_error.is_valid()) {
|
||||
memset(file_data, 0, 257);
|
||||
auto read_size = info_file.read(file_data, 256);
|
||||
if (!read_size.is_error()) {
|
||||
auto pos = strstr(file_data, "center_frequency=");
|
||||
if (pos) {
|
||||
pos += 17;
|
||||
field_frequency.set_value(strtoll(pos, nullptr, 10));
|
||||
auto pos1 = strstr(file_data, "center_frequency=");
|
||||
if (pos1) {
|
||||
pos1 += 17;
|
||||
field_frequency.set_value(strtoll(pos1, nullptr, 10));
|
||||
}
|
||||
|
||||
auto pos2 = strstr(file_data, "sample_rate=");
|
||||
if (pos2) {
|
||||
pos2 += 12;
|
||||
sample_rate = strtoll(pos2, nullptr, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
text_sample_rate.set(unit_auto_scale(sample_rate, 3, 0) + "Hz");
|
||||
|
||||
auto file_size = data_file.size();
|
||||
auto duration = (file_size * 1000) / (2 * 2 * sample_rate);
|
||||
|
||||
progressbar.set_max(file_size);
|
||||
text_filename.set(file_path.filename().string().substr(0, 12));
|
||||
text_duration.set(to_string_time_ms(duration));
|
||||
|
||||
button_play.focus();
|
||||
}
|
||||
|
||||
@@ -117,6 +127,8 @@ void ReplayAppView::start() {
|
||||
|
||||
if( reader ) {
|
||||
button_play.set_bitmap(&bitmap_stop);
|
||||
baseband::set_sample_rate(sample_rate * 8);
|
||||
|
||||
replay_thread = std::make_unique<ReplayThread>(
|
||||
std::move(reader),
|
||||
read_size, buffer_count,
|
||||
@@ -130,7 +142,7 @@ void ReplayAppView::start() {
|
||||
|
||||
radio::enable({
|
||||
receiver_model.tuning_frequency(),
|
||||
sampling_rate,
|
||||
sample_rate * 8 ,
|
||||
baseband_bandwidth,
|
||||
rf::Direction::Transmit,
|
||||
receiver_model.rf_amp(),
|
||||
@@ -172,6 +184,7 @@ ReplayAppView::ReplayAppView(
|
||||
&labels,
|
||||
&button_open,
|
||||
&text_filename,
|
||||
&text_sample_rate,
|
||||
&text_duration,
|
||||
&progressbar,
|
||||
&field_frequency,
|
||||
|
@@ -50,7 +50,7 @@ private:
|
||||
|
||||
static constexpr ui::Dim header_height = 3 * 16;
|
||||
|
||||
static constexpr uint32_t sampling_rate = 4000000;
|
||||
uint32_t sample_rate = 0;
|
||||
static constexpr uint32_t baseband_bandwidth = 2500000;
|
||||
const size_t read_size { 16384 };
|
||||
const size_t buffer_count { 3 };
|
||||
@@ -76,7 +76,6 @@ private:
|
||||
|
||||
Labels labels {
|
||||
{ { 10 * 8, 2 * 16 }, "LNA: A:", Color::light_grey() }
|
||||
//{ { 10 * 8, 2 * 16 }, "500ksps", Color::light_grey() }
|
||||
};
|
||||
|
||||
Button button_open {
|
||||
@@ -85,9 +84,14 @@ private:
|
||||
};
|
||||
|
||||
Text text_filename {
|
||||
{ 11 * 8, 0 * 16, 19 * 8, 16 },
|
||||
{ 11 * 8, 0 * 16, 12 * 8, 16 },
|
||||
"-"
|
||||
};
|
||||
Text text_sample_rate {
|
||||
{ 24 * 8, 0 * 16, 6 * 8, 16 },
|
||||
"-"
|
||||
};
|
||||
|
||||
Text text_duration {
|
||||
{ 11 * 8, 1 * 16, 6 * 8, 16 },
|
||||
"-"
|
||||
|
@@ -97,7 +97,7 @@ private:
|
||||
{ 1 * 8, " Windyoona Channels", 0 },
|
||||
{ 1 * 8, " F4GEV Pyr3x", 0 },
|
||||
{ 1 * 8, " HB3YOE", 24 },
|
||||
{ 12 * 8, "MMXVII", -1 }
|
||||
{ 11 * 8, "MMXVIII", -1 }
|
||||
};
|
||||
|
||||
CreditsWidget credits_display {
|
||||
|
@@ -135,9 +135,9 @@ SetRadioView::SetRadioView(
|
||||
|
||||
form_init(model);
|
||||
|
||||
check_bias.set_value(receiver_model.antenna_bias());
|
||||
check_bias.set_value(portapack::get_antenna_bias());
|
||||
check_bias.on_select = [this](Checkbox&, bool v) {
|
||||
receiver_model.set_antenna_bias(v);
|
||||
portapack::set_antenna_bias(v);
|
||||
StatusRefreshMessage message { };
|
||||
EventDispatcher::send_message(message);
|
||||
};
|
||||
|
Reference in New Issue
Block a user