mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-24 08:45:31 +03:00
Merge pull request #3522 from giacomo892/wind_speed_BB_slow
Log estimated wind speed to BB slow frames
This commit is contained in:
commit
d7c8a6e84d
1 changed files with 13 additions and 0 deletions
|
@ -75,6 +75,7 @@
|
|||
#include "sensors/pitotmeter.h"
|
||||
#include "sensors/rangefinder.h"
|
||||
#include "sensors/sensors.h"
|
||||
#include "flight/wind_estimator.h"
|
||||
|
||||
|
||||
#if defined(ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT)
|
||||
|
@ -341,6 +342,9 @@ static const blackboxSimpleFieldDefinition_t blackboxSlowFields[] = {
|
|||
{"hwHealthStatus", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)},
|
||||
{"powerSupplyImpedance", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)},
|
||||
{"sagCompensatedVBat", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)},
|
||||
{"wind", 0, SIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)},
|
||||
{"wind", 1, SIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)},
|
||||
{"wind", 2, SIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)},
|
||||
};
|
||||
|
||||
typedef enum BlackboxState {
|
||||
|
@ -438,6 +442,7 @@ typedef struct blackboxSlowState_s {
|
|||
int32_t hwHealthStatus;
|
||||
uint16_t powerSupplyImpedance;
|
||||
uint16_t sagCompensatedVBat;
|
||||
int16_t wind[XYZ_AXIS_COUNT];
|
||||
} __attribute__((__packed__)) blackboxSlowState_t; // We pack this struct so that padding doesn't interfere with memcmp()
|
||||
|
||||
//From rc_controls.c
|
||||
|
@ -1022,6 +1027,8 @@ static void writeSlowFrame(void)
|
|||
|
||||
blackboxWriteUnsignedVB(slowHistory.powerSupplyImpedance);
|
||||
blackboxWriteUnsignedVB(slowHistory.sagCompensatedVBat);
|
||||
|
||||
blackboxWriteSigned16VBArray(slowHistory.wind, XYZ_AXIS_COUNT);
|
||||
|
||||
blackboxSlowFrameIterationTimer = 0;
|
||||
}
|
||||
|
@ -1045,6 +1052,12 @@ static void loadSlowState(blackboxSlowState_t *slow)
|
|||
(getHwPitotmeterStatus() << 2 * 6);
|
||||
slow->powerSupplyImpedance = getPowerSupplyImpedance();
|
||||
slow->sagCompensatedVBat = getBatterySagCompensatedVoltage();
|
||||
|
||||
for (int i = 0; i < XYZ_AXIS_COUNT; i++)
|
||||
{
|
||||
slow->wind[i] = getEstimatedWindSpeed(i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue