Add 1ms hop option to hopper app + 0ms (freeze UI) (#2692)

This commit is contained in:
Tommaso Ventafridda 2025-06-12 11:54:37 +02:00 committed by GitHub
parent fb2e576b34
commit ea38a0fe48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 13 deletions

View file

@ -78,7 +78,7 @@ void HopperView::set_hopper_channel(uint32_t i, uint32_t width, uint64_t center,
hopper_channels[i].enabled = true;
hopper_channels[i].width = (width * 0xFFFFFFULL) / 1536000;
hopper_channels[i].center = center;
hopper_channels[i].duration = 30720 * duration;
hopper_channels[i].duration = duration ? 3072 * duration : 10;
}
void HopperView::start_tx() {
@ -274,7 +274,7 @@ HopperView::HopperView(
options_type.set_selected_index(3); // Rand CW
options_speed.set_selected_index(3); // 10kHz
options_hop.set_selected_index(1); // 50ms
options_hop.set_selected_index(3); // 50ms
button_transmit.set_style(&style_val);
field_timetx.set_value(30);
@ -327,10 +327,25 @@ HopperView::HopperView(
};
button_transmit.on_select = [this](Button&) {
if (jamming || cooling)
if (jamming || cooling) {
stop_tx();
else
start_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();
}
}
};
menu_freq_list.on_left = [this]() {

View file

@ -170,14 +170,16 @@ class HopperView : public View {
OptionsField options_hop{
{7 * 8, 27 * 8},
5,
{{"10ms ", 1},
{"50ms ", 5},
{"100ms", 10},
{"1s ", 100},
{"2s ", 200},
{"5s ", 500},
{"10s ", 1000}}};
6,
{{"0ms !!", 0},
{"1ms ", 1},
{"10ms ", 10},
{"50ms ", 50},
{"100ms", 100},
{"1s ", 1000},
{"2s ", 2000},
{"5s ", 5000},
{"10s ", 10000}}};
NumberField field_timetx{
{7 * 8, 29 * 8},