mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 01:05:27 +03:00
parent
c49bd407bf
commit
b6a75cb3f1
2 changed files with 25 additions and 7 deletions
|
@ -244,7 +244,10 @@ static const blackboxSimpleFieldDefinition_t blackboxGpsHFields[] = {
|
||||||
static const blackboxSimpleFieldDefinition_t blackboxSlowFields[] = {
|
static const blackboxSimpleFieldDefinition_t blackboxSlowFields[] = {
|
||||||
{"flightModeFlags", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)},
|
{"flightModeFlags", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)},
|
||||||
{"stateFlags", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)},
|
{"stateFlags", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)},
|
||||||
{"failsafePhase", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}
|
|
||||||
|
{"failsafePhase", -1, UNSIGNED, PREDICT(0), ENCODING(TAG2_3S32)},
|
||||||
|
{"rxSignalReceived", -1, UNSIGNED, PREDICT(0), ENCODING(TAG2_3S32)},
|
||||||
|
{"rxFlightChannelsValid", -1, UNSIGNED, PREDICT(0), ENCODING(TAG2_3S32)}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum BlackboxState {
|
typedef enum BlackboxState {
|
||||||
|
@ -297,6 +300,8 @@ typedef struct blackboxSlowState_t {
|
||||||
uint16_t flightModeFlags;
|
uint16_t flightModeFlags;
|
||||||
uint8_t stateFlags;
|
uint8_t stateFlags;
|
||||||
uint8_t failsafePhase;
|
uint8_t failsafePhase;
|
||||||
|
bool rxSignalReceived;
|
||||||
|
bool rxFlightChannelsValid;
|
||||||
} __attribute__((__packed__)) blackboxSlowState_t; // We pack this struct so that padding doesn't interfere with memcmp()
|
} __attribute__((__packed__)) blackboxSlowState_t; // We pack this struct so that padding doesn't interfere with memcmp()
|
||||||
|
|
||||||
//From mixer.c:
|
//From mixer.c:
|
||||||
|
@ -307,6 +312,8 @@ extern uint32_t currentTime;
|
||||||
|
|
||||||
//From rx.c:
|
//From rx.c:
|
||||||
extern uint16_t rssi;
|
extern uint16_t rssi;
|
||||||
|
bool rxSignalReceived;
|
||||||
|
bool rxFlightChannelsValid;
|
||||||
|
|
||||||
static BlackboxState blackboxState = BLACKBOX_STATE_DISABLED;
|
static BlackboxState blackboxState = BLACKBOX_STATE_DISABLED;
|
||||||
|
|
||||||
|
@ -679,11 +686,20 @@ static void writeInterframe(void)
|
||||||
* infrequently, delta updates are not reasonable, so we log independent frames. */
|
* infrequently, delta updates are not reasonable, so we log independent frames. */
|
||||||
static void writeSlowFrame(void)
|
static void writeSlowFrame(void)
|
||||||
{
|
{
|
||||||
|
int32_t values[3];
|
||||||
|
|
||||||
blackboxWrite('S');
|
blackboxWrite('S');
|
||||||
|
|
||||||
blackboxWriteUnsignedVB(slowHistory.flightModeFlags);
|
blackboxWriteUnsignedVB(slowHistory.flightModeFlags);
|
||||||
blackboxWriteUnsignedVB(slowHistory.stateFlags);
|
blackboxWriteUnsignedVB(slowHistory.stateFlags);
|
||||||
blackboxWriteUnsignedVB(slowHistory.failsafePhase);
|
|
||||||
|
/*
|
||||||
|
* Most of the time these three values will be able to pack into one byte for us:
|
||||||
|
*/
|
||||||
|
values[0] = slowHistory.failsafePhase;
|
||||||
|
values[1] = slowHistory.rxSignalReceived ? 1 : 0;
|
||||||
|
values[2] = slowHistory.rxFlightChannelsValid ? 1 : 0;
|
||||||
|
blackboxWriteTag2_3S32(values);
|
||||||
|
|
||||||
blackboxSlowFrameIterationTimer = 0;
|
blackboxSlowFrameIterationTimer = 0;
|
||||||
}
|
}
|
||||||
|
@ -696,6 +712,8 @@ static void loadSlowState(blackboxSlowState_t *slow)
|
||||||
slow->flightModeFlags = flightModeFlags;
|
slow->flightModeFlags = flightModeFlags;
|
||||||
slow->stateFlags = stateFlags;
|
slow->stateFlags = stateFlags;
|
||||||
slow->failsafePhase = failsafePhase();
|
slow->failsafePhase = failsafePhase();
|
||||||
|
slow->rxSignalReceived = rxSignalReceived;
|
||||||
|
slow->rxFlightChannelsValid = rxFlightChannelsValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -66,8 +66,8 @@ const char rcChannelLetters[] = "AERT12345678abcdefgh";
|
||||||
uint16_t rssi = 0; // range: [0;1023]
|
uint16_t rssi = 0; // range: [0;1023]
|
||||||
|
|
||||||
static bool rxDataReceived = false;
|
static bool rxDataReceived = false;
|
||||||
static bool rxSignalReceived = false;
|
bool rxSignalReceived = false;
|
||||||
static bool rxFlightChannelsValid = false;
|
bool rxFlightChannelsValid = false;
|
||||||
|
|
||||||
static uint32_t rxUpdateAt = 0;
|
static uint32_t rxUpdateAt = 0;
|
||||||
static uint32_t needRxSignalBefore = 0;
|
static uint32_t needRxSignalBefore = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue