Skip to content

Commit

Permalink
Revive MSP message for mag declination (#13232)
Browse files Browse the repository at this point in the history
Add MSP message for mag declination
  • Loading branch information
haslinghuis committed Dec 19, 2023
1 parent 15246ee commit 58933f9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/main/msp/msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,11 @@ case MSP_NAME:
#endif
break;

#ifdef USE_MAG
case MSP_COMPASS_CONFIG:
sbufWriteU16(dst, imuConfig()->mag_declination);
break;
#endif
// Deprecated in favor of MSP_MOTOR_TELEMETY as of API version 1.42
// Used by DJI FPV
case MSP_ESC_SENSOR_DATA:
Expand Down Expand Up @@ -2842,7 +2847,15 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
gpsConfigMutable()->gps_ublox_use_galileo = sbufReadU8(src);
}
break;
#endif

#ifdef USE_MAG
case MSP_SET_COMPASS_CONFIG:
imuConfigMutable()->mag_declination = sbufReadU16(src);
break;
#endif

#ifdef USE_GPS
#ifdef USE_GPS_RESCUE
case MSP_SET_GPS_RESCUE:
gpsRescueConfigMutable()->maxRescueAngle = sbufReadU16(src);
Expand Down
4 changes: 2 additions & 2 deletions src/main/msp/msp_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
#define MSP_BATTERY_STATE 130 //out message Connected/Disconnected, Voltage, Current Used
#define MSP_MOTOR_CONFIG 131 //out message Motor configuration (min/max throttle, etc)
#define MSP_GPS_CONFIG 132 //out message GPS configuration
//DEPRECATED - #define MSP_COMPASS_CONFIG 133 //out message Compass configuration
#define MSP_COMPASS_CONFIG 133 //out message Compass configuration
#define MSP_ESC_SENSOR_DATA 134 //out message Extra ESC data from 32-Bit ESCs (Temperature, RPM)
#define MSP_GPS_RESCUE 135 //out message GPS Rescue angle, returnAltitude, descentDistance, groundSpeed, sanityChecks and minSats
#define MSP_GPS_RESCUE_PIDS 136 //out message GPS Rescue throttleP and velocity PIDS + yaw P
Expand Down Expand Up @@ -319,7 +319,7 @@
#define MSP_SET_LED_STRIP_MODECOLOR 221 //in message Set LED strip mode_color settings
#define MSP_SET_MOTOR_CONFIG 222 //out message Motor configuration (min/max throttle, etc)
#define MSP_SET_GPS_CONFIG 223 //out message GPS configuration
//DEPRECATED - #define MSP_SET_COMPASS_CONFIG 224 //out message Compass configuration
#define MSP_SET_COMPASS_CONFIG 224 //out message Compass configuration
#define MSP_SET_GPS_RESCUE 225 //in message GPS Rescue angle, returnAltitude, descentDistance, groundSpeed and sanityChecks
#define MSP_SET_GPS_RESCUE_PIDS 226 //in message GPS Rescue throttleP and velocity PIDS + yaw P
#define MSP_SET_VTXTABLE_BAND 227 //in message set vtxTable band/channel data (one band at a time)
Expand Down

0 comments on commit 58933f9

Please sign in to comment.