khaytsus / gqrx-scan

Control GRQX to scan frequencies or from channels using the GQRX Bookmark or CSV file
67 stars 8 forks source link

additional check for errorlevel #18

Closed harals closed 7 years ago

harals commented 7 years ago

Hello

I'm running gqrx and gqrx-scan with a rtl-sdr on debian linux amd64.

When I issue the -wait parameter, the scanning does not continue after channel is clear. It seems as if I get a lot of readings with level 0.0.

I've never programmed perl, but it seems as if checking the error level after the sleep in line 704 solves the problem:

if ( $waitlevel == $ignorelevel ) { next; }

Also, when the problem is present, the log file gets numerous entries: 2017-04-04 08:54:22 -- Signal lost: 151.874 200 level 0.0 2017-04-04 08:54:22 -- Recording Started: 151.874 200 level -8.3 2017-04-04 08:54:24 -- Signal lost: 151.874 200 level 0.0 2017-04-04 08:54:24 -- Recording Started: 151.874 200 level -9.1 2017-04-04 08:54:25 -- Signal lost: 151.874 200 level 0.0 2017-04-04 08:54:25 -- Recording Started: 151.874 200 level -9.1 2017-04-04 08:54:26 -- Signal lost: 151.874 200 level 0.0 2017-04-04 08:54:27 -- Recording Started: 151.874 200 level -9.2 2017-04-04 08:54:27 -- Signal lost: 151.874 200 level 0.0 2017-04-04 08:54:27 -- Recording Started: 151.874 200 level -9.3 2017-04-04 08:54:28 -- Signal lost: 151.874 200 level 0.0 2017-04-04 08:54:29 -- Recording Started: 151.874 200 level -9.2 2017-04-04 08:54:29 -- Signal lost: 151.874 200 level 0.0 2017-04-04 08:54:30 -- Recording Started: 151.874 200 level -7.7 2017-04-04 08:54:31 -- Signal lost: 151.874 200 level 0.0 2017-04-04 08:54:32 -- Recording Started: 151.874 200 level -8.0 2017-04-04 08:54:33 -- Signal lost: 151.874 200 level -34.7 2017-04-04 08:54:33 -- Recording Started: 151.874 200 level 0.0

khaytsus commented 7 years ago

I've recently had a problem too with 0.0, which is why I added the $ignorelevel a while back but I had not noticed this issue. Could you give me more code context around your suggested fix, or make sure you're up to date? I have sleep on line 694 which is likely the sleep you're referring to but I want to make sure.

harals commented 7 years ago

Yes, you are correct. Below that sleep on line 694. Please see the attached diff.

diff.txt

khaytsus commented 7 years ago

I'm having trouble trying to figure out why this would help.. Line 691 has this:

while ( ( $waitlevel > $delaylevel && $waitlevel != $ignorelevel ) || $lastsignal < $delaytime )

Which should fall out of the while loop.. but now that I think about that more, I probably have the logic here wrong. Can you let me know if changing line 691 to this helps? Remove/comment out your diff suggestion.

while ( ( $waitlevel > $delaylevel || $lastsignal < $delaytime ) && $waitlevel != $ignorelevel )

I still can't reproduce here, but if that fixes it I'll check that in. The more I look at it I think I just made a logical error in the while loop. Thank you!

khaytsus commented 7 years ago

Okay, I'm an idiot. After I looked closer, I introduced a really stupid bug here. In line 687 I do this:

        my $waitlevel  = '0;

Then in 691 I do this:

        while ( ( $waitlevel > $delaylevel && $waitlevel != $ignorelevel )
            || $lastsignal < $delaytime )

$waitlevel equals 0, $ignorelevel equals 0.0, and != is a numeric comparison. So the first one is always going to fail. Set my $waitlevel = '99' or something and test that for me, without any other changes please, (especially the while loop change I mentioned a few minutes ago. Sorry about that. I must have antenna problems here, I'm not hearing anything on some of the frequencies I often monitor.