Skip to content

Commit c375104

Browse files
committed
feat(msp): add MSP2_INAV_WIND (0x2231) to expose wind estimator
1 parent 858c9a4 commit c375104

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

src/main/fc/fc_msp.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@
131131
#include "sensors/opflow.h"
132132
#include "sensors/temperature.h"
133133
#include "sensors/esc_sensor.h"
134+
#ifdef USE_WIND_ESTIMATOR
135+
#include "flight/wind_estimator.h"
136+
#endif
134137

135138
#include "telemetry/telemetry.h"
136139

@@ -1595,6 +1598,19 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
15951598
#endif
15961599
break;
15971600

1601+
case MSP2_INAV_WIND:
1602+
#ifdef USE_WIND_ESTIMATOR
1603+
{
1604+
uint16_t windAngle = 0;
1605+
sbufWriteU16(dst, (uint16_t)getEstimatedHorizontalWindSpeed(&windAngle));
1606+
sbufWriteU16(dst, windAngle / 100);
1607+
}
1608+
#else
1609+
sbufWriteU16(dst, 0);
1610+
sbufWriteU16(dst, 0);
1611+
#endif
1612+
break;
1613+
15981614
case MSP2_INAV_MIXER:
15991615
sbufWriteU8(dst, mixerConfig()->motorDirectionInverted);
16001616
sbufWriteU8(dst, 0);

src/main/msp/msp_protocol_v2_inav.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,6 @@
132132
#define MSP2_INAV_SET_WP_INDEX 0x2221 //in message jump to waypoint N during active WP mission; payload: U8 wp_index (0-based, relative to mission start)
133133
#define MSP2_INAV_SET_CRUISE_HEADING 0x2223 //in message set heading while in Cruise/Course Hold mode; payload: I32 heading_centidegrees (0-35999)
134134

135-
#define MSP2_INAV_SET_AUX_RC 0x2230
135+
#define MSP2_INAV_SET_AUX_RC 0x2230
136+
137+
#define MSP2_INAV_WIND 0x2231

0 commit comments

Comments
 (0)