enlarge grey area for cnt, removed from calibration detection

we are now better at dealing with spurious sync pulses
caused by noise, so allow an attenuated control channel.
pull/6/head
Ahmet Inan 2015-02-03 14:51:07 +01:00
rodzic 35994cdfd9
commit 168665f864
2 zmienionych plików z 7 dodań i 10 usunięć

Wyświetl plik

@ -20,7 +20,7 @@ limitations under the License.
#include "constants.rsh"
#include "state.rsh"
static int calibration_detected(float dat_value, float dat_amp, float cnt_amp, int cnt_quantized)
static int calibration_detected(float dat_value, int cnt_quantized)
{
static int progress, countdown;
static int leader_counter, break_counter;
@ -28,11 +28,8 @@ static int calibration_detected(float dat_value, float dat_amp, float cnt_amp, i
progress = countdown ? progress : 0;
countdown -= !!countdown;
int cnt_active = dat_amp < cnt_amp;
int dat_active = !cnt_active;
int leader_quantized = round(filter(&leader_lowpass, dat_value));
int leader_level = dat_active && leader_quantized == 0;
int leader_level = leader_quantized == 0;
int leader_pulse = !leader_level && leader_counter >= leader_length;
leader_counter = leader_level ? leader_counter + 1 : 0;
if (leader_pulse) {
@ -47,7 +44,7 @@ static int calibration_detected(float dat_value, float dat_amp, float cnt_amp, i
}
}
int break_level = cnt_active && cnt_quantized == 0;
int break_level = cnt_quantized == 0;
int break_pulse = !break_level && break_counter >= break_length;
break_counter = break_level ? break_counter + 1 : 0;
if (break_pulse) {
@ -95,9 +92,9 @@ static int calibration_detected(float dat_value, float dat_amp, float cnt_amp, i
return -1;
}
static int calibration_detector(float dat_value, float dat_amp, float cnt_amp, int cnt_quantized)
static int calibration_detector(float dat_value, int cnt_quantized)
{
switch (calibration_detected(dat_value, dat_amp, cnt_amp, cnt_quantized)) {
switch (calibration_detected(dat_value, cnt_quantized)) {
case 0x88:
return mode_robot36;
case 0x0c:

Wyświetl plik

@ -266,7 +266,7 @@ void decode(int samples) {
float cnt_amp = cabs(cnt_baseband);
float dat_amp = cabs(dat_baseband);
int cnt_active = dat_amp < 1.1f * cnt_amp;
int cnt_active = dat_amp < 2.0f * cnt_amp;
int dat_active = cnt_amp < 2.0f * dat_amp;
uchar cnt_level = debug_mode && cnt_active ? 127.5f - 127.5f * cnt_value : 0.0f;
uchar dat_level = dat_active ? 127.5f + 127.5f * dat_value : 0.0f;
@ -285,7 +285,7 @@ void decode(int samples) {
static int reset_on_first_sync;
if (automatic_mode_detection) {
int detected_mode = calibration_detector(dat_value, dat_amp, cnt_amp, cnt_quantized);
int detected_mode = calibration_detector(dat_value, cnt_quantized);
if (detected_mode >= 0) {
reset_on_first_sync = 1;
free_running = 0;