mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 09:45:37 +03:00
Messed up the numbers, now changed to correct RJ01.
This commit is contained in:
parent
e8e53ab7f1
commit
d3b21f8e36
3 changed files with 22 additions and 22 deletions
|
@ -102,7 +102,7 @@ void updateSerialRxFunctionConstraint(functionConstraint_t *functionConstraintTo
|
||||||
sumhUpdateSerialRxFunctionConstraint(functionConstraintToUpdate);
|
sumhUpdateSerialRxFunctionConstraint(functionConstraintToUpdate);
|
||||||
break;
|
break;
|
||||||
case SERIALRX_XBUS_MODE_B:
|
case SERIALRX_XBUS_MODE_B:
|
||||||
case SERIALRX_XBUS_MODE_B_JR01:
|
case SERIALRX_XBUS_MODE_B_RJ01:
|
||||||
xBusUpdateSerialRxFunctionConstraint(functionConstraintToUpdate);
|
xBusUpdateSerialRxFunctionConstraint(functionConstraintToUpdate);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ void serialRxInit(rxConfig_t *rxConfig)
|
||||||
enabled = sumhInit(rxConfig, &rxRuntimeConfig, &rcReadRawFunc);
|
enabled = sumhInit(rxConfig, &rxRuntimeConfig, &rcReadRawFunc);
|
||||||
break;
|
break;
|
||||||
case SERIALRX_XBUS_MODE_B:
|
case SERIALRX_XBUS_MODE_B:
|
||||||
case SERIALRX_XBUS_MODE_B_JR01:
|
case SERIALRX_XBUS_MODE_B_RJ01:
|
||||||
enabled = xBusInit(rxConfig, &rxRuntimeConfig, &rcReadRawFunc);
|
enabled = xBusInit(rxConfig, &rxRuntimeConfig, &rcReadRawFunc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ bool isSerialRxFrameComplete(rxConfig_t *rxConfig)
|
||||||
case SERIALRX_SUMH:
|
case SERIALRX_SUMH:
|
||||||
return sumhFrameComplete();
|
return sumhFrameComplete();
|
||||||
case SERIALRX_XBUS_MODE_B:
|
case SERIALRX_XBUS_MODE_B:
|
||||||
case SERIALRX_XBUS_MODE_B_JR01:
|
case SERIALRX_XBUS_MODE_B_RJ01:
|
||||||
return xBusFrameComplete();
|
return xBusFrameComplete();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -33,8 +33,8 @@ typedef enum {
|
||||||
SERIALRX_SUMD = 3,
|
SERIALRX_SUMD = 3,
|
||||||
SERIALRX_SUMH = 4,
|
SERIALRX_SUMH = 4,
|
||||||
SERIALRX_XBUS_MODE_B = 5,
|
SERIALRX_XBUS_MODE_B = 5,
|
||||||
SERIALRX_XBUS_MODE_B_JR01 = 6,
|
SERIALRX_XBUS_MODE_B_RJ01 = 6,
|
||||||
SERIALRX_PROVIDER_MAX = SERIALRX_XBUS_MODE_B_JR01
|
SERIALRX_PROVIDER_MAX = SERIALRX_XBUS_MODE_B_RJ01
|
||||||
} SerialRXType;
|
} SerialRXType;
|
||||||
|
|
||||||
#define SERIALRX_PROVIDER_COUNT (SERIALRX_PROVIDER_MAX + 1)
|
#define SERIALRX_PROVIDER_COUNT (SERIALRX_PROVIDER_MAX + 1)
|
||||||
|
|
|
@ -35,18 +35,18 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#define XBUS_CHANNEL_COUNT 12
|
#define XBUS_CHANNEL_COUNT 12
|
||||||
#define XBUS_JR01_CHANNEL_COUNT 12
|
#define XBUS_RJ01_CHANNEL_COUNT 12
|
||||||
|
|
||||||
// Frame is: ID(1 byte) + 12*channel(2 bytes) + CRC(2 bytes) = 27
|
// Frame is: ID(1 byte) + 12*channel(2 bytes) + CRC(2 bytes) = 27
|
||||||
#define XBUS_FRAME_SIZE 27
|
#define XBUS_FRAME_SIZE 27
|
||||||
|
|
||||||
#define XBUS_JR01_FRAME_SIZE 33
|
#define XBUS_RJ01_FRAME_SIZE 33
|
||||||
|
|
||||||
#define XBUS_CRC_AND_VALUE 0x8000
|
#define XBUS_CRC_AND_VALUE 0x8000
|
||||||
#define XBUS_CRC_POLY 0x1021
|
#define XBUS_CRC_POLY 0x1021
|
||||||
|
|
||||||
#define XBUS_BAUDRATE 115200
|
#define XBUS_BAUDRATE 115200
|
||||||
#define XBUS_JR01_BAUDRATE 250000
|
#define XBUS_RJ01_BAUDRATE 250000
|
||||||
#define XBUS_MAX_FRAME_TIME 8000
|
#define XBUS_MAX_FRAME_TIME 8000
|
||||||
|
|
||||||
// NOTE!
|
// NOTE!
|
||||||
|
@ -76,8 +76,8 @@ static uint8_t xBusProvider;
|
||||||
|
|
||||||
|
|
||||||
// Use max values for ram areas
|
// Use max values for ram areas
|
||||||
static volatile uint8_t xBusFrame[XBUS_JR01_FRAME_SIZE];
|
static volatile uint8_t xBusFrame[XBUS_RJ01_FRAME_SIZE];
|
||||||
static uint16_t xBusChannelData[XBUS_JR01_CHANNEL_COUNT];
|
static uint16_t xBusChannelData[XBUS_RJ01_CHANNEL_COUNT];
|
||||||
|
|
||||||
static void xBusDataReceive(uint16_t c);
|
static void xBusDataReceive(uint16_t c);
|
||||||
static uint16_t xBusReadRawRC(rxRuntimeConfig_t *rxRuntimeConfig, uint8_t chan);
|
static uint16_t xBusReadRawRC(rxRuntimeConfig_t *rxRuntimeConfig, uint8_t chan);
|
||||||
|
@ -87,7 +87,7 @@ static serialPort_t *xBusPort;
|
||||||
void xBusUpdateSerialRxFunctionConstraint(functionConstraint_t *functionConstraint)
|
void xBusUpdateSerialRxFunctionConstraint(functionConstraint_t *functionConstraint)
|
||||||
{
|
{
|
||||||
functionConstraint->minBaudRate = XBUS_BAUDRATE;
|
functionConstraint->minBaudRate = XBUS_BAUDRATE;
|
||||||
functionConstraint->maxBaudRate = XBUS_JR01_BAUDRATE;
|
functionConstraint->maxBaudRate = XBUS_RJ01_BAUDRATE;
|
||||||
functionConstraint->requiredSerialPortFeatures = SPF_SUPPORTS_CALLBACK;
|
functionConstraint->requiredSerialPortFeatures = SPF_SUPPORTS_CALLBACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,15 +106,15 @@ bool xBusInit(rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig, rcReadRa
|
||||||
xBusChannelCount = XBUS_CHANNEL_COUNT;
|
xBusChannelCount = XBUS_CHANNEL_COUNT;
|
||||||
xBusProvider = SERIALRX_XBUS_MODE_B;
|
xBusProvider = SERIALRX_XBUS_MODE_B;
|
||||||
break;
|
break;
|
||||||
case SERIALRX_XBUS_MODE_B_JR01:
|
case SERIALRX_XBUS_MODE_B_RJ01:
|
||||||
rxRuntimeConfig->channelCount = XBUS_JR01_CHANNEL_COUNT;
|
rxRuntimeConfig->channelCount = XBUS_RJ01_CHANNEL_COUNT;
|
||||||
xBusFrameReceived = false;
|
xBusFrameReceived = false;
|
||||||
xBusDataIncoming = false;
|
xBusDataIncoming = false;
|
||||||
xBusFramePosition = 0;
|
xBusFramePosition = 0;
|
||||||
baudRate = XBUS_JR01_BAUDRATE;
|
baudRate = XBUS_RJ01_BAUDRATE;
|
||||||
xBusFrameLength = XBUS_JR01_FRAME_SIZE;
|
xBusFrameLength = XBUS_RJ01_FRAME_SIZE;
|
||||||
xBusChannelCount = XBUS_JR01_CHANNEL_COUNT;
|
xBusChannelCount = XBUS_RJ01_CHANNEL_COUNT;
|
||||||
xBusProvider = SERIALRX_XBUS_MODE_B_JR01;
|
xBusProvider = SERIALRX_XBUS_MODE_B_RJ01;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -181,7 +181,7 @@ static void xBusUnpackModeBFrame(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xBusUnpackJr01Frame(void)
|
static void xBusUnpackRJ01Frame(void)
|
||||||
{
|
{
|
||||||
// Calculate the CRC of the incoming frame
|
// Calculate the CRC of the incoming frame
|
||||||
uint16_t crc = 0;
|
uint16_t crc = 0;
|
||||||
|
@ -190,7 +190,7 @@ static void xBusUnpackJr01Frame(void)
|
||||||
uint16_t value;
|
uint16_t value;
|
||||||
uint8_t frameAddr;
|
uint8_t frameAddr;
|
||||||
|
|
||||||
// When using the Align JR01 receiver with
|
// When using the Align RJ01 receiver with
|
||||||
// a MODE B setting in the radio (XG14 tested)
|
// a MODE B setting in the radio (XG14 tested)
|
||||||
// the MODE_B -frame is packed within some
|
// the MODE_B -frame is packed within some
|
||||||
// at the moment unknown bytes before and after:
|
// at the moment unknown bytes before and after:
|
||||||
|
@ -198,7 +198,7 @@ static void xBusUnpackJr01Frame(void)
|
||||||
// Compared to a standard MODE B frame that only
|
// Compared to a standard MODE B frame that only
|
||||||
// contains the "middle" package
|
// contains the "middle" package
|
||||||
// Hence, at the moment, the unknown header and footer
|
// Hence, at the moment, the unknown header and footer
|
||||||
// of the JR01 MODEB packages are discarded. This is
|
// of the RJ01 MODEB packages are discarded. This is
|
||||||
// ok as the CRC-checksum of the embedded package works
|
// ok as the CRC-checksum of the embedded package works
|
||||||
// out nicely.
|
// out nicely.
|
||||||
|
|
||||||
|
@ -260,8 +260,8 @@ static void xBusDataReceive(uint16_t c)
|
||||||
switch (xBusProvider) {
|
switch (xBusProvider) {
|
||||||
case SERIALRX_XBUS_MODE_B:
|
case SERIALRX_XBUS_MODE_B:
|
||||||
xBusUnpackModeBFrame();
|
xBusUnpackModeBFrame();
|
||||||
case SERIALRX_XBUS_MODE_B_JR01:
|
case SERIALRX_XBUS_MODE_B_RJ01:
|
||||||
xBusUnpackJr01Frame();
|
xBusUnpackRJ01Frame();
|
||||||
}
|
}
|
||||||
xBusDataIncoming = false;
|
xBusDataIncoming = false;
|
||||||
xBusFramePosition = 0;
|
xBusFramePosition = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue