mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 00:35:39 +03:00
Beep as logging begins to use as a synchronisation point for video
This commit is contained in:
parent
6d3ad4a2de
commit
566bd561dc
3 changed files with 42 additions and 1 deletions
|
@ -143,6 +143,10 @@ power-cycled, it begins a fresh new log file. If you arm and disarm several time
|
|||
several flights), those logs will be combined together into one file. The command line tools will ask you to pick which
|
||||
one of these flights you want to display/decode.
|
||||
|
||||
If your craft has a buzzer attached, a short beep will be played when you arm. You can later use this beep to
|
||||
synchronize your recorded flight video with the rendered flight data log (the beep is shown as a blue line in the flight
|
||||
data log, which you can sync against the beep in your recorded audio track).
|
||||
|
||||
The OpenLog requires a couple of seconds of delay after powerup before it's ready to record, so don't arm your craft
|
||||
immediately after connecting the battery (you'll probably be waiting for the flight controller to become ready during
|
||||
that time anyway!)
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "drivers/pwm_rx.h"
|
||||
#include "drivers/accgyro.h"
|
||||
#include "drivers/light_led.h"
|
||||
#include "drivers/sound_beeper.h"
|
||||
|
||||
#include "common/printf.h"
|
||||
|
||||
|
@ -228,6 +229,7 @@ typedef enum BlackboxState {
|
|||
BLACKBOX_STATE_SEND_GPS_H_HEADERS,
|
||||
BLACKBOX_STATE_SEND_GPS_G_HEADERS,
|
||||
BLACKBOX_STATE_SEND_SYSINFO,
|
||||
BLACKBOX_STATE_PRERUN,
|
||||
BLACKBOX_STATE_RUNNING
|
||||
} BlackboxState;
|
||||
|
||||
|
@ -1045,6 +1047,10 @@ static bool sendFieldDefinition(const char * const *headerNames, unsigned int he
|
|||
return headerXmitIndex < headerCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transmit a portion of the system information headers. Begin with a xmitIndex of 0. Returns the next xmitIndex to
|
||||
* call with, or -1 if transmission is complete.
|
||||
*/
|
||||
static int blackboxWriteSysinfo(int xmitIndex)
|
||||
{
|
||||
union floatConvert_t {
|
||||
|
@ -1104,12 +1110,32 @@ static int blackboxWriteSysinfo(int xmitIndex)
|
|||
// One more pause for good luck
|
||||
break;
|
||||
default:
|
||||
blackboxSetState(BLACKBOX_STATE_RUNNING);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return xmitIndex + 1;
|
||||
}
|
||||
|
||||
// Beep the buzzer and write the current time to the log as a synchronization point
|
||||
static void blackboxPlaySyncBeep()
|
||||
{
|
||||
uint32_t now = 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);
|
||||
|
||||
blackboxWrite('E');
|
||||
blackboxWrite(FLIGHT_LOG_EVENT_SYNC_BEEP);
|
||||
|
||||
writeUnsignedVB(now);
|
||||
}
|
||||
|
||||
void handleBlackbox(void)
|
||||
{
|
||||
int i;
|
||||
|
@ -1157,6 +1183,13 @@ void handleBlackbox(void)
|
|||
case BLACKBOX_STATE_SEND_SYSINFO:
|
||||
//On entry of this state, headerXmitIndex is 0
|
||||
headerXmitIndex = blackboxWriteSysinfo(headerXmitIndex);
|
||||
|
||||
blackboxSetState(BLACKBOX_STATE_PRERUN);
|
||||
break;
|
||||
case BLACKBOX_STATE_PRERUN:
|
||||
blackboxPlaySyncBeep();
|
||||
|
||||
blackboxSetState(BLACKBOX_STATE_RUNNING);
|
||||
break;
|
||||
case BLACKBOX_STATE_RUNNING:
|
||||
// On entry to this state, blackboxIteration, blackboxPFrameIndex and blackboxIFrameIndex are reset to 0
|
||||
|
|
|
@ -94,3 +94,7 @@ typedef enum FlightLogFieldSign {
|
|||
FLIGHT_LOG_FIELD_SIGNED = 1
|
||||
} FlightLogFieldSign;
|
||||
|
||||
typedef enum FlightLogEvent {
|
||||
FLIGHT_LOG_EVENT_SYNC_BEEP = 0,
|
||||
FLIGHT_LOG_EVENT_LOG_END = 255
|
||||
} FlightLogEvent;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue