diff --git a/firmware/application/apps/ui_fileman.cpp b/firmware/application/apps/ui_fileman.cpp index 9aad8515..e37f945b 100644 --- a/firmware/application/apps/ui_fileman.cpp +++ b/firmware/application/apps/ui_fileman.cpp @@ -30,6 +30,7 @@ #include "ui_remote.hpp" #include "ui_ss_viewer.hpp" #include "ui_text_editor.hpp" +#include "ui_iq_trim.hpp" #include "string_format.hpp" #include "portapack.hpp" #include "event_m0.hpp" @@ -566,6 +567,7 @@ FileManagerView::FileManagerView( &button_new_file, &button_open_notepad, &button_rename_timestamp, + &button_open_iq_trim, }); menu_view.on_highlight = [this]() { @@ -648,6 +650,14 @@ FileManagerView::FileManagerView( } else nav_.display_modal("Timestamp Rename", "Can't rename that."); }; + + button_open_iq_trim.on_select = [this]() { + auto path = get_selected_full_path(); + if (selected_is_valid() && !get_selected_entry().is_directory && is_cxx_capture_file(path)) { + nav_.push(path); + } else + nav_.display_modal("IQ Trim", "Not a capture file."); + }; } } // namespace ui diff --git a/firmware/application/apps/ui_fileman.hpp b/firmware/application/apps/ui_fileman.hpp index dd110641..c38e2c08 100644 --- a/firmware/application/apps/ui_fileman.hpp +++ b/firmware/application/apps/ui_fileman.hpp @@ -272,6 +272,12 @@ class FileManagerView : public FileManBaseView { &bitmap_icon_options_datetime, Color::orange(), /*vcenter*/ true}; + + NewButton button_open_iq_trim{ + {9 * 8, 34 * 8, 4 * 8, 32}, + {}, + &bitmap_icon_trim, + Color::orange()}; }; } /* namespace ui */ diff --git a/firmware/application/apps/ui_iq_trim.cpp b/firmware/application/apps/ui_iq_trim.cpp index 2da29125..6f438538 100644 --- a/firmware/application/apps/ui_iq_trim.cpp +++ b/firmware/application/apps/ui_iq_trim.cpp @@ -47,10 +47,7 @@ IQTrimView::IQTrimView(NavigationView& nav) auto open_view = nav_.push(".C*"); open_view->push_dir(u"CAPTURES"); open_view->on_changed = [this](fs::path path) { - path_ = std::move(path); - profile_capture(); - compute_range(); - refresh_ui(); + open_file(path); }; }; @@ -84,6 +81,18 @@ IQTrimView::IQTrimView(NavigationView& nav) }; } +IQTrimView::IQTrimView(NavigationView& nav, const fs::path& path) + : IQTrimView(nav) { + open_file(path); +} + +void IQTrimView::open_file(const std::filesystem::path& path) { + path_ = std::move(path); + profile_capture(); + compute_range(); + refresh_ui(); +} + void IQTrimView::paint(Painter& painter) { if (info_) { uint32_t power_cutoff = field_cutoff.value() * static_cast(info_->max_power) / 100; diff --git a/firmware/application/apps/ui_iq_trim.hpp b/firmware/application/apps/ui_iq_trim.hpp index c3bae915..d9303d6b 100644 --- a/firmware/application/apps/ui_iq_trim.hpp +++ b/firmware/application/apps/ui_iq_trim.hpp @@ -68,12 +68,15 @@ class TrimProgressUI { class IQTrimView : public View { public: IQTrimView(NavigationView& nav); + IQTrimView(NavigationView& nav, const std::filesystem::path& path); std::string title() const override { return "IQ Trim"; } void paint(Painter& painter) override; void focus() override; private: + void open_file(const std::filesystem::path& path); + /* Update controls with latest values. */ void refresh_ui(); diff --git a/firmware/application/bitmap.hpp b/firmware/application/bitmap.hpp index c8a9ddb1..9b6cb2fe 100644 --- a/firmware/application/bitmap.hpp +++ b/firmware/application/bitmap.hpp @@ -5645,6 +5645,44 @@ static constexpr Bitmap bitmap_icon_shift{ {16, 16}, bitmap_icon_shift_data}; +static constexpr uint8_t bitmap_icon_trim_data[] = { + 0x10, + 0x10, + 0x30, + 0x12, + 0x50, + 0x15, + 0x50, + 0x15, + 0x50, + 0x15, + 0x52, + 0x95, + 0x56, + 0xD5, + 0x5F, + 0xF5, + 0x56, + 0xD5, + 0x52, + 0x95, + 0x50, + 0x15, + 0x50, + 0x15, + 0x50, + 0x15, + 0x90, + 0x18, + 0x10, + 0x10, + 0x00, + 0x00, +}; +static constexpr Bitmap bitmap_icon_trim{ + {16, 16}, + bitmap_icon_trim_data}; + } /* namespace ui */ #endif /*__BITMAP_HPP__*/ diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index 75d50f66..2d0ea6ec 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -560,7 +560,7 @@ UtilitiesMenuView::UtilitiesMenuView(NavigationView& nav) { {"File Manager", Color::green(), &bitmap_icon_dir, [&nav]() { nav.push(); }}, {"Freq. Manager", Color::green(), &bitmap_icon_freqman, [&nav]() { nav.push(); }}, {"Notepad", Color::dark_cyan(), &bitmap_icon_notepad, [&nav]() { nav.push(); }}, - {"IQ Trim", Color::orange(), &bitmap_icon_cut, [&nav]() { nav.push(); }}, + {"IQ Trim", Color::orange(), &bitmap_icon_trim, [&nav]() { nav.push(); }}, {"SD Over USB", Color::yellow(), &bitmap_icon_hackrf, [&nav]() { nav.push(); }}, {"Signal Gen", Color::green(), &bitmap_icon_cwgen, [&nav]() { nav.push(); }}, // {"Test App", Color::dark_grey(), nullptr, [&nav](){ nav.push(); }}, diff --git a/firmware/graphics/icon_trim.png b/firmware/graphics/icon_trim.png new file mode 100644 index 00000000..3f8daaf0 Binary files /dev/null and b/firmware/graphics/icon_trim.png differ