SDR: Show IQ data with three colors to detect input overdrive

green: up to 0.45
yellow: between 0.45 and 0.9
red: above 0.9
This commit is contained in:
Andreas Eversberg 2017-07-30 22:03:51 +02:00
parent 0cbd9657d2
commit 5090f5a18d
1 changed files with 21 additions and 4 deletions

View File

@ -181,7 +181,13 @@ void display_iq(float *samples, int length)
screen[y/2][x] = '\'';
else
screen[y/2][x] = '.';
if (L > 1.0)
/* overdrive:
* 2 = close to -1..1 or above
* 1 = close to -0.5..0.5 or above
*/
if (L > 0.9)
overdrive[y/2][x] = 2;
else if (L > 0.45 && overdrive[y/2][x] < 1)
overdrive[y/2][x] = 1;
}
if (iq_on == 1)
@ -214,13 +220,24 @@ void display_iq(float *samples, int length)
putchar('|');
}
} else if (screen[j][k] == ':' || screen[j][k] == '.' || screen[j][k] == '\'') {
/* red / green plot */
if (overdrive[j][k]) {
/* red / yellow / green plot */
switch (overdrive[j][k]) {
case 2:
/* red */
if (color != 1) {
color = 1;
printf("\033[1;31m");
}
} else {
break;
case 1:
/* yellow */
if (color != 3) {
color = 3;
printf("\033[1;33m");
}
break;
default:
/* green */
if (color != 2) {
color = 2;
printf("\033[1;32m");