mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 08:15:30 +03:00
Merge pull request #2856 from ledvinap/improvement-64bit-boxid
array based box masks
This commit is contained in:
parent
47e91874f5
commit
db006b1585
32 changed files with 593 additions and 419 deletions
|
@ -47,6 +47,7 @@
|
|||
#include "fc/config.h"
|
||||
#include "fc/controlrate_profile.h"
|
||||
#include "fc/rc_controls.h"
|
||||
#include "fc/rc_modes.h"
|
||||
#include "fc/runtime_config.h"
|
||||
|
||||
#include "flight/failsafe.h"
|
||||
|
@ -325,7 +326,7 @@ typedef struct blackboxSlowState_s {
|
|||
extern uint16_t motorOutputHigh, motorOutputLow;
|
||||
|
||||
//From rc_controls.c
|
||||
extern uint32_t rcModeActivationMask;
|
||||
extern boxBitmask_t rcModeActivationMask;
|
||||
|
||||
static BlackboxState blackboxState = BLACKBOX_STATE_DISABLED;
|
||||
|
||||
|
@ -753,7 +754,7 @@ static void writeSlowFrame(void)
|
|||
*/
|
||||
static void loadSlowState(blackboxSlowState_t *slow)
|
||||
{
|
||||
slow->flightModeFlags = rcModeActivationMask; //was flightModeFlags;
|
||||
memcpy(&slow->flightModeFlags, &rcModeActivationMask, sizeof(slow->flightModeFlags)); //was flightModeFlags;
|
||||
slow->stateFlags = stateFlags;
|
||||
slow->failsafePhase = failsafePhase();
|
||||
slow->rxSignalReceived = rxIsReceivingSignal();
|
||||
|
@ -861,7 +862,7 @@ static void blackboxStart(void)
|
|||
*/
|
||||
blackboxBuildConditionCache();
|
||||
|
||||
blackboxModeActivationConditionPresent = isModeActivationConditionPresent(modeActivationConditions(0), BOXBLACKBOX);
|
||||
blackboxModeActivationConditionPresent = isModeActivationConditionPresent(BOXBLACKBOX);
|
||||
|
||||
blackboxResetIterationTimers();
|
||||
|
||||
|
@ -870,7 +871,7 @@ static void blackboxStart(void)
|
|||
* it finally plays the beep for this arming event.
|
||||
*/
|
||||
blackboxLastArmingBeep = getArmingBeepTimeMicros();
|
||||
blackboxLastFlightModeFlags = rcModeActivationMask; // record startup status
|
||||
memcpy(&blackboxLastFlightModeFlags, &rcModeActivationMask, sizeof(blackboxLastFlightModeFlags)); // record startup status
|
||||
|
||||
blackboxSetState(BLACKBOX_STATE_PREPARE_LOG_FILE);
|
||||
}
|
||||
|
@ -1383,10 +1384,10 @@ static void blackboxCheckAndLogFlightMode(void)
|
|||
flightLogEvent_flightMode_t eventData; // Add new data for current flight mode flags
|
||||
|
||||
// Use != so that we can still detect a change if the counter wraps
|
||||
if (rcModeActivationMask != blackboxLastFlightModeFlags) {
|
||||
if (memcmp(&rcModeActivationMask, &blackboxLastFlightModeFlags, sizeof(blackboxLastFlightModeFlags))) {
|
||||
eventData.lastFlags = blackboxLastFlightModeFlags;
|
||||
blackboxLastFlightModeFlags = rcModeActivationMask;
|
||||
eventData.flags = rcModeActivationMask;
|
||||
memcpy(&blackboxLastFlightModeFlags, &rcModeActivationMask, sizeof(blackboxLastFlightModeFlags));
|
||||
memcpy(&eventData.flags, &rcModeActivationMask, sizeof(eventData.flags));
|
||||
|
||||
blackboxLogEvent(FLIGHT_LOG_EVENT_FLIGHTMODE, (flightLogEventData_t *) &eventData);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue