From 83ac3593c3c9efd01411ab5bae0706e1d39c9054 Mon Sep 17 00:00:00 2001 From: snow <16166717+fuwenbo95@user.noreply.gitee.com> Date: Thu, 27 Aug 2026 17:00:21 +0800 Subject: [PATCH 1/4] for app jammer failure --- .../application/external/hopper/ui_hopper.cpp | 20 ++---- .../application/external/jammer/ui_jammer.cpp | 6 +- .../external/ui_fast_hop_warning.hpp | 64 +++++++++++++++++++ 3 files changed, 74 insertions(+), 16 deletions(-) create mode 100644 firmware/application/external/ui_fast_hop_warning.hpp diff --git a/firmware/application/external/hopper/ui_hopper.cpp b/firmware/application/external/hopper/ui_hopper.cpp index 3ef9273055..71aaff7ae9 100644 --- a/firmware/application/external/hopper/ui_hopper.cpp +++ b/firmware/application/external/hopper/ui_hopper.cpp @@ -29,6 +29,7 @@ #include "file_path.hpp" #include "file_reader.hpp" #include "convert.hpp" +#include "external/ui_fast_hop_warning.hpp" #include "baseband_api.hpp" #include "string_format.hpp" @@ -330,21 +331,10 @@ HopperView::HopperView( if (jamming || cooling) { stop_tx(); } else { - // if hop speed is 0, alert the user that this will cause a freeze on UI - if (options_hop.selected_index_value() == 0) { - nav_.display_modal( - "Warning", "Hopping set to 0ms (fastest).\n\nTHIS WILL FREEZE THE HACKRF,\npress RESET button to stop\n\nAre you sure?", YESNO, [this](bool choice) { - if (choice) { - // Wait for UI update before the freeze - chThdSleepMilliseconds(50); - start_tx(); - } - }, - TRUE); - } else { - // if hop speed is not 0, just start the transmission - start_tx(); - } + start_with_fast_hop_warning( + nav_, + options_hop.selected_index_value(), + [this] { start_tx(); }); } }; diff --git a/firmware/application/external/jammer/ui_jammer.cpp b/firmware/application/external/jammer/ui_jammer.cpp index 372680d899..3e44dfeecc 100644 --- a/firmware/application/external/jammer/ui_jammer.cpp +++ b/firmware/application/external/jammer/ui_jammer.cpp @@ -22,6 +22,7 @@ */ #include "ui_jammer.hpp" +#include "external/ui_fast_hop_warning.hpp" #include "ui_receiver.hpp" #include "ui_freqman.hpp" @@ -408,7 +409,10 @@ JammerView::JammerView(NavigationView& nav) if (jamming || cooling) stop_tx(); else - start_tx(); + start_with_fast_hop_warning( + nav_, + options_hop.selected_index_value() * 10, + [this] { start_tx(); }); }; } diff --git a/firmware/application/external/ui_fast_hop_warning.hpp b/firmware/application/external/ui_fast_hop_warning.hpp new file mode 100644 index 0000000000..158f02df19 --- /dev/null +++ b/firmware/application/external/ui_fast_hop_warning.hpp @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2026 + * + * This file is part of PortaPack. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef __UI_FAST_HOP_WARNING_HPP__ +#define __UI_FAST_HOP_WARNING_HPP__ + +#include +#include + +#include "ch.h" +#include "ui_navigation.hpp" + +namespace ui::external_app { + +constexpr size_t fast_hop_warning_threshold_ms = 50; + +template +void start_with_fast_hop_warning( + NavigationView& nav, + const size_t hop_interval_ms, + StartTx&& start_tx) { + // 50ms is safe for NXP MCU + if (hop_interval_ms >= fast_hop_warning_threshold_ms) { + start_tx(); + return; + } + + nav.display_modal( + "Warning", + "Hopping interval is\nbelow 50ms.\n\n" + "THIS WILL FREEZE\nTHE HACKRF.\n" + "Press RESET button\nto stop.\n\n" + "Are you sure?", + YESNO, + [start_tx = std::forward(start_tx)](bool choice) mutable { + if (choice) { + chThdSleepMilliseconds(50); + start_tx(); + } + }, + TRUE); +} + +} // namespace ui::external_app + +#endif /* __UI_FAST_HOP_WARNING_HPP__ */ From 91e3d3405660aab77ba11f10a51183831ab220f7 Mon Sep 17 00:00:00 2001 From: snow <16166717+fuwenbo95@user.noreply.gitee.com> Date: Fri, 28 Aug 2026 09:22:20 +0800 Subject: [PATCH 2/4] copy hup warning code from hopper to jammer --- PR_DESCRIPTION.md | 23 ++++++++++++++++ .../application/external/hopper/ui_hopper.cpp | 23 ++++++++++++---- .../application/external/jammer/ui_jammer.cpp | 26 ++++++++++++++----- 3 files changed, 61 insertions(+), 11 deletions(-) create mode 100644 PR_DESCRIPTION.md diff --git a/PR_DESCRIPTION.md b/PR_DESCRIPTION.md new file mode 100644 index 0000000000..e54f22be09 --- /dev/null +++ b/PR_DESCRIPTION.md @@ -0,0 +1,23 @@ +# Warn Before Fast Hopping + +## Summary + +Add a confirmation dialog before starting Jammer or Hopper with a hopping interval below 50 ms. + +## Problem + +Very short hopping intervals generate retune events faster than the M0 MCU can process them. This can make the UI unresponsive and require a hardware reset. + +Hopper already displayed a warning for its fastest hopping mode. Jammer did not have equivalent protection, and Hopper did not warn for every unsafe interval. + +## Changes + +- Added matching fast-hopping warnings to Jammer and Hopper. +- Show a confirmation dialog when the selected hop interval is below 50 ms. +- Preserve the existing 50 ms UI delay after confirmation so the dialog is rendered before transmission starts. +- Keep 50 ms and slower hopping intervals unchanged. + +## Validation + +- Rebuilt the application target successfully. +- Regenerated the Jammer and Hopper external application images. diff --git a/firmware/application/external/hopper/ui_hopper.cpp b/firmware/application/external/hopper/ui_hopper.cpp index 71aaff7ae9..cdc6e618ab 100644 --- a/firmware/application/external/hopper/ui_hopper.cpp +++ b/firmware/application/external/hopper/ui_hopper.cpp @@ -29,7 +29,6 @@ #include "file_path.hpp" #include "file_reader.hpp" #include "convert.hpp" -#include "external/ui_fast_hop_warning.hpp" #include "baseband_api.hpp" #include "string_format.hpp" @@ -331,10 +330,24 @@ HopperView::HopperView( if (jamming || cooling) { stop_tx(); } else { - start_with_fast_hop_warning( - nav_, - options_hop.selected_index_value(), - [this] { start_tx(); }); + if (options_hop.selected_index_value() < 50) { + nav_.display_modal( + "Warning", + "Hopping interval is\nbelow 50ms.\n\n" + "THIS WILL FREEZE\nTHE HACKRF.\n" + "Press RESET button\nto stop.\n\n" + "Are you sure?", + YESNO, + [this](bool choice) { + if (choice) { + chThdSleepMilliseconds(50); + start_tx(); + } + }, + TRUE); + } else { + start_tx(); + } } }; diff --git a/firmware/application/external/jammer/ui_jammer.cpp b/firmware/application/external/jammer/ui_jammer.cpp index 3e44dfeecc..64af639c2b 100644 --- a/firmware/application/external/jammer/ui_jammer.cpp +++ b/firmware/application/external/jammer/ui_jammer.cpp @@ -22,7 +22,6 @@ */ #include "ui_jammer.hpp" -#include "external/ui_fast_hop_warning.hpp" #include "ui_receiver.hpp" #include "ui_freqman.hpp" @@ -408,11 +407,26 @@ JammerView::JammerView(NavigationView& nav) button_transmit.on_select = [this](Button&) { if (jamming || cooling) stop_tx(); - else - start_with_fast_hop_warning( - nav_, - options_hop.selected_index_value() * 10, - [this] { start_tx(); }); + else { + if (options_hop.selected_index_value() * 10 < 50) { + nav_.display_modal( + "Warning", + "Hopping interval is\nbelow 50ms.\n\n" + "THIS WILL FREEZE\nTHE HACKRF.\n" + "Press RESET button\nto stop.\n\n" + "Are you sure?", + YESNO, + [this](bool choice) { + if (choice) { + chThdSleepMilliseconds(50); + start_tx(); + } + }, + TRUE); + } else { + start_tx(); + } + } }; } From b27dc887a81638bd6809f646e3e7f2cfea2fac65 Mon Sep 17 00:00:00 2001 From: snow <16166717+fuwenbo95@user.noreply.gitee.com> Date: Fri, 28 Aug 2026 09:25:21 +0800 Subject: [PATCH 3/4] remove my PR RECORD FILE --- PR_DESCRIPTION.md | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 PR_DESCRIPTION.md diff --git a/PR_DESCRIPTION.md b/PR_DESCRIPTION.md deleted file mode 100644 index e54f22be09..0000000000 --- a/PR_DESCRIPTION.md +++ /dev/null @@ -1,23 +0,0 @@ -# Warn Before Fast Hopping - -## Summary - -Add a confirmation dialog before starting Jammer or Hopper with a hopping interval below 50 ms. - -## Problem - -Very short hopping intervals generate retune events faster than the M0 MCU can process them. This can make the UI unresponsive and require a hardware reset. - -Hopper already displayed a warning for its fastest hopping mode. Jammer did not have equivalent protection, and Hopper did not warn for every unsafe interval. - -## Changes - -- Added matching fast-hopping warnings to Jammer and Hopper. -- Show a confirmation dialog when the selected hop interval is below 50 ms. -- Preserve the existing 50 ms UI delay after confirmation so the dialog is rendered before transmission starts. -- Keep 50 ms and slower hopping intervals unchanged. - -## Validation - -- Rebuilt the application target successfully. -- Regenerated the Jammer and Hopper external application images. From 55525901cf13195952200737e7b3c98c35605d96 Mon Sep 17 00:00:00 2001 From: snow <16166717+fuwenbo95@user.noreply.gitee.com> Date: Fri, 28 Aug 2026 09:26:33 +0800 Subject: [PATCH 4/4] copy hup warning code from hopper to jammer --- .../external/ui_fast_hop_warning.hpp | 64 ------------------- 1 file changed, 64 deletions(-) delete mode 100644 firmware/application/external/ui_fast_hop_warning.hpp diff --git a/firmware/application/external/ui_fast_hop_warning.hpp b/firmware/application/external/ui_fast_hop_warning.hpp deleted file mode 100644 index 158f02df19..0000000000 --- a/firmware/application/external/ui_fast_hop_warning.hpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2026 - * - * This file is part of PortaPack. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef __UI_FAST_HOP_WARNING_HPP__ -#define __UI_FAST_HOP_WARNING_HPP__ - -#include -#include - -#include "ch.h" -#include "ui_navigation.hpp" - -namespace ui::external_app { - -constexpr size_t fast_hop_warning_threshold_ms = 50; - -template -void start_with_fast_hop_warning( - NavigationView& nav, - const size_t hop_interval_ms, - StartTx&& start_tx) { - // 50ms is safe for NXP MCU - if (hop_interval_ms >= fast_hop_warning_threshold_ms) { - start_tx(); - return; - } - - nav.display_modal( - "Warning", - "Hopping interval is\nbelow 50ms.\n\n" - "THIS WILL FREEZE\nTHE HACKRF.\n" - "Press RESET button\nto stop.\n\n" - "Are you sure?", - YESNO, - [start_tx = std::forward(start_tx)](bool choice) mutable { - if (choice) { - chThdSleepMilliseconds(50); - start_tx(); - } - }, - TRUE); -} - -} // namespace ui::external_app - -#endif /* __UI_FAST_HOP_WARNING_HPP__ */