mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 00:05:33 +03:00
Port of refactored beeper code 181_1
This the "Port of refactored beeper code #669" modification applied to version 1.8.1 (4/4/2015) of the code.
This commit is contained in:
parent
988ae2d503
commit
f02d7403af
15 changed files with 476 additions and 191 deletions
|
@ -38,7 +38,6 @@
|
|||
#include "drivers/pwm_rx.h"
|
||||
#include "drivers/accgyro.h"
|
||||
#include "drivers/light_led.h"
|
||||
#include "drivers/sound_beeper.h"
|
||||
|
||||
#include "sensors/sensors.h"
|
||||
#include "sensors/boardalignment.h"
|
||||
|
@ -981,22 +980,15 @@ void blackboxLogEvent(FlightLogEvent event, flightLogEventData_t *data)
|
|||
}
|
||||
}
|
||||
|
||||
// Beep the buzzer and write the current time to the log as a synchronization point
|
||||
static void blackboxPlaySyncBeep()
|
||||
// Write the time of the last arming beep to the log as a synchronization point
|
||||
static void blackboxLogArmingBeep()
|
||||
{
|
||||
flightLogEvent_syncBeep_t eventData;
|
||||
|
||||
eventData.time = micros();
|
||||
|
||||
/*
|
||||
* The regular beep routines aren't going to work for us, because they queue up the beep to be executed later.
|
||||
* Our beep is timing sensitive, so start beeping now without setting the beeperIsOn flag.
|
||||
*/
|
||||
BEEP_ON;
|
||||
|
||||
// Have the regular beeper code turn off the beep for us eventually, since that's not timing-sensitive
|
||||
queueConfirmationBeep(1);
|
||||
// Get time of last arming beep (in system-uptime microseconds)
|
||||
eventData.time = getArmingBeepTimeMicros();
|
||||
|
||||
// Write the time to the log
|
||||
blackboxLogEvent(FLIGHT_LOG_EVENT_SYNC_BEEP, (flightLogEventData_t *) &eventData);
|
||||
}
|
||||
|
||||
|
@ -1064,7 +1056,7 @@ void handleBlackbox(void)
|
|||
case BLACKBOX_STATE_PRERUN:
|
||||
blackboxSetState(BLACKBOX_STATE_RUNNING);
|
||||
|
||||
blackboxPlaySyncBeep();
|
||||
blackboxLogArmingBeep();
|
||||
break;
|
||||
case BLACKBOX_STATE_RUNNING:
|
||||
// On entry to this state, blackboxIteration, blackboxPFrameIndex and blackboxIFrameIndex are reset to 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue