mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-04-22 20:41:28 +00:00
fixing range frequencies and index skipping
This commit is contained in:
parent
9540776afd
commit
7da322f926
@ -150,9 +150,11 @@ namespace ui {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReconThread::run() {
|
void ReconThread::run()
|
||||||
|
{
|
||||||
if (frequency_list_.size() > 0 ) { //IF THERE IS A FREQUENCY LIST ...
|
//IF THERE IS A FREQUENCY LIST ...
|
||||||
|
if (frequency_list_.size() > 0 )
|
||||||
|
{
|
||||||
int64_t minfreq = 0 ;
|
int64_t minfreq = 0 ;
|
||||||
int64_t maxfreq = 0 ;
|
int64_t maxfreq = 0 ;
|
||||||
bool has_looped = false ;
|
bool has_looped = false ;
|
||||||
@ -200,17 +202,13 @@ namespace ui {
|
|||||||
last_entry . bandwidth = -1 ;
|
last_entry . bandwidth = -1 ;
|
||||||
last_entry . step = -1 ;
|
last_entry . step = -1 ;
|
||||||
bool restart_recon = false; //Flag whenever scanning is restarting after a pause
|
bool restart_recon = false; //Flag whenever scanning is restarting after a pause
|
||||||
int16_t last_index = -1 ;
|
|
||||||
|
|
||||||
while( !chThdShouldTerminate() && frequency_list_.size() > 0 ) {
|
while( !chThdShouldTerminate() && frequency_list_.size() > 0 )
|
||||||
has_looped = false ;
|
{
|
||||||
entry_has_changed = false ;
|
|
||||||
if( !_freq_delete )
|
if( !_freq_delete )
|
||||||
{
|
{
|
||||||
if( _recon || _stepper != 0 || _index_stepper != 0 || last_index !=frequency_index )
|
has_looped = false ;
|
||||||
{
|
if( last_entry . frequency_a != freq || entry_has_changed )
|
||||||
last_index = frequency_index ;
|
|
||||||
if( last_entry . frequency_a != freq )
|
|
||||||
{
|
{
|
||||||
last_entry . frequency_a = freq ;
|
last_entry . frequency_a = freq ;
|
||||||
receiver_model.set_tuning_frequency( freq ); // Retune
|
receiver_model.set_tuning_frequency( freq ); // Retune
|
||||||
@ -218,6 +216,8 @@ namespace ui {
|
|||||||
message.range = frequency_index ;
|
message.range = frequency_index ;
|
||||||
EventDispatcher::send_message(message);
|
EventDispatcher::send_message(message);
|
||||||
}
|
}
|
||||||
|
entry_has_changed = false ;
|
||||||
|
|
||||||
// Set modulation if any
|
// Set modulation if any
|
||||||
if( last_entry . modulation != frequency_list_[ frequency_index ] . modulation && frequency_list_[ frequency_index ] . modulation >= 0 )
|
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);
|
EventDispatcher::send_message(message);
|
||||||
step = freqman_entry_get_step_value( last_entry . step );
|
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 */
|
/* we are doing a range */
|
||||||
if( frequency_list_[ frequency_index ] . type == RANGE ) {
|
if( frequency_list_[ frequency_index ] . type == RANGE ) {
|
||||||
|
|
||||||
if ( ( _fwd && _stepper == 0 ) || _stepper > 0 ) {
|
if ( ( _fwd && _stepper == 0 ) || _stepper > 0 ) {
|
||||||
//forward
|
//forward
|
||||||
freq += step ;
|
freq += step ;
|
||||||
@ -360,16 +364,6 @@ namespace ui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
restart_recon = false ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
restart_recon = true ;
|
|
||||||
}
|
|
||||||
if( _index_stepper != 0 )
|
|
||||||
{
|
{
|
||||||
if( _index_stepper > 0 )
|
if( _index_stepper > 0 )
|
||||||
frequency_index ++ ;
|
frequency_index ++ ;
|
||||||
@ -381,6 +375,7 @@ namespace ui {
|
|||||||
frequency_index = 0 ;
|
frequency_index = 0 ;
|
||||||
entry_has_changed = true ;
|
entry_has_changed = true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reload entry if changed
|
// reload entry if changed
|
||||||
if( entry_has_changed ){
|
if( entry_has_changed ){
|
||||||
switch( frequency_list_[ frequency_index ] . type ){
|
switch( frequency_list_[ frequency_index ] . type ){
|
||||||
@ -414,7 +409,6 @@ namespace ui {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// send a pause message with the right freq
|
// send a pause message with the right freq
|
||||||
if( has_looped && !_continuous )
|
if( has_looped && !_continuous )
|
||||||
@ -429,12 +423,18 @@ namespace ui {
|
|||||||
if( _stepper > 0 ) _stepper -- ;
|
if( _stepper > 0 ) _stepper -- ;
|
||||||
if( _index_stepper < 0 ) _index_stepper ++ ;
|
if( _index_stepper < 0 ) _index_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
|
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()
|
bool ReconView::check_sd_card()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user