From 7a8e4320ac7248326428a95d68a83b313231db20 Mon Sep 17 00:00:00 2001 From: wb2osz Date: Wed, 16 Aug 2023 15:00:10 +0100 Subject: [PATCH] Issue 486. Maybe. --- src/direwolf.c | 2 +- src/rrbb.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- src/rrbb.h | 4 ++++ 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/src/direwolf.c b/src/direwolf.c index 8735193..3e7dca2 100644 --- a/src/direwolf.c +++ b/src/direwolf.c @@ -300,7 +300,7 @@ int main (int argc, char *argv[]) text_color_init(t_opt); text_color_set(DW_COLOR_INFO); - dw_printf ("Dire Wolf version %d.%d (%s) BETA TEST 4\n", MAJOR_VERSION, MINOR_VERSION, __DATE__); + dw_printf ("Dire Wolf version %d.%d (%s) BETA TEST 5\n", MAJOR_VERSION, MINOR_VERSION, __DATE__); //dw_printf ("Dire Wolf DEVELOPMENT version %d.%d %s (%s)\n", MAJOR_VERSION, MINOR_VERSION, "G", __DATE__); //dw_printf ("Dire Wolf version %d.%d\n", MAJOR_VERSION, MINOR_VERSION); diff --git a/src/rrbb.c b/src/rrbb.c index 2047d69..e787dae 100644 --- a/src/rrbb.c +++ b/src/rrbb.c @@ -51,8 +51,8 @@ #define MAGIC2 0x56788765 -static int new_count = 0; -static int delete_count = 0; +volatile static int new_count = 0; +volatile static int delete_count = 0; /*********************************************************************************** @@ -425,6 +425,50 @@ alevel_t rrbb_get_audio_level (rrbb_t b) +/*********************************************************************************** + * + * Name: rrbb_set_speed_error + * + * Purpose: Set speed error of the received frame. + * + * Inputs: b Handle for bit array. + * speed_error In percentage. + * + ***********************************************************************************/ + +void rrbb_set_speed_error (rrbb_t b, float speed_error) +{ + assert (b != NULL); + assert (b->magic1 == MAGIC1); + assert (b->magic2 == MAGIC2); + + b->speed_error = speed_error; +} + + +/*********************************************************************************** + * + * Name: rrbb_get_speed_error + * + * Purpose: Get speed error of the received frame. + * + * Inputs: b Handle for bit array. + * + * Returns: speed error in percentage. + * + ***********************************************************************************/ + +float rrbb_get_speed_error (rrbb_t b) +{ + assert (b != NULL); + assert (b->magic1 == MAGIC1); + assert (b->magic2 == MAGIC2); + + return (b->speed_error); +} + + + /*********************************************************************************** * * Name: rrbb_get_is_scrambled @@ -488,6 +532,7 @@ int rrbb_get_prev_descram (rrbb_t b) } + /* end rrbb.c */ diff --git a/src/rrbb.h b/src/rrbb.h index 4b28372..894a448 100644 --- a/src/rrbb.h +++ b/src/rrbb.h @@ -33,6 +33,7 @@ typedef struct rrbb_s { int slice; /* Which slicer. */ alevel_t alevel; /* Received audio level at time of frame capture. */ + float speed_error; /* Received data speed error as percentage. */ unsigned int len; /* Current number of samples in array. */ int is_scrambled; /* Is data scrambled G3RUH / K9NG style? */ @@ -84,6 +85,9 @@ int rrbb_get_slice (rrbb_t b); void rrbb_set_audio_level (rrbb_t b, alevel_t alevel); alevel_t rrbb_get_audio_level (rrbb_t b); +void rrbb_set_speed_error (rrbb_t b, float speed_error); +float rrbb_get_speed_error (rrbb_t b); + int rrbb_get_is_scrambled (rrbb_t b); int rrbb_get_descram_state (rrbb_t b); int rrbb_get_prev_descram (rrbb_t b);