1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 00:05:33 +03:00

currentTime passed in scheduler task call

This commit is contained in:
Martin Budden 2016-07-06 17:09:04 +01:00
parent 7122689038
commit 2f9ca4355c
21 changed files with 134 additions and 125 deletions

View file

@ -323,9 +323,6 @@ typedef struct blackboxSlowState_s {
//From mixer.c:
extern uint8_t motorCount;
//From mw.c:
extern uint32_t currentTime;
//From rx.c:
extern uint16_t rssi;
@ -965,7 +962,7 @@ static void writeGPSHomeFrame()
gpsHistory.GPS_home[1] = GPS_home[1];
}
static void writeGPSFrame()
static void writeGPSFrame(uint32_t currentTime)
{
blackboxWrite('G');
@ -996,7 +993,7 @@ static void writeGPSFrame()
/**
* Fill the current state of the blackbox using values read from the flight controller
*/
static void loadMainState(void)
static void loadMainState(uint32_t currentTime)
{
blackboxMainState_t *blackboxCurrent = blackboxHistory[0];
int i;
@ -1428,7 +1425,7 @@ static void blackboxAdvanceIterationTimers()
}
// Called once every FC loop in order to log the current state
static void blackboxLogIteration()
static void blackboxLogIteration(uint32_t currentTime)
{
// Write a keyframe every BLACKBOX_I_INTERVAL frames so we can resynchronise upon missing frames
if (blackboxShouldLogIFrame()) {
@ -1438,7 +1435,7 @@ static void blackboxLogIteration()
*/
writeSlowFrameIfNeeded(blackboxIsOnlyLoggingIntraframes());
loadMainState();
loadMainState(currentTime);
writeIntraframe();
} else {
blackboxCheckAndLogArmingBeep();
@ -1451,7 +1448,7 @@ static void blackboxLogIteration()
*/
writeSlowFrameIfNeeded(true);
loadMainState();
loadMainState(currentTime);
writeInterframe();
}
#ifdef GPS
@ -1467,11 +1464,11 @@ static void blackboxLogIteration()
|| (blackboxPFrameIndex == BLACKBOX_I_INTERVAL / 2 && blackboxIFrameIndex % 128 == 0)) {
writeGPSHomeFrame();
writeGPSFrame();
writeGPSFrame(currentTime);
} 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();
writeGPSFrame(currentTime);
}
}
#endif
@ -1484,7 +1481,7 @@ static void blackboxLogIteration()
/**
* Call each flight loop iteration to perform blackbox logging.
*/
void handleBlackbox(void)
void handleBlackbox(uint32_t currentTime)
{
int i;
@ -1581,7 +1578,7 @@ void handleBlackbox(void)
blackboxLogEvent(FLIGHT_LOG_EVENT_LOGGING_RESUME, (flightLogEventData_t *) &resume);
blackboxSetState(BLACKBOX_STATE_RUNNING);
blackboxLogIteration();
blackboxLogIteration(currentTime);
}
// Keep the logging timers ticking so our log iteration continues to advance
@ -1593,7 +1590,7 @@ void handleBlackbox(void)
if (blackboxModeActivationConditionPresent && !IS_RC_MODE_ACTIVE(BOXBLACKBOX) && !startedLoggingInTestMode) {
blackboxSetState(BLACKBOX_STATE_PAUSED);
} else {
blackboxLogIteration();
blackboxLogIteration(currentTime);
}
blackboxAdvanceIterationTimers();