aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2017-07-30 22:03:51 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2017-08-08 12:54:03 +0200
commit5090f5a18d0c6a0494fe92268112613fef9be0e0 (patch)
tree2235e80805b52bde2bdec707ebb781335e43b54e
parent0cbd9657d20fb300d4fc2039ec137988eb40d21a (diff)
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
-rw-r--r--src/common/display_iq.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/common/display_iq.c b/src/common/display_iq.c
index 6a27485..9df3725 100644
--- a/src/common/display_iq.c
+++ b/src/common/display_iq.c
@@ -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");