aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-04-22 19:11:26 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-04-22 19:11:26 +0200
commit8ed337985b1ff75d2118c0591684ca878a40a81b (patch)
treed34c0424aab6ffcfc10b24bc8f7f667a61a2dc0e /src
parente0857bd199cd42d34629d2831210a480e8108728 (diff)
downloadglutte-o-matic-8ed337985b1ff75d2118c0591684ca878a40a81b.tar.gz
glutte-o-matic-8ed337985b1ff75d2118c0591684ca878a40a81b.tar.bz2
glutte-o-matic-8ed337985b1ff75d2118c0591684ca878a40a81b.zip
Add a bit of delay on the 1750 detector
Diffstat (limited to 'src')
-rw-r--r--src/common/src/Audio/tone.c14
-rw-r--r--src/glutt-o-logique/pio.c1
2 files changed, 11 insertions, 4 deletions
diff --git a/src/common/src/Audio/tone.c b/src/common/src/Audio/tone.c
index c70a84f..9c2b15a 100644
--- a/src/common/src/Audio/tone.c
+++ b/src/common/src/Audio/tone.c
@@ -84,7 +84,7 @@ static QueueHandle_t m_squared_queue;
// Values are normalised s.t. the mean corresponds to 100
static int32_t normalised_results[NUM_DETECTORS];
-static int tone_1750_detected = 0;
+static int num_tone_1750_detected = 0;
static int detectors_enabled = 0;
static enum dtmf_code dtmf_last_seen = 0;
@@ -127,6 +127,7 @@ static inline void push_dtmf_code(enum dtmf_code code)
// TODO: Does that depend on TONE_N?
const int thresh_dtmf = 200;
const int thresh_1750 = 300;
+const int num_1750_required = 5;
static void analyse_dtmf()
{
@@ -186,7 +187,7 @@ static void analyse_dtmf()
int tone_1750_status()
{
- return tone_1750_detected;
+ return num_tone_1750_detected >= num_1750_required;
}
int tone_fax_status()
@@ -316,7 +317,14 @@ void tone_do_analysis()
>> 4; // divide by 16
}
- tone_1750_detected = (normalised_results[DET_1750] > thresh_1750);
+ if (num_tone_1750_detected < num_1750_required &&
+ normalised_results[DET_1750] > thresh_1750) {
+ num_tone_1750_detected++;
+ }
+ else if (num_tone_1750_detected > 0) {
+ num_tone_1750_detected--;
+ }
+
analyse_dtmf();
#if PRINT_TONES_STATS
diff --git a/src/glutt-o-logique/pio.c b/src/glutt-o-logique/pio.c
index 948a330..5e5baf2 100644
--- a/src/glutt-o-logique/pio.c
+++ b/src/glutt-o-logique/pio.c
@@ -348,5 +348,4 @@ void pio_set_sq2(int on)
#warning "TODO Test SQ2 out"
#warning "TODO Test 1750 out"
-#warning "TODO Test FAX out"