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 {