Added test data. Improved build #defines

This commit is contained in:
Martin Budden 2016-11-14 07:47:20 +00:00
parent ad71436df3
commit 4a225cf9b1
3 changed files with 33 additions and 31 deletions

View File

@ -23,20 +23,6 @@
#ifdef SERIAL_RX
#include "build/version.h"
#if (FC_VERSION_MAJOR == 3) // not a very good way of finding out if this is betaflight or Cleanflight
#define BETAFLIGHT
#else
#define CLEANFLIGHT
#endif
#ifdef CLEANFLIGHT
#include "config/parameter_group.h"
#include "config/parameter_group_ids.h"
#include "fc/fc_debug.h"
#endif
#include "build/build_config.h"
#include "build/debug.h"
@ -191,7 +177,7 @@ bool crsfInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig)
return false;
}
#if defined(TELEMETRY) && !defined(CLEANFLIGHT)
#if defined(TELEMETRY) && defined(TELEMETRY_CRSF)
const bool portShared = telemetryCheckRxPortShared(portConfig);
#else
const bool portShared = false;
@ -199,7 +185,7 @@ bool crsfInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig)
serialPort_t *serialPort = openSerialPort(portConfig->identifier, FUNCTION_RX_SERIAL, crsfDataReceive, CRSF_BAUDRATE, portShared ? MODE_RXTX : MODE_RX, CRSF_PORT_OPTIONS);
#if defined(TELEMETRY) && !defined(CLEANFLIGHT)
#if defined(TELEMETRY) && defined(TELEMETRY_CRSF)
if (portShared) {
telemetrySharedPort = serialPort;
}

View File

@ -127,18 +127,17 @@ TEST(CrossFireTest, TestCrsfFrameStatusUnpacking)
crsfFrame.frame.frameLength = 0;
crsfFrame.frame.type = CRSF_FRAMETYPE_RC_CHANNELS_PACKED;
// 16 11-bit channels packed into 22 bytes of data
crsfFrame.frame.payload[0] = 0xFF;
crsfFrame.frame.payload[1] = 0xFF;
// !!TODO add more test data
crsfFrame.frame.payload[2] = 0;
crsfFrame.frame.payload[3] = 0;
crsfFrame.frame.payload[4] = 0;
crsfFrame.frame.payload[5] = 0;
crsfFrame.frame.payload[6] = 0;
crsfFrame.frame.payload[7] = 0;
crsfFrame.frame.payload[8] = 0;
crsfFrame.frame.payload[9] = 0;
crsfFrame.frame.payload[10] = 0;
crsfFrame.frame.payload[0] = 0xFF; // bits 0-7
crsfFrame.frame.payload[1] = 0xFF; // bits 8-15
crsfFrame.frame.payload[2] = 0x00; // bits 16-23
crsfFrame.frame.payload[3] = 0x00; // bits 24-31
crsfFrame.frame.payload[4] = 0x58; // bits 32-39 0101100.
crsfFrame.frame.payload[5] = 0x01; // bits 40-47 ....0001
crsfFrame.frame.payload[6] = 0x00; // bits 48-55 0.......
crsfFrame.frame.payload[7] = 0xf0; // bits 56-64 11110000
crsfFrame.frame.payload[8] = 0x01; // bits 65-71 ......01
crsfFrame.frame.payload[9] = 0x60; // bits 72-79 011.....
crsfFrame.frame.payload[10] = 0xe2; // bits 80-87 11100010
crsfFrame.frame.payload[11] = 0;
crsfFrame.frame.payload[12] = 0;
crsfFrame.frame.payload[13] = 0;
@ -161,11 +160,11 @@ TEST(CrossFireTest, TestCrsfFrameStatusUnpacking)
EXPECT_EQ(0x7ff, crsfChannelData[0]);
EXPECT_EQ(0x1f, crsfChannelData[1]);
EXPECT_EQ(0, crsfChannelData[2]);
EXPECT_EQ(0, crsfChannelData[3]);
EXPECT_EQ(172, crsfChannelData[3]); // 172 = 0x0ac, 0001 0101100, bits 33-43
EXPECT_EQ(0, crsfChannelData[4]);
EXPECT_EQ(0, crsfChannelData[5]);
EXPECT_EQ(992, crsfChannelData[5]); // 992 = 0x3e0, 01 1110000 0, bits 55-65
EXPECT_EQ(0, crsfChannelData[6]);
EXPECT_EQ(0, crsfChannelData[7]);
EXPECT_EQ(1811, crsfChannelData[7]); // 1811 = 0x713, 1110 0010 011, bits 77-87
EXPECT_EQ(0, crsfChannelData[8]);
EXPECT_EQ(0, crsfChannelData[9]);
EXPECT_EQ(0, crsfChannelData[10]);

View File

@ -24,7 +24,24 @@
#define GPS
#define DISPLAY
#define SERIAL_RX
#define USE_RX_MSP
#define USE_SERIALRX_CRSF // Team Black Sheep Crossfire protocol
#define USE_SERIALRX_SPEKTRUM // DSM2 and DSMX protocol
#define USE_SERIALRX_SBUS // Frsky and Futaba receivers
#define USE_SERIALRX_IBUS // FlySky and Turnigy receivers
#define USE_SERIALRX_JETIEXBUS
#define USE_SERIALRX_SUMD // Graupner Hott protocol
#define USE_SERIALRX_SUMH // Graupner legacy protocol
#define USE_SERIALRX_XBUS // JR
#define TELEMETRY
#define TELEMETRY_CRSF
#define TELEMETRY_FRSKY
#define TELEMETRY_HOTT
#define TELEMETRY_IBUS
#define TELEMETRY_JETIEXBUS
#define TELEMETRY_LTM
#define TELEMETRY_MAVLINK
#define TELEMETRY_SMARTPORT
#define LED_STRIP
#define USE_SERVOS
#define TRANSPONDER