mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 04:15:44 +03:00
Merge pull request #936 from sherlockflight/blackbox-arm-beep
Fix Blackbox arming beep time logging
This commit is contained in:
commit
f2013ab863
2 changed files with 26 additions and 18 deletions
|
@ -203,9 +203,9 @@ flight problems like vibration or PID setting issues.
|
||||||
|
|
||||||
The Blackbox starts recording data as soon as you arm your craft, and stops when you disarm.
|
The Blackbox starts recording data as soon as you arm your craft, and stops when you disarm.
|
||||||
|
|
||||||
If your craft has a buzzer attached, a short beep will be played when you arm and recording begins. You can later use
|
If your craft has a buzzer attached, you can use Cleanflight's arming beep to synchronize your Blackbox log with your
|
||||||
this beep to synchronize your recorded flight video with the rendered flight data log (the beep is shown as a blue line
|
flight video. Cleanflight's arming beep is a "long, short" pattern. The beginning of the first long beep will be shown
|
||||||
in the flight data log, which you can sync against the beep in your recorded audio track).
|
as a blue line in the flight data log, which you can sync against your recorded audio track.
|
||||||
|
|
||||||
You should wait a few seconds after disarming your craft to allow the Blackbox to finish saving its data.
|
You should wait a few seconds after disarming your craft to allow the Blackbox to finish saving its data.
|
||||||
|
|
||||||
|
@ -224,8 +224,9 @@ minutes.
|
||||||

|

|
||||||
|
|
||||||
After downloading the log, be sure to erase the chip to make it ready for reuse by clicking the "erase flash" button.
|
After downloading the log, be sure to erase the chip to make it ready for reuse by clicking the "erase flash" button.
|
||||||
If you try to start recording a new flight when the dataflash is already full, the Blackbox will not make its regular
|
|
||||||
arming beep and nothing will be recorded.
|
If you try to start recording a new flight when the dataflash is already full, Blackbox logging will be disabled and
|
||||||
|
nothing will be recorded.
|
||||||
|
|
||||||
## Converting logs to CSV or PNG
|
## Converting logs to CSV or PNG
|
||||||
After your flights, you'll have a series of flight log files with a .TXT extension. You'll need to decode these with
|
After your flights, you'll have a series of flight log files with a .TXT extension. You'll need to decode these with
|
||||||
|
|
|
@ -250,7 +250,6 @@ typedef enum BlackboxState {
|
||||||
BLACKBOX_STATE_SEND_GPS_H_HEADERS,
|
BLACKBOX_STATE_SEND_GPS_H_HEADERS,
|
||||||
BLACKBOX_STATE_SEND_GPS_G_HEADERS,
|
BLACKBOX_STATE_SEND_GPS_G_HEADERS,
|
||||||
BLACKBOX_STATE_SEND_SYSINFO,
|
BLACKBOX_STATE_SEND_SYSINFO,
|
||||||
BLACKBOX_STATE_PRERUN,
|
|
||||||
BLACKBOX_STATE_RUNNING,
|
BLACKBOX_STATE_RUNNING,
|
||||||
BLACKBOX_STATE_SHUTTING_DOWN
|
BLACKBOX_STATE_SHUTTING_DOWN
|
||||||
} BlackboxState;
|
} BlackboxState;
|
||||||
|
@ -268,6 +267,8 @@ extern uint32_t currentTime;
|
||||||
|
|
||||||
static BlackboxState blackboxState = BLACKBOX_STATE_DISABLED;
|
static BlackboxState blackboxState = BLACKBOX_STATE_DISABLED;
|
||||||
|
|
||||||
|
static uint32_t blackboxLastArmingBeep = 0;
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
uint32_t headerIndex;
|
uint32_t headerIndex;
|
||||||
|
|
||||||
|
@ -684,6 +685,12 @@ void startBlackbox(void)
|
||||||
*/
|
*/
|
||||||
blackboxBuildConditionCache();
|
blackboxBuildConditionCache();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Record the beeper's current idea of the last arming beep time, so that we can detect it changing when
|
||||||
|
* it finally plays the beep for this arming event.
|
||||||
|
*/
|
||||||
|
blackboxLastArmingBeep = getArmingBeepTimeMicros();
|
||||||
|
|
||||||
blackboxSetState(BLACKBOX_STATE_SEND_HEADER);
|
blackboxSetState(BLACKBOX_STATE_SEND_HEADER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1012,16 +1019,19 @@ void blackboxLogEvent(FlightLogEvent event, flightLogEventData_t *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the time of the last arming beep to the log as a synchronization point
|
/* If an arming beep has played since it was last logged, write the time of the arming beep to the log as a synchronization point */
|
||||||
static void blackboxLogArmingBeep()
|
static void blackboxCheckAndLogArmingBeep()
|
||||||
{
|
{
|
||||||
flightLogEvent_syncBeep_t eventData;
|
flightLogEvent_syncBeep_t eventData;
|
||||||
|
|
||||||
// Get time of last arming beep (in system-uptime microseconds)
|
// Use != so that we can still detect a change if the counter wraps
|
||||||
eventData.time = getArmingBeepTimeMicros();
|
if (getArmingBeepTimeMicros() != blackboxLastArmingBeep) {
|
||||||
|
blackboxLastArmingBeep = getArmingBeepTimeMicros();
|
||||||
|
|
||||||
// Write the time to the log
|
eventData.time = blackboxLastArmingBeep;
|
||||||
blackboxLogEvent(FLIGHT_LOG_EVENT_SYNC_BEEP, (flightLogEventData_t *) &eventData);
|
|
||||||
|
blackboxLogEvent(FLIGHT_LOG_EVENT_SYNC_BEEP, (flightLogEventData_t *) &eventData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1082,14 +1092,9 @@ void handleBlackbox(void)
|
||||||
|
|
||||||
//Keep writing chunks of the system info headers until it returns true to signal completion
|
//Keep writing chunks of the system info headers until it returns true to signal completion
|
||||||
if (blackboxWriteSysinfo()) {
|
if (blackboxWriteSysinfo()) {
|
||||||
blackboxSetState(BLACKBOX_STATE_PRERUN);
|
blackboxSetState(BLACKBOX_STATE_RUNNING);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BLACKBOX_STATE_PRERUN:
|
|
||||||
blackboxSetState(BLACKBOX_STATE_RUNNING);
|
|
||||||
|
|
||||||
blackboxLogArmingBeep();
|
|
||||||
break;
|
|
||||||
case BLACKBOX_STATE_RUNNING:
|
case BLACKBOX_STATE_RUNNING:
|
||||||
// On entry to this state, blackboxIteration, blackboxPFrameIndex and blackboxIFrameIndex are reset to 0
|
// On entry to this state, blackboxIteration, blackboxPFrameIndex and blackboxIFrameIndex are reset to 0
|
||||||
|
|
||||||
|
@ -1099,6 +1104,8 @@ void handleBlackbox(void)
|
||||||
loadBlackboxState();
|
loadBlackboxState();
|
||||||
writeIntraframe();
|
writeIntraframe();
|
||||||
} else {
|
} else {
|
||||||
|
blackboxCheckAndLogArmingBeep();
|
||||||
|
|
||||||
/* Adding a magic shift of "masterConfig.blackbox_rate_num - 1" in here creates a better spread of
|
/* Adding a magic shift of "masterConfig.blackbox_rate_num - 1" in here creates a better spread of
|
||||||
* recorded / skipped frames when the I frame's position is considered:
|
* recorded / skipped frames when the I frame's position is considered:
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue