Skip to content

Commit bb2c152

Browse files
authored
Merge pull request #43 from SenteraLLC/release-1.2.3
Release 1.2.3
2 parents 074ac62 + 44c4953 commit bb2c152

File tree

2 files changed

+11
-22
lines changed

2 files changed

+11
-22
lines changed

src/sbus.c

+10-21
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ void SBusListGet( uint16_t ch_list[ SBUS_CH_MAX ] )
8383
////////////////////////////////////////////////////////////////////////////////
8484
static void SBusProcess( uint8_t byte_in )
8585
{
86+
static uint8_t byte_in_prev = SBUS_HEADER_VALUE;
87+
8688
/// Structure defining the contents of an S.Bus data payload. Each of the
8789
/// channel fields (ch1:ch16) occupies 11 bytes.
8890
typedef union
@@ -127,11 +129,10 @@ static void SBusProcess( uint8_t byte_in )
127129

128130
static enum
129131
{
130-
SM_END,
131132
SM_START,
132133
SM_DATA,
133134

134-
} sm_state = SM_END;
135+
} sm_state = SM_START;
135136

136137
static SBUS_DATA_U sbus_data;
137138

@@ -141,29 +142,14 @@ static void SBusProcess( uint8_t byte_in )
141142
// packet - i.e. rather than only checking the start/header byte.
142143
switch( sm_state )
143144
{
144-
case SM_END:
145-
{
146-
// End byte received ?
147-
if( byte_in == SBUS_FOOTER_VALUE )
148-
{
149-
sm_state++;
150-
}
151-
152-
break;
153-
}
154145
case SM_START:
155146
{
156-
// Start byte received ?
157-
if( byte_in == SBUS_HEADER_VALUE )
147+
// Footer followed by Header byte has been received ?
148+
if( ( byte_in_prev == SBUS_FOOTER_VALUE ) &&
149+
( byte_in == SBUS_HEADER_VALUE ) )
158150
{
159151
sm_state++;
160152
}
161-
else
162-
{
163-
// Start byte needs to be next received byte following the
164-
// end byte of the previous message.
165-
sm_state = SM_END;
166-
}
167153

168154
break;
169155
}
@@ -178,7 +164,7 @@ static void SBusProcess( uint8_t byte_in )
178164
{
179165
// Reset for reception of next data stream.
180166
ch_data_idx = 0;
181-
sm_state = SM_END;
167+
sm_state = SM_START;
182168

183169
// Process the received data.
184170
sbus_ch_data[ 0 ] = sbus_data.ch1;
@@ -202,4 +188,7 @@ static void SBusProcess( uint8_t byte_in )
202188
break;
203189
}
204190
}
191+
192+
// Latch current byte for next evaluation.
193+
byte_in_prev = byte_in;
205194
}

src/status.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ typedef struct
4747
/// The node type - value of '0' identifies node as a FMU node.
4848
static const uint8_t status_node_type = 0;
4949

50-
static const uint8_t status_fw_rev_ver = 2; ///< Firmware revision version number.
50+
static const uint8_t status_fw_rev_ver = 3; ///< Firmware revision version number.
5151
static const uint8_t status_fw_min_ver = 2; ///< Firmware minor version number.
5252
static const uint8_t status_fw_maj_ver = 1; ///< Firmware major version number.
5353

0 commit comments

Comments
 (0)