From a0566783463c6cd446e42caf8a5e095e57f57fba Mon Sep 17 00:00:00 2001 From: Gerolf Ziegenhain Date: Mon, 3 Oct 2016 21:08:29 +0200 Subject: [PATCH] restarting beep --- src/beep.c | 12 +++++++++--- src/irmc.c | 4 ++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/beep.c b/src/beep.c index c70d2de..f7555e9 100644 --- a/src/beep.c +++ b/src/beep.c @@ -141,9 +141,15 @@ void msleep(int d){ int beep(double freq_hz, double duration_sec) { - buzzer_set_freq(freq_hz); - msleep(duration_sec*1000.); - buzzer_set_freq(0.); + if (freq_hz > 0.0) { + buzzer_set_freq(freq_hz); + msleep(duration_sec*1000.); + buzzer_set_freq(0.); + } + else + { + msleep(duration_sec*1000.); + } return 0; } int beep_init() diff --git a/src/irmc.c b/src/irmc.c index 71f6ada..09c9b29 100644 --- a/src/irmc.c +++ b/src/irmc.c @@ -296,7 +296,9 @@ int main(int argc, char *argv[]) inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr), s, sizeof s); fprintf(stderr, "Connected to %s.\n", s); + beep_init(); + if ((strcmp (serialport, "")) != 0) tx_method = TX_SERIAL; @@ -354,7 +356,9 @@ int main(int argc, char *argv[]) else { if(length < 0) { + buzzer_close(); beep(0.0, abs(length)/1000.); + buzzer_start(); } else {