aboutsummaryrefslogtreecommitdiffstats
path: root/src/amps
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2017-09-25 18:46:50 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2017-10-12 19:46:30 +0200
commitba036de22680c5f46983f30144c23d212245842f (patch)
treef511133326644feb457810c524a2ff317aa945c3 /src/amps
parente84d7a082c20b591a06fdfd38ccdbe458e276631 (diff)
Add function to display measurements on screen
Use 'm' key to toggle display.
Diffstat (limited to 'src/amps')
-rw-r--r--src/amps/amps.h4
-rw-r--r--src/amps/dsp.c7
2 files changed, 11 insertions, 0 deletions
diff --git a/src/amps/amps.h b/src/amps/amps.h
index 5f82a23..d909208 100644
--- a/src/amps/amps.h
+++ b/src/amps/amps.h
@@ -46,6 +46,10 @@ typedef struct amps {
enum amps_state state;
int channel_busy; /* indicate channel is busy while receiving */
+ /* display measurements */
+ dispmeasparam_t *dmp_frame_level;
+ dispmeasparam_t *dmp_frame_quality;
+
/* system info */
amps_si si;
diff --git a/src/amps/dsp.c b/src/amps/dsp.c
index 95a0c09..2415f0a 100644
--- a/src/amps/dsp.c
+++ b/src/amps/dsp.c
@@ -268,6 +268,9 @@ int dsp_init_sender(amps_t *amps, int tolerant)
/* be more tolerant when syncing */
amps->fsk_rx_sync_tolerant = tolerant;
+ amps->dmp_frame_level = display_measurements_add(&amps->sender, "Frame Level", "%.1f %% (last)", DISPLAY_MEAS_LAST, DISPLAY_MEAS_LEFT, 0.0, 150.0, 100.0);
+ amps->dmp_frame_quality = display_measurements_add(&amps->sender, "Frame Quality", "%.1f %% (last)", DISPLAY_MEAS_LAST, DISPLAY_MEAS_LEFT, 0.0, 100.0, 100.0);
+
return 0;
error:
@@ -606,6 +609,10 @@ prepare_frame:
if (amps->fsk_rx_frame_count == amps->fsk_rx_frame_length) {
int more;
+ /* update measurements */
+ display_measurements_update(amps->dmp_frame_level, amps->fsk_rx_frame_level / (double)amps->fsk_rx_frame_count * 100.0, 0.0);
+ display_measurements_update(amps->dmp_frame_quality, amps->fsk_rx_frame_quality / (double)amps->fsk_rx_frame_count * 100.0, 0.0);
+
/* a complete frame was received, so we process it */
amps->fsk_rx_frame[amps->fsk_rx_frame_count] = '\0';
more = amps_decode_frame(amps, amps->fsk_rx_frame, amps->fsk_rx_frame_count, amps->fsk_rx_frame_level / (double)amps->fsk_rx_frame_count, amps->fsk_rx_frame_quality / amps->fsk_rx_frame_level, (amps->fsk_rx_sync == FSK_SYNC_NEGATIVE));