mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-23 16:25:26 +03:00
Merge pull request #4050 from shellixyz/32bits_debug_array
Make the debug array cells int32 and increase cell count to 8
This commit is contained in:
commit
4d718e2009
11 changed files with 27 additions and 15 deletions
|
@ -270,6 +270,10 @@ static const blackboxDeltaFieldDefinition_t blackboxMainFields[] = {
|
|||
{"debug", 1, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), FLIGHT_LOG_FIELD_CONDITION_DEBUG},
|
||||
{"debug", 2, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), FLIGHT_LOG_FIELD_CONDITION_DEBUG},
|
||||
{"debug", 3, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), FLIGHT_LOG_FIELD_CONDITION_DEBUG},
|
||||
{"debug", 4, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), FLIGHT_LOG_FIELD_CONDITION_DEBUG},
|
||||
{"debug", 5, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), FLIGHT_LOG_FIELD_CONDITION_DEBUG},
|
||||
{"debug", 6, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), FLIGHT_LOG_FIELD_CONDITION_DEBUG},
|
||||
{"debug", 7, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), FLIGHT_LOG_FIELD_CONDITION_DEBUG},
|
||||
/* Motors only rarely drops under minthrottle (when stick falls below mincommand), so predict minthrottle for it and use *unsigned* encoding (which is large for negative numbers but more compact for positive ones): */
|
||||
{"motor", 0, UNSIGNED, .Ipredict = PREDICT(MINTHROTTLE), .Iencode = ENCODING(UNSIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_MOTORS_1)},
|
||||
/* Subsequent motors base their I-frame values on the first one, P-frame values on the average of last two frames: */
|
||||
|
@ -396,7 +400,7 @@ typedef struct blackboxMainState_s {
|
|||
int16_t gyroADC[XYZ_AXIS_COUNT];
|
||||
int16_t accADC[XYZ_AXIS_COUNT];
|
||||
int16_t attitude[XYZ_AXIS_COUNT];
|
||||
int16_t debug[DEBUG16_VALUE_COUNT];
|
||||
int32_t debug[DEBUG32_VALUE_COUNT];
|
||||
int16_t motor[MAX_SUPPORTED_MOTORS];
|
||||
int16_t servo[MAX_SUPPORTED_SERVOS];
|
||||
|
||||
|
@ -755,7 +759,7 @@ static void writeIntraframe(void)
|
|||
blackboxWriteSigned16VBArray(blackboxCurrent->attitude, XYZ_AXIS_COUNT);
|
||||
|
||||
if (testBlackboxCondition(FLIGHT_LOG_FIELD_CONDITION_DEBUG)) {
|
||||
blackboxWriteSigned16VBArray(blackboxCurrent->debug, DEBUG16_VALUE_COUNT);
|
||||
blackboxWriteSignedVBArray(blackboxCurrent->debug, DEBUG32_VALUE_COUNT);
|
||||
}
|
||||
|
||||
//Motors can be below minthrottle when disarmed, but that doesn't happen much
|
||||
|
@ -966,7 +970,7 @@ static void writeInterframe(void)
|
|||
blackboxWriteMainStateArrayUsingAveragePredictor(offsetof(blackboxMainState_t, accADC), XYZ_AXIS_COUNT);
|
||||
blackboxWriteMainStateArrayUsingAveragePredictor(offsetof(blackboxMainState_t, attitude), XYZ_AXIS_COUNT);
|
||||
if (testBlackboxCondition(FLIGHT_LOG_FIELD_CONDITION_DEBUG)) {
|
||||
blackboxWriteMainStateArrayUsingAveragePredictor(offsetof(blackboxMainState_t, debug), DEBUG16_VALUE_COUNT);
|
||||
blackboxWriteMainStateArrayUsingAveragePredictor(offsetof(blackboxMainState_t, debug), DEBUG32_VALUE_COUNT);
|
||||
}
|
||||
blackboxWriteMainStateArrayUsingAveragePredictor(offsetof(blackboxMainState_t, motor), getMotorCount());
|
||||
|
||||
|
@ -1335,7 +1339,7 @@ static void loadMainState(timeUs_t currentTimeUs)
|
|||
blackboxCurrent->attitude[1] = attitude.values.pitch;
|
||||
blackboxCurrent->attitude[2] = attitude.values.yaw;
|
||||
|
||||
for (int i = 0; i < DEBUG16_VALUE_COUNT; i++) {
|
||||
for (int i = 0; i < DEBUG32_VALUE_COUNT; i++) {
|
||||
blackboxCurrent->debug[i] = debug[i];
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
timeUs_t sectionTimes[2][4];
|
||||
#endif
|
||||
|
||||
int16_t debug[DEBUG16_VALUE_COUNT];
|
||||
int32_t debug[DEBUG32_VALUE_COUNT];
|
||||
uint8_t debugMode;
|
||||
|
||||
#if defined(USE_DEBUG_TRACE)
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define DEBUG16_VALUE_COUNT 4
|
||||
extern int16_t debug[DEBUG16_VALUE_COUNT];
|
||||
#define DEBUG32_VALUE_COUNT 8
|
||||
extern int32_t debug[DEBUG32_VALUE_COUNT];
|
||||
extern uint8_t debugMode;
|
||||
|
||||
#define DEBUG_SET(mode, index, value) {if (debugMode == (mode)) {debug[(index)] = (value);}}
|
||||
|
|
|
@ -787,11 +787,17 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
// output some useful QA statistics
|
||||
// debug[x] = ((hse_value / 1000000) * 1000) + (SystemCoreClock / 1000000); // XX0YY [crystal clock : core clock]
|
||||
|
||||
for (int i = 0; i < DEBUG16_VALUE_COUNT; i++) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
sbufWriteU16(dst, debug[i]); // 4 variables are here for general monitoring purpose
|
||||
}
|
||||
break;
|
||||
|
||||
case MSP2_INAV_DEBUG:
|
||||
for (int i = 0; i < DEBUG32_VALUE_COUNT; i++) {
|
||||
sbufWriteU32(dst, debug[i]); // 8 variables are here for general monitoring purpose
|
||||
}
|
||||
break;
|
||||
|
||||
case MSP_UID:
|
||||
sbufWriteU32(dst, U_ID_0);
|
||||
sbufWriteU32(dst, U_ID_1);
|
||||
|
|
|
@ -43,3 +43,5 @@
|
|||
#define MSP2_INAV_OSD_SET_PREFERENCES 0x2017
|
||||
|
||||
#define MSP2_INAV_SELECT_BATTERY_PROFILE 0x2018
|
||||
|
||||
#define MSP2_INAV_DEBUG 0x2019
|
||||
|
|
|
@ -410,7 +410,7 @@ int16_t rcData[MAX_SUPPORTED_RC_CHANNEL_COUNT];
|
|||
uint8_t armingFlags;
|
||||
int16_t rcCommand[4];
|
||||
uint32_t rcModeActivationMask;
|
||||
int16_t debug[DEBUG16_VALUE_COUNT];
|
||||
int32_t debug[DEBUG32_VALUE_COUNT];
|
||||
bool isUsingSticksToArm = true;
|
||||
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ int16_t heading;
|
|||
gyro_t gyro;
|
||||
int32_t magADC[XYZ_AXIS_COUNT];
|
||||
int32_t BaroAlt;
|
||||
int16_t debug[DEBUG16_VALUE_COUNT];
|
||||
int32_t debug[DEBUG32_VALUE_COUNT];
|
||||
|
||||
uint8_t stateFlags;
|
||||
uint16_t flightModeFlags;
|
||||
|
@ -179,4 +179,4 @@ bool isBaroCalibrationComplete(void) { return true; }
|
|||
void performBaroCalibrationCycle(void) {}
|
||||
int32_t baroCalculateAltitude(void) { return 0; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -373,7 +373,7 @@ int16_t rcCommand[4];
|
|||
int16_t rcData[MAX_SUPPORTED_RC_CHANNEL_COUNT];
|
||||
|
||||
uint32_t rcModeActivationMask;
|
||||
int16_t debug[DEBUG16_VALUE_COUNT];
|
||||
int32_t debug[DEBUG32_VALUE_COUNT];
|
||||
|
||||
uint8_t stateFlags;
|
||||
uint16_t flightModeFlags;
|
||||
|
|
|
@ -134,7 +134,7 @@ int32_t accSum[XYZ_AXIS_COUNT];
|
|||
int16_t accADC[XYZ_AXIS_COUNT];
|
||||
int16_t gyroADC[XYZ_AXIS_COUNT];
|
||||
int16_t magADC[XYZ_AXIS_COUNT];
|
||||
int16_t debug[DEBUG16_VALUE_COUNT];
|
||||
int32_t debug[DEBUG32_VALUE_COUNT];
|
||||
|
||||
uint8_t stateFlags;
|
||||
uint16_t flightModeFlags;
|
||||
|
|
|
@ -511,7 +511,7 @@ void featureSet(uint32_t mask) {UNUSED(mask);}
|
|||
void featureClearAll() {}
|
||||
uint32_t featureMask(void) {return 0;}
|
||||
// from debug.c
|
||||
int16_t debug[DEBUG16_VALUE_COUNT];
|
||||
int32_t debug[DEBUG32_VALUE_COUNT];
|
||||
// from gps.c
|
||||
#define GPS_SV_MAXSATS 16
|
||||
int32_t GPS_coord[2]; // LAT/LON
|
||||
|
|
|
@ -163,7 +163,7 @@ TEST(TelemetryHottTest, PrepareGPSMessage_Altitude1m)
|
|||
|
||||
extern "C" {
|
||||
|
||||
int16_t debug[DEBUG16_VALUE_COUNT];
|
||||
int32_t debug[DEBUG32_VALUE_COUNT];
|
||||
|
||||
uint32_t stateFlags;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue