mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 00:05:33 +03:00
Converted currentTime to currentTimeUs
This commit is contained in:
parent
ec0b52aea1
commit
8d3c825646
38 changed files with 197 additions and 165 deletions
|
@ -938,7 +938,7 @@ static void writeGPSHomeFrame()
|
|||
gpsHistory.GPS_home[1] = GPS_home[1];
|
||||
}
|
||||
|
||||
static void writeGPSFrame(uint32_t currentTime)
|
||||
static void writeGPSFrame(timeUs_t currentTimeUs)
|
||||
{
|
||||
blackboxWrite('G');
|
||||
|
||||
|
@ -950,7 +950,7 @@ static void writeGPSFrame(uint32_t currentTime)
|
|||
*/
|
||||
if (testBlackboxCondition(FLIGHT_LOG_FIELD_CONDITION_NOT_LOGGING_EVERY_FRAME)) {
|
||||
// Predict the time of the last frame in the main log
|
||||
blackboxWriteUnsignedVB(currentTime - blackboxHistory[1]->time);
|
||||
blackboxWriteUnsignedVB(currentTimeUs - blackboxHistory[1]->time);
|
||||
}
|
||||
|
||||
blackboxWriteUnsignedVB(GPS_numSat);
|
||||
|
@ -969,12 +969,12 @@ static void writeGPSFrame(uint32_t currentTime)
|
|||
/**
|
||||
* Fill the current state of the blackbox using values read from the flight controller
|
||||
*/
|
||||
static void loadMainState(uint32_t currentTime)
|
||||
static void loadMainState(timeUs_t currentTimeUs)
|
||||
{
|
||||
blackboxMainState_t *blackboxCurrent = blackboxHistory[0];
|
||||
int i;
|
||||
|
||||
blackboxCurrent->time = currentTime;
|
||||
blackboxCurrent->time = currentTimeUs;
|
||||
|
||||
for (i = 0; i < XYZ_AXIS_COUNT; i++) {
|
||||
blackboxCurrent->axisPID_P[i] = axisPID_P[i];
|
||||
|
@ -1401,7 +1401,7 @@ static void blackboxAdvanceIterationTimers()
|
|||
}
|
||||
|
||||
// Called once every FC loop in order to log the current state
|
||||
static void blackboxLogIteration(uint32_t currentTime)
|
||||
static void blackboxLogIteration(timeUs_t currentTimeUs)
|
||||
{
|
||||
// Write a keyframe every BLACKBOX_I_INTERVAL frames so we can resynchronise upon missing frames
|
||||
if (blackboxShouldLogIFrame()) {
|
||||
|
@ -1411,7 +1411,7 @@ static void blackboxLogIteration(uint32_t currentTime)
|
|||
*/
|
||||
writeSlowFrameIfNeeded(blackboxIsOnlyLoggingIntraframes());
|
||||
|
||||
loadMainState(currentTime);
|
||||
loadMainState(currentTimeUs);
|
||||
writeIntraframe();
|
||||
} else {
|
||||
blackboxCheckAndLogArmingBeep();
|
||||
|
@ -1424,7 +1424,7 @@ static void blackboxLogIteration(uint32_t currentTime)
|
|||
*/
|
||||
writeSlowFrameIfNeeded(true);
|
||||
|
||||
loadMainState(currentTime);
|
||||
loadMainState(currentTimeUs);
|
||||
writeInterframe();
|
||||
}
|
||||
#ifdef GPS
|
||||
|
@ -1440,11 +1440,11 @@ static void blackboxLogIteration(uint32_t currentTime)
|
|||
|| (blackboxPFrameIndex == BLACKBOX_I_INTERVAL / 2 && blackboxIFrameIndex % 128 == 0)) {
|
||||
|
||||
writeGPSHomeFrame();
|
||||
writeGPSFrame(currentTime);
|
||||
writeGPSFrame(currentTimeUs);
|
||||
} else if (GPS_numSat != gpsHistory.GPS_numSat || GPS_coord[0] != gpsHistory.GPS_coord[0]
|
||||
|| GPS_coord[1] != gpsHistory.GPS_coord[1]) {
|
||||
//We could check for velocity changes as well but I doubt it changes independent of position
|
||||
writeGPSFrame(currentTime);
|
||||
writeGPSFrame(currentTimeUs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1457,7 +1457,7 @@ static void blackboxLogIteration(uint32_t currentTime)
|
|||
/**
|
||||
* Call each flight loop iteration to perform blackbox logging.
|
||||
*/
|
||||
void handleBlackbox(uint32_t currentTime)
|
||||
void handleBlackbox(timeUs_t currentTimeUs)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -1549,12 +1549,12 @@ void handleBlackbox(uint32_t currentTime)
|
|||
flightLogEvent_loggingResume_t resume;
|
||||
|
||||
resume.logIteration = blackboxIteration;
|
||||
resume.currentTime = currentTime;
|
||||
resume.currentTime = currentTimeUs;
|
||||
|
||||
blackboxLogEvent(FLIGHT_LOG_EVENT_LOGGING_RESUME, (flightLogEventData_t *) &resume);
|
||||
blackboxSetState(BLACKBOX_STATE_RUNNING);
|
||||
|
||||
blackboxLogIteration(currentTime);
|
||||
blackboxLogIteration(currentTimeUs);
|
||||
}
|
||||
|
||||
// Keep the logging timers ticking so our log iteration continues to advance
|
||||
|
@ -1566,7 +1566,7 @@ void handleBlackbox(uint32_t currentTime)
|
|||
if (blackboxModeActivationConditionPresent && !IS_RC_MODE_ACTIVE(BOXBLACKBOX) && !startedLoggingInTestMode) {
|
||||
blackboxSetState(BLACKBOX_STATE_PAUSED);
|
||||
} else {
|
||||
blackboxLogIteration(currentTime);
|
||||
blackboxLogIteration(currentTimeUs);
|
||||
}
|
||||
|
||||
blackboxAdvanceIterationTimers();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue