restarting beep
This commit is contained in:
parent
40853a0d4c
commit
a056678346
12
src/beep.c
12
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()
|
||||
|
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user