mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Merge pull request #865 from gullradriel/recon-fix
fixing range frequencies and index skipping
This commit is contained in:
commit
0e59e61461
@ -150,9 +150,11 @@ namespace ui {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ReconThread::run() {
|
||||
|
||||
if (frequency_list_.size() > 0 ) { //IF THERE IS A FREQUENCY LIST ...
|
||||
void ReconThread::run()
|
||||
{
|
||||
//IF THERE IS A FREQUENCY LIST ...
|
||||
if (frequency_list_.size() > 0 )
|
||||
{
|
||||
int64_t minfreq = 0 ;
|
||||
int64_t maxfreq = 0 ;
|
||||
bool has_looped = false ;
|
||||
@ -200,17 +202,13 @@ namespace ui {
|
||||
last_entry . bandwidth = -1 ;
|
||||
last_entry . step = -1 ;
|
||||
bool restart_recon = false; //Flag whenever scanning is restarting after a pause
|
||||
int16_t last_index = -1 ;
|
||||
|
||||
while( !chThdShouldTerminate() && frequency_list_.size() > 0 ) {
|
||||
has_looped = false ;
|
||||
entry_has_changed = false ;
|
||||
while( !chThdShouldTerminate() && frequency_list_.size() > 0 )
|
||||
{
|
||||
if( !_freq_delete )
|
||||
{
|
||||
if( _recon || _stepper != 0 || _index_stepper != 0 || last_index !=frequency_index )
|
||||
{
|
||||
last_index = frequency_index ;
|
||||
if( last_entry . frequency_a != freq )
|
||||
has_looped = false ;
|
||||
if( last_entry . frequency_a != freq || entry_has_changed )
|
||||
{
|
||||
last_entry . frequency_a = freq ;
|
||||
receiver_model.set_tuning_frequency( freq ); // Retune
|
||||
@ -218,6 +216,8 @@ namespace ui {
|
||||
message.range = frequency_index ;
|
||||
EventDispatcher::send_message(message);
|
||||
}
|
||||
entry_has_changed = false ;
|
||||
|
||||
// Set modulation if any
|
||||
if( last_entry . modulation != frequency_list_[ frequency_index ] . modulation && frequency_list_[ frequency_index ] . modulation >= 0 )
|
||||
{
|
||||
@ -242,14 +242,18 @@ namespace ui {
|
||||
EventDispatcher::send_message(message);
|
||||
step = freqman_entry_get_step_value( last_entry . step );
|
||||
}
|
||||
if( _freq_lock == 0 || _stepper != 0 ) //normal recon (not performing freq_lock)
|
||||
|
||||
if( _recon || _stepper != 0 || _index_stepper != 0 )
|
||||
{
|
||||
if( !restart_recon || _stepper != 0 )
|
||||
if( _freq_lock == 0 || _stepper != 0 || _index_stepper != 0 ) //normal recon (not performing freq_lock)
|
||||
{
|
||||
if( !restart_recon || _stepper != 0 || _index_stepper != 0 )
|
||||
{
|
||||
|
||||
if( _index_stepper == 0 )
|
||||
{
|
||||
/* we are doing a range */
|
||||
if( frequency_list_[ frequency_index ] . type == RANGE ) {
|
||||
|
||||
if ( ( _fwd && _stepper == 0 ) || _stepper > 0 ) {
|
||||
//forward
|
||||
freq += step ;
|
||||
@ -360,16 +364,6 @@ namespace ui {
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
restart_recon = false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
restart_recon = true ;
|
||||
}
|
||||
if( _index_stepper != 0 )
|
||||
{
|
||||
if( _index_stepper > 0 )
|
||||
frequency_index ++ ;
|
||||
@ -381,6 +375,7 @@ namespace ui {
|
||||
frequency_index = 0 ;
|
||||
entry_has_changed = true ;
|
||||
}
|
||||
|
||||
// reload entry if changed
|
||||
if( entry_has_changed ){
|
||||
switch( frequency_list_[ frequency_index ] . type ){
|
||||
@ -414,7 +409,6 @@ namespace ui {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
// send a pause message with the right freq
|
||||
if( has_looped && !_continuous )
|
||||
@ -429,12 +423,18 @@ namespace ui {
|
||||
if( _stepper > 0 ) _stepper -- ;
|
||||
if( _index_stepper < 0 ) _index_stepper ++ ;
|
||||
if( _index_stepper > 0 ) _index_stepper -- ;
|
||||
|
||||
} // if( !restart_recon || _stepper != 0 || _index_stepper != 0 )
|
||||
else
|
||||
{
|
||||
restart_recon = false ;
|
||||
}
|
||||
} // if( _freq_lock == 0 || _stepper != 0 || _index_stepper != 0 )
|
||||
} // if( _recon || _stepper != 0 || _index_stepper != 0 )
|
||||
} // if( !freq_delete )
|
||||
chThdSleepMilliseconds( _lock_duration ); //Needed to (eventually) stabilize the receiver into new freq
|
||||
}
|
||||
}
|
||||
}
|
||||
} //while( !chThdShouldTerminate() && frequency_list_.size() > 0 )
|
||||
}//if (frequency_list_.size() > 0 )
|
||||
} //ReconThread::run
|
||||
|
||||
bool ReconView::check_sd_card()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user