Skip to content

Commit

Permalink
lib/rc/ghst: Added differentiation between GHST and CRSF (#23805)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcekay authored Oct 11, 2024
1 parent 9031f44 commit dbba9ad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/rc/ghst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
#define GHST_FRAME_CRC_SIZE (1U)
#define GHST_FRAME_TYPE_SIZE (1U)
#define GHST_TYPE_DATA_CRC_SIZE (12U)
#define GHST_ADDR_FC (130U)
#define GHST_MAX_NUM_CHANNELS (16)

enum class ghst_parser_state_t : uint8_t {
Expand Down Expand Up @@ -251,7 +252,8 @@ static bool ghst_parse_buffer(uint16_t *values, int8_t *rssi, uint16_t *num_valu

if ((ghst_frame.type >= static_cast<uint8_t>(ghstFrameType::frameTypeFirst)) &&
(ghst_frame.type <= static_cast<uint8_t>(ghstFrameType::frameTypeLast)) &&
(ghst_frame.header.length == GHST_TYPE_DATA_CRC_SIZE)) {
(ghst_frame.header.length == GHST_TYPE_DATA_CRC_SIZE) &&
(ghst_frame.header.device_address == GHST_ADDR_FC)) {
const uint8_t crc = ghst_frame.payload[ghst_frame.header.length - 2U];

if (crc == ghst_frame_CRC(ghst_frame)) {
Expand Down

0 comments on commit dbba9ad

Please sign in to comment.