diff --git a/libraries/AP_HAL_Linux/ToneAlarmDriver.cpp b/libraries/AP_HAL_Linux/ToneAlarmDriver.cpp index 606e42ea53..d3b42440bd 100644 --- a/libraries/AP_HAL_Linux/ToneAlarmDriver.cpp +++ b/libraries/AP_HAL_Linux/ToneAlarmDriver.cpp @@ -74,22 +74,15 @@ void LinuxUtil::stop() void LinuxUtil::play(int tone,int duration) { - - char buf[10]; if(tune_num != prev_tune_num){ tune_changed = true; return; } if(tone != 0){ - write(run_fd,"0",sizeof(char)); - - sprintf(buf,"%u",1000000000/tone); - write(period_fd,buf,sizeof(buf)); - - sprintf(buf,"%u",500000000/tone); - write(duty_fd,buf,sizeof(buf)); - - write(run_fd,"1",sizeof(char)); + dprintf(run_fd,"0"); + dprintf(period_fd,"%u",1000000000/tone); + dprintf(duty_fd,"%u",500000000/tone); + dprintf(run_fd,"1"); } hal.scheduler->delay(duration); } @@ -261,4 +254,4 @@ void LinuxUtil::play_tune() void LinuxUtil::_toneAlarm_timer_tick(){ play_tune(); } -#endif \ No newline at end of file +#endif