From 2d1314a3fae8f13c300edc76849757d2b149fec4 Mon Sep 17 00:00:00 2001 From: sommermorgentraum <24917424+zxkmm@users.noreply.github.com> Date: Tue, 1 Oct 2024 16:16:59 +0800 Subject: [PATCH 1/4] fine tune pwd gen app layout (#2277) * init * format --- .../external/random_password/ui_random_password.cpp | 13 +++---------- .../external/random_password/ui_random_password.hpp | 4 ++-- firmware/common/ui_widget.hpp | 2 ++ 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/firmware/application/external/random_password/ui_random_password.cpp b/firmware/application/external/random_password/ui_random_password.cpp index d293f83d4..18ad7db20 100644 --- a/firmware/application/external/random_password/ui_random_password.cpp +++ b/firmware/application/external/random_password/ui_random_password.cpp @@ -298,7 +298,7 @@ void RandomPasswordView::new_password() { text_generated_passwd.set(password); text_char_type_hints.set(char_type_hints); - paint_password_hints(); // TODO: why flash and disappeared + paint_password_hints(); if (logger && logging) { str_log += generate_log_line(); @@ -309,7 +309,7 @@ void RandomPasswordView::new_password() { if (check_auto_send.value() || flooding) { async_prev_val = portapack::async_tx_enabled; portapack::async_tx_enabled = true; - // printing out seeds buufer + // printing out seeds buffer // for (auto seed : seeds_deque) { // UsbSerialAsyncmsg::asyncmsg(std::to_string(seed)); // } @@ -320,18 +320,11 @@ void RandomPasswordView::new_password() { clean_buffer(); } -// tried: -// 1. paint inline in new_password func -// 2. paint in a seperate func and call from new_password -// 3. override nav's paint func (i think it can tried to capture same obj) and paint, hoping set_dirty handle it correctly -// 4. override nav's paint func (i think it can tried to capture same obj) and paint in a seperate func, hoping set_dirty handle it correctly -// all these methods failed, and all of them only flash and disappeared. only when set_dirty in on_data (which seems incorrect), and it keep flashing never stop. but see painted content (flashing too) -// btw this is not caused by the seed text set thing, cuz commented it out not helping. void RandomPasswordView::paint_password_hints() { Painter painter; const int char_width = 8; const int char_height = 16; - const int start_y = 7 * char_height + 5; + const int start_y = 6 * char_height; const int rect_height = 4; for (size_t i = 0; i < password.length(); i++) { diff --git a/firmware/application/external/random_password/ui_random_password.hpp b/firmware/application/external/random_password/ui_random_password.hpp index c9ae20778..71b98a46d 100644 --- a/firmware/application/external/random_password/ui_random_password.hpp +++ b/firmware/application/external/random_password/ui_random_password.hpp @@ -45,7 +45,7 @@ using namespace ui; namespace ui::external_app::random_password { -class RandomPasswordLogger { // TODO: log is broken after introduced the buffer thing +class RandomPasswordLogger { public: Optional append(const std::filesystem::path& filename) { return log_file.append(filename); @@ -126,7 +126,7 @@ class RandomPasswordView : public View { "000000000000000000000000000000"}; Text text_char_type_hints{ - {0, 5 * 16, screen_width, 16}, + {0, 5 * 16 + 4, screen_width, 16}, "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"}; Checkbox check_show_seeds{ diff --git a/firmware/common/ui_widget.hpp b/firmware/common/ui_widget.hpp index 46d873ed6..1e9504708 100644 --- a/firmware/common/ui_widget.hpp +++ b/firmware/common/ui_widget.hpp @@ -156,6 +156,8 @@ class Widget { }; class View : public Widget { + // unlike Paint class, our Y ignored the top bar; + // so when you draw some of us as Y = 0, it would be exact below the top bar, instead of overlapped with top bar public: View() { } From e75fb59169c6356534f522980997b27e3d96022b Mon Sep 17 00:00:00 2001 From: sommermorgentraum <24917424+zxkmm@users.noreply.github.com> Date: Wed, 2 Oct 2024 22:17:40 +0800 Subject: [PATCH 2/4] fix issue from #1444 (#2278) --- firmware/application/apps/ui_encoders.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/firmware/application/apps/ui_encoders.cpp b/firmware/application/apps/ui_encoders.cpp index 60d386a0d..727796676 100644 --- a/firmware/application/apps/ui_encoders.cpp +++ b/firmware/application/apps/ui_encoders.cpp @@ -58,6 +58,7 @@ EncodersConfigView::EncodersConfigView( options_enctype.on_change = [this](size_t index, int32_t) { on_type_change(index); + set_dirty(); }; options_enctype.set_options(enc_options); @@ -104,7 +105,18 @@ void EncodersConfigView::on_type_change(size_t index) { // Add new SymFields. Point pos{2 * 8, 9 * 8}; - std::string format_string; + std::string format_string = encoder_def->word_format; + + /*important notes of this format_String + * previously before PR#1444, this code using the for loop below to generate the format_string, which MAYBE to prevent showing the S symble. + * but after PR#1444, the entireh of symfield code not compatible with this design anymore. + * however the encoder_def struct itself has a field called word_format, which exactly be avle to use as the format_string, + * because itself is ONLY a hint text, not impact protocol things. + * When you find OOK protocol is broken and see this commit from git blame, please be aware that it's not from here. + * previously me and @cusspvz already found it broken, this commit is just to fix the broken that from PR#1444. + * @zxkmm + */ + uint8_t word_length = encoder_def->word_length; auto on_change_handler = [this](SymField&) { generate_frame(); @@ -119,11 +131,9 @@ void EncodersConfigView::on_type_change(size_t index) { switch (symbol_type) { case 'A': symfield->set_symbol_list(encoder_def->address_symbols); - format_string += 'A'; break; case 'D': symfield->set_symbol_list(encoder_def->data_symbols); - format_string += 'D'; break; } @@ -131,8 +141,8 @@ void EncodersConfigView::on_type_change(size_t index) { pos += Point{8, 0}; } - // Ugly :( Pad to erase - format_string.append(24 - format_string.size(), ' '); + // cut the S, cuz sync bit isn't in symfield for user to chage/edit. + format_string.erase(std::remove(format_string.begin(), format_string.end(), 'S'), format_string.end()); text_format.set(format_string); generate_frame(); From c1af935022ab0584cb8bc081bf974a7d9b0b777a Mon Sep 17 00:00:00 2001 From: Erwin Ried <1091420+eried@users.noreply.github.com> Date: Thu, 3 Oct 2024 07:22:21 +0200 Subject: [PATCH 3/4] Update README.md (#2279) Link to OpenSourceSDRLab store --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fd9a2fef2..7a9f2b3c0 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ This repository expands upon the previous work by many people and aims to consta ## What to buy? -:heavy_check_mark: ![Static Badge](https://img.shields.io/badge/NEW-yellow) The fabulous [PortaPack H4M Mayhem](https://grabify.link/VPMPSL), featuring numerous improvements and accessories. Sold by our friends at OpenSourceSDRLab. Join their giveaways on discord (check the badge on top). +:heavy_check_mark: ![Static Badge](https://img.shields.io/badge/NEW-yellow) The fabulous [PortaPack H4M Mayhem](https://grabify.link/VPMPSL), featuring numerous improvements and accessories. Sold by our friends at [OpenSourceSDRLab](https://grabify.link/99SAMT). Join their giveaways on discord (check the badge on top). :heavy_check_mark: A recommended one is this [PortaPack H2](https://grabify.link/7T28JP), that includes everything you need with the plastic case "inspired" on [this](https://github.com/portapack-mayhem/mayhem-firmware/wiki/H2-Enclosure). From b0c92d9bafa80c135a60544080b72dc27899b6ae Mon Sep 17 00:00:00 2001 From: Erwin Ried <1091420+eried@users.noreply.github.com> Date: Thu, 3 Oct 2024 13:43:00 +0200 Subject: [PATCH 4/4] Update README.md (#2280) aliexpress fixed the links for the alternative portapacks (the non opensourcesdrlabs) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7a9f2b3c0..033f31297 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This is a fork of the [Havoc](https://github.com/furrtek/portapack-havoc/) firmw [](https://github.com/portapack-mayhem/mayhem-firmware/wiki/Hardware-overview) [](https://github.com/portapack-mayhem/mayhem-firmware/wiki/Hardware-overview#portapack-internals) -*[PortaPack H2+HackRF+battery](https://grabify.link/7T28JP) (clone) with a custom [3d printed case](https://github.com/portapack-mayhem/mayhem-firmware/wiki/H2-Enclosure)* +*[PortaPack H2+HackRF+battery](https://grabify.link/ZYYPLB) (clone) with a custom [3d printed case](https://github.com/portapack-mayhem/mayhem-firmware/wiki/H2-Enclosure)* # What is this? @@ -29,9 +29,9 @@ This repository expands upon the previous work by many people and aims to consta :heavy_check_mark: ![Static Badge](https://img.shields.io/badge/NEW-yellow) The fabulous [PortaPack H4M Mayhem](https://grabify.link/VPMPSL), featuring numerous improvements and accessories. Sold by our friends at [OpenSourceSDRLab](https://grabify.link/99SAMT). Join their giveaways on discord (check the badge on top). -:heavy_check_mark: A recommended one is this [PortaPack H2](https://grabify.link/7T28JP), that includes everything you need with the plastic case "inspired" on [this](https://github.com/portapack-mayhem/mayhem-firmware/wiki/H2-Enclosure). +:heavy_check_mark: A recommended one is this [PortaPack H2](https://grabify.link/ZYYPLB), that includes everything you need with the plastic case "inspired" on [this](https://github.com/portapack-mayhem/mayhem-firmware/wiki/H2-Enclosure). -:heavy_check_mark: Some individuals lean towards the [H2 with a metal enclosure](https://grabify.link/HTDXG5), but its advantages remain debated. Share your insights on our [wiki](https://github.com/portapack-mayhem/mayhem-firmware/wiki/Hardware-overview). +:heavy_check_mark: Some individuals lean towards the [H2 with a metal enclosure](https://grabify.link/D001O0), but its advantages remain debated. Share your insights on our [wiki](https://github.com/portapack-mayhem/mayhem-firmware/wiki/Hardware-overview). :warning: Be cautious , *ask* the seller about compatibility with the latest releases. Look out for the description of the item, if they provide the firmware files for an older version or they have custom setup instructions, this means it might be **NOT compatible**, for example: