From e2c25d83ce1261f4ca11d8204f6ee78eeb35d233 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Tue, 17 Feb 2015 14:50:14 +0100 Subject: [PATCH] removed lowpass from leader tone detection --- app/src/main/rs/calibration_detector.rsh | 9 ++++----- app/src/main/rs/decoder.rs | 2 +- app/src/main/rs/initialization.rsh | 1 - app/src/main/rs/state.rsh | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/src/main/rs/calibration_detector.rsh b/app/src/main/rs/calibration_detector.rsh index 3a769bd..6593814 100644 --- a/app/src/main/rs/calibration_detector.rsh +++ b/app/src/main/rs/calibration_detector.rsh @@ -20,7 +20,7 @@ limitations under the License. #include "constants.rsh" #include "state.rsh" -static int calibration_detected(float dat_value, int cnt_quantized) +static int calibration_detected(float dat_quantized, int cnt_quantized) { static int progress, countdown; static int leader_counter, break_counter; @@ -28,8 +28,7 @@ static int calibration_detected(float dat_value, int cnt_quantized) progress = countdown ? progress : 0; countdown -= !!countdown; - int leader_quantized = round(filter(&leader_lowpass, dat_value)); - int leader_level = leader_quantized == 0; + int leader_level = dat_quantized == 0; int leader_pulse = !leader_level && leader_counter >= leader_length; leader_counter = leader_level ? leader_counter + 1 : 0; if (leader_pulse) { @@ -93,9 +92,9 @@ static int calibration_detected(float dat_value, int cnt_quantized) return -1; } -static int calibration_detector(float dat_value, int cnt_quantized) +static int calibration_detector(int dat_quantized, int cnt_quantized) { - switch (calibration_detected(dat_value, cnt_quantized)) { + switch (calibration_detected(dat_quantized, cnt_quantized)) { case 0x88: return mode_robot36; case 0x0c: diff --git a/app/src/main/rs/decoder.rs b/app/src/main/rs/decoder.rs index 0764d53..e285c5f 100644 --- a/app/src/main/rs/decoder.rs +++ b/app/src/main/rs/decoder.rs @@ -283,7 +283,7 @@ void decode(int samples) { static int reset_on_first_sync; if (automatic_mode_detection) { - int detected_mode = calibration_detector(dat_value, cnt_quantized); + int detected_mode = calibration_detector(dat_quantized, cnt_quantized); if (detected_mode >= 0) { //RS_DEBUG(detected_mode); reset_on_first_sync = 1; diff --git a/app/src/main/rs/initialization.rsh b/app/src/main/rs/initialization.rsh index a2ff16d..8df5c52 100644 --- a/app/src/main/rs/initialization.rsh +++ b/app/src/main/rs/initialization.rsh @@ -94,7 +94,6 @@ void initialize(float rate, int length, int iw, int ih, int sw, int sh, int sgw, const float cnt_bandwidth = 200.0f; avg_power = ema_cutoff(10.0f, sample_rate); - leader_lowpass = ema_cutoff(100.0f, sample_rate); cnt_ddc = ddc(cnt_carrier, cnt_bandwidth, sample_rate); dat_ddc = ddc(dat_carrier, dat_bandwidth, sample_rate); diff --git a/app/src/main/rs/state.rsh b/app/src/main/rs/state.rsh index 735f603..b657d1c 100644 --- a/app/src/main/rs/state.rsh +++ b/app/src/main/rs/state.rsh @@ -17,7 +17,7 @@ limitations under the License. #ifndef STATE_RSH #define STATE_RSH -static ema_t avg_power, leader_lowpass; +static ema_t avg_power; static ddc_t cnt_ddc, dat_ddc; static fmd_t cnt_fmd, dat_fmd; static int disable_analyzer;