mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 17:55:30 +03:00
CRSF Flight Mode Sensor Value update (#13854)
* CRSF Flight Mode Sensor Value update * Fix FS FM * Add ? for GPS not available * Need to check define * better name * Update mode and test unit * Fixes review CT * Fixes review JimB40 * Apply ctz comment * Update isAllowArmingWithoutFix * Fix fs/resc sw * Add required sats * Update comments
This commit is contained in:
parent
654d18ced4
commit
698b8616f9
7 changed files with 47 additions and 24 deletions
|
@ -44,6 +44,8 @@ extern "C" {
|
|||
#include "telemetry/msp_shared.h"
|
||||
#include "rx/crsf_protocol.h"
|
||||
#include "rx/expresslrs_telemetry.h"
|
||||
#include "fc/rc_modes.h"
|
||||
#include "flight/gps_rescue.h"
|
||||
#include "flight/imu.h"
|
||||
|
||||
#include "sensors/battery.h"
|
||||
|
@ -70,6 +72,7 @@ extern "C" {
|
|||
|
||||
PG_REGISTER(telemetryConfig_t, telemetryConfig, PG_TELEMETRY_CONFIG, 0);
|
||||
PG_REGISTER(systemConfig_t, systemConfig, PG_SYSTEM_CONFIG, 0);
|
||||
PG_REGISTER(gpsRescueConfig_t, gpsRescueConfig, PG_GPS_RESCUE, 0);
|
||||
}
|
||||
|
||||
#include "unittest_macros.h"
|
||||
|
@ -209,10 +212,10 @@ TEST(RxSpiExpressLrsTelemetryUnitTest, TestFlightMode)
|
|||
getNextTelemetryPayload(&payloadSize, &payload);
|
||||
EXPECT_EQ(currentPayloadIndex, 0);
|
||||
|
||||
EXPECT_EQ('W', payload[3]);
|
||||
EXPECT_EQ('A', payload[4]);
|
||||
EXPECT_EQ('I', payload[5]);
|
||||
EXPECT_EQ('T', payload[6]);
|
||||
EXPECT_EQ('A', payload[3]);
|
||||
EXPECT_EQ('C', payload[4]);
|
||||
EXPECT_EQ('R', payload[5]);
|
||||
EXPECT_EQ('O', payload[6]);
|
||||
EXPECT_EQ('*', payload[7]);
|
||||
EXPECT_EQ(0, payload[8]);
|
||||
|
||||
|
@ -464,4 +467,9 @@ extern "C" {
|
|||
|
||||
timeUs_t rxFrameTimeUs(void) { return 0; }
|
||||
|
||||
bool IS_RC_MODE_ACTIVE(boxId_e) { return false; }
|
||||
|
||||
int getArmingDisableFlags(void) { return 0; }
|
||||
|
||||
bool gpsRescueIsConfigured(void) { return false; }
|
||||
}
|
||||
|
|
|
@ -44,7 +44,9 @@ extern "C" {
|
|||
#include "drivers/system.h"
|
||||
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/rc_modes.h"
|
||||
#include "config/config.h"
|
||||
#include "flight/gps_rescue.h"
|
||||
#include "flight/imu.h"
|
||||
|
||||
#include "io/serial.h"
|
||||
|
@ -85,6 +87,7 @@ extern "C" {
|
|||
PG_REGISTER(systemConfig_t, systemConfig, PG_SYSTEM_CONFIG, 0);
|
||||
PG_REGISTER(rxConfig_t, rxConfig, PG_RX_CONFIG, 0);
|
||||
PG_REGISTER(accelerometerConfig_t, accelerometerConfig, PG_ACCELEROMETER_CONFIG,0);
|
||||
PG_REGISTER(gpsRescueConfig_t, gpsRescueConfig, PG_GPS_RESCUE, 0);
|
||||
|
||||
extern bool crsfFrameDone;
|
||||
extern crsfFrame_t crsfFrame;
|
||||
|
@ -324,4 +327,8 @@ extern "C" {
|
|||
}
|
||||
|
||||
timeUs_t rxFrameTimeUs(void) { return 0; }
|
||||
|
||||
bool IS_RC_MODE_ACTIVE(boxId_e) { return false; }
|
||||
|
||||
bool gpsRescueIsConfigured(void) { return false; }
|
||||
}
|
||||
|
|
|
@ -43,8 +43,10 @@ extern "C" {
|
|||
|
||||
#include "config/config.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/rc_modes.h"
|
||||
|
||||
#include "flight/pid.h"
|
||||
#include "flight/gps_rescue.h"
|
||||
#include "flight/imu.h"
|
||||
|
||||
#include "io/gps.h"
|
||||
|
@ -79,6 +81,7 @@ extern "C" {
|
|||
PG_REGISTER(systemConfig_t, systemConfig, PG_SYSTEM_CONFIG, 0);
|
||||
PG_REGISTER(rxConfig_t, rxConfig, PG_RX_CONFIG, 0);
|
||||
PG_REGISTER(accelerometerConfig_t, accelerometerConfig, PG_ACCELEROMETER_CONFIG, 0);
|
||||
PG_REGISTER(gpsRescueConfig_t, gpsRescueConfig, PG_GPS_RESCUE, 0);
|
||||
}
|
||||
|
||||
#include "unittest_macros.h"
|
||||
|
@ -264,10 +267,10 @@ TEST(TelemetryCrsfTest, TestFlightMode)
|
|||
EXPECT_EQ(CRSF_SYNC_BYTE, frame[0]); // address
|
||||
EXPECT_EQ(7, frame[1]); // length
|
||||
EXPECT_EQ(0x21, frame[2]); // type
|
||||
EXPECT_EQ('S', frame[3]);
|
||||
EXPECT_EQ('T', frame[4]);
|
||||
EXPECT_EQ('A', frame[5]);
|
||||
EXPECT_EQ('B', frame[6]);
|
||||
EXPECT_EQ('A', frame[3]);
|
||||
EXPECT_EQ('N', frame[4]);
|
||||
EXPECT_EQ('G', frame[5]);
|
||||
EXPECT_EQ('L', frame[6]);
|
||||
EXPECT_EQ(0, frame[7]);
|
||||
EXPECT_EQ(crfsCrc(frame, frameLen), frame[8]);
|
||||
|
||||
|
@ -389,4 +392,6 @@ bool handleMspFrame(uint8_t *, uint8_t, uint8_t *) { return false; }
|
|||
bool isBatteryVoltageConfigured(void) { return true; }
|
||||
bool isAmperageConfigured(void) { return true; }
|
||||
timeUs_t rxFrameTimeUs(void) { return 0; }
|
||||
bool IS_RC_MODE_ACTIVE(boxId_e) { return false; }
|
||||
bool gpsRescueIsConfigured(void) { return false; }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue