Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Blackbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ Available debug modes include:
- `POS_EST` - Position estimation debugging
- `GPS` - GPS debugging
- `ALTITUDE` - Altitude estimation debugging
- `MAG` - Raw, uncalibrated magnetometer samples (useful for external compass calibration)
- And 20+ other modes for specific subsystems

To use debug mode logging:
Expand Down
2 changes: 2 additions & 0 deletions docs/Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -796,10 +796,12 @@ Defines debug values exposed in debug variables (developer / debugging setting)
| LULU | |
| SBUS2 | |
| OSD_REFRESH | |
| MAG_CALIB | |
| VTOL_TRANSITION | |
| VTOL_MC_PROTECT | |
| TERRAIN_NAV | |
| ESC | |
| MAG | |

---

Expand Down
1 change: 1 addition & 0 deletions src/main/build/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ typedef enum {
DEBUG_VTOL_MC_PROTECT,
DEBUG_TERRAIN_NAV,
DEBUG_ESC,
DEBUG_MAG,
DEBUG_COUNT // also update debugModeNames in cli.c
} debugType_e;

Expand Down
4 changes: 3 additions & 1 deletion src/main/drivers/compass/compass_mlx90393.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ static bool mlx90393Read(magDev_t * mag)

uint8_t buf[7] = {0};

busReadBuf(mag->busDev, MLX90393_READ_MEASUREMENT | MLX90393_MEASURE_3D, buf, 7);
if (!busReadBuf(mag->busDev, MLX90393_READ_MEASUREMENT | MLX90393_MEASURE_3D, buf, sizeof(buf))) {
return false;
}

mag->magADCRaw[X] = ((short)(buf[1] << 8 | buf[2]));
mag->magADCRaw[Y] = ((short)(buf[3] << 8 | buf[4]));
Expand Down
3 changes: 2 additions & 1 deletion src/main/fc/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ static const char *debugModeNames[DEBUG_COUNT] = {
"VTOL_TRANSITION",
"VTOL_MC_PROTECT",
"TERRAIN_NAV",
"ESC"
"ESC",
"MAG"
};

/* Sensor names (used in lookup tables for *_hardware settings and in status
Expand Down
3 changes: 2 additions & 1 deletion src/main/fc/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ tables:
"VIBE", "CRUISE", "REM_FLIGHT_TIME", "SMARTAUDIO", "ACC",
"NAV_YAW", "PCF8574", "DYN_GYRO_LPF", "AUTOLEVEL", "ALTITUDE",
"AUTOTRIM", "AUTOTUNE", "RATE_DYNAMICS", "LANDING", "POS_EST",
"ADAPTIVE_FILTER", "HEADTRACKER", "GPS", "LULU", "SBUS2", "OSD_REFRESH", "VTOL_TRANSITION", "VTOL_MC_PROTECT", "TERRAIN_NAV", "ESC"]
"ADAPTIVE_FILTER", "HEADTRACKER", "GPS", "LULU", "SBUS2", "OSD_REFRESH",
"MAG_CALIB", "VTOL_TRANSITION", "VTOL_MC_PROTECT", "TERRAIN_NAV", "ESC", "MAG"]
- name: vtol_mc_protection_mode
values: ["OFF", "NAV", "NAV_AND_STABILIZED"]
- name: aux_operator
Expand Down
1 change: 1 addition & 0 deletions src/main/sensors/compass.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ void compassUpdate(timeUs_t currentTimeUs)

for (int axis = 0; axis < XYZ_AXIS_COUNT; axis++) {
mag.magADC[axis] = mag.dev.magADCRaw[axis]; // int32_t copy to work with
DEBUG_SET(DEBUG_MAG, axis, mag.dev.magADCRaw[axis]);
Comment thread
qodo-free-for-open-source-projects[bot] marked this conversation as resolved.
}

if (STATE(CALIBRATE_MAG)) {
Expand Down
Loading