The goal of this patch is to allow compatibility with GR12/GR16/GR24 graupner receiver by :

- allowing decoding of SUMD frame with failsafe bit set
- updating stack failsafe state with the sumd failsafe info

Refer to #5817 issue
This commit is contained in:
Benoit3
2016-11-12 14:28:57 +01:00
committed by Lorenz Meier
parent 697d401b73
commit 83e9e1c382
5 changed files with 22 additions and 9 deletions
+2 -1
View File
@@ -302,9 +302,10 @@ bool RCTest::sumdTest(void)
uint8_t rx_count;
uint16_t channel_count;
uint16_t channels[32];
bool sumd_failsafe;
if (!sumd_decode(b, &rssi, &rx_count, &channel_count, channels, 32)) {
if (!sumd_decode(b, &rssi, &rx_count, &channel_count, channels, 32, &sumd_failsafe)) {
//PX4_INFO("decoded: %u channels (converted to PPM range)", (unsigned)channel_count);
for (unsigned i = 0; i < channel_count; i++) {
+5 -2
View File
@@ -110,7 +110,7 @@ uint8_t sumd_crc8(uint8_t crc, uint8_t value)
}
int sumd_decode(uint8_t byte, uint8_t *rssi, uint8_t *rx_count, uint16_t *channel_count, uint16_t *channels,
uint16_t max_chan_count)
uint16_t max_chan_count, bool *failsafe)
{
int ret = 1;
@@ -143,7 +143,7 @@ int sumd_decode(uint8_t byte, uint8_t *rssi, uint8_t *rx_count, uint16_t *channe
break;
case SUMD_DECODE_STATE_GOT_HEADER:
if (byte == SUMD_ID_SUMD || byte == SUMD_ID_SUMH) {
if (byte == SUMD_ID_SUMD || byte == SUMD_ID_FAILSAFE || byte == SUMD_ID_SUMH) {
_rxpacket.status = byte;
if (byte == SUMD_ID_SUMH) {
@@ -311,6 +311,9 @@ int sumd_decode(uint8_t byte, uint8_t *rssi, uint8_t *rx_count, uint16_t *channe
*rssi = 100;
/* failsafe flag */
*failsafe = (_rxpacket.status == SUMD_ID_FAILSAFE);
/* received Channels */
if ((uint16_t)_rxpacket.length > max_chan_count) {
_rxpacket.length = (uint8_t) max_chan_count;
+3 -2
View File
@@ -95,14 +95,15 @@ uint8_t sumd_crc8(uint8_t crc, uint8_t value);
* @param rx_count pointer to a byte where the receive count of packets signce last wireless frame is written back to
* @param channels pointer to a datastructure of size max_chan_count where channel values (12 bit) are written back to
* @param max_chan_count maximum channels to decode - if more channels are decoded, the last n are skipped and success (0) is returned
* @param failsafe pointer to a boolean where the decoded failsafe flag is written back to
* @return 0 for success (a decoded packet), 1 for no packet yet (accumulating), 2 for unknown packet, 3 for out of sync, 4 for checksum error
*/
/*
__EXPORT int sumd_decode(uint8_t byte, uint8_t *rssi, uint8_t *rx_count, uint16_t *channel_count,
uint16_t *channels, uint16_t max_chan_count);
uint16_t *channels, uint16_t max_chan_count, bool *failsafe);
*/
__EXPORT int sumd_decode(uint8_t byte, uint8_t *rssi, uint8_t *rx_count, uint16_t *channel_count,
uint16_t *channels, uint16_t max_chan_count);
uint16_t *channels, uint16_t max_chan_count, bool *failsafe);
__END_DECLS