mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-07 17:24:58 -04:00
JAMMER NOW INCLUDES TWO TIMERS
Each driving the TX and COOLDOWN timers.
This commit is contained in:
parent
95f7eda9c5
commit
8859c3d80c
2 changed files with 80 additions and 75 deletions
|
@ -274,6 +274,8 @@ void JammerView::start_tx() {
|
|||
transmitter_model.enable();
|
||||
|
||||
baseband::set_jammer(true, (JammerType)options_type.selected_index(), options_speed.selected_index_value());
|
||||
cooling = false;
|
||||
mscounter = 0; //euquiq: Reset internal ms counter for do_timer()
|
||||
} else {
|
||||
if (out_of_ranges)
|
||||
nav_.display_modal("Error", "Jamming bandwidth too large.\nMust be less than 24MHz.");
|
||||
|
@ -290,6 +292,39 @@ void JammerView::stop_tx() {
|
|||
baseband::set_jammer(false, JammerType::TYPE_FSK, 0);
|
||||
jamming = false;
|
||||
}
|
||||
|
||||
//called each 1/60th of second
|
||||
void JammerView::on_timer() {
|
||||
if (++mscounter == 60) {
|
||||
if (jamming)
|
||||
{
|
||||
if (cooling)
|
||||
{
|
||||
if (++seconds >= field_timepause.value())
|
||||
{ //Re-start TX
|
||||
transmitter_model.enable();
|
||||
button_transmit.set_text("STOP");
|
||||
baseband::set_jammer(true, (JammerType)options_type.selected_index(), options_speed.selected_index_value());
|
||||
cooling = false;
|
||||
seconds = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++seconds >= field_timetx.value()) //Start cooling period:
|
||||
{
|
||||
transmitter_model.disable();
|
||||
button_transmit.set_text("PAUSED");
|
||||
baseband::set_jammer(false, JammerType::TYPE_FSK, 0);
|
||||
cooling = true;
|
||||
seconds = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
mscounter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
JammerView::JammerView(
|
||||
NavigationView& nav
|
||||
|
@ -309,6 +344,8 @@ JammerView::JammerView(
|
|||
&text_range_total,
|
||||
&options_speed,
|
||||
&options_hop,
|
||||
&field_timetx,
|
||||
&field_timepause,
|
||||
&button_transmit
|
||||
});
|
||||
|
||||
|
@ -321,8 +358,11 @@ JammerView::JammerView(
|
|||
options_hop.set_selected_index(1); // 50ms
|
||||
button_transmit.set_style(&style_val);
|
||||
|
||||
field_timetx.set_value(30);
|
||||
field_timepause.set_value(1);
|
||||
|
||||
button_transmit.on_select = [this](Button&) {
|
||||
if (jamming)
|
||||
if (jamming || cooling)
|
||||
stop_tx();
|
||||
else
|
||||
start_tx();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue