mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-16 08:29:15 +01:00
LP-196 Cleaned up some code.
This commit is contained in:
parent
534ff1ff3c
commit
c8edd023a2
@ -93,10 +93,10 @@ struct pios_exbus_state {
|
|||||||
uint8_t receive_timer;
|
uint8_t receive_timer;
|
||||||
uint8_t failsafe_timer;
|
uint8_t failsafe_timer;
|
||||||
uint8_t failsafe_count;
|
uint8_t failsafe_count;
|
||||||
bool high_baud_rate;
|
|
||||||
uint8_t byte_count;
|
uint8_t byte_count;
|
||||||
uint8_t frame_length;
|
uint8_t frame_length;
|
||||||
uint16_t crc;
|
uint16_t crc;
|
||||||
|
bool high_baud_rate;
|
||||||
bool frame_found;
|
bool frame_found;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ static int PIOS_EXBUS_UnrollChannels(struct pios_exbus_dev *exbus_dev)
|
|||||||
if(state->crc != 0) {
|
if(state->crc != 0) {
|
||||||
/* crc failed */
|
/* crc failed */
|
||||||
DEBUG_PRINTF(2, "Jeti CRC error!%d\r\n");
|
DEBUG_PRINTF(2, "Jeti CRC error!%d\r\n");
|
||||||
goto stream_error;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum pios_exbus_frame_state exbus_state = EXBUS_STATE_SYNC;
|
enum pios_exbus_frame_state exbus_state = EXBUS_STATE_SYNC;
|
||||||
@ -193,7 +193,7 @@ static int PIOS_EXBUS_UnrollChannels(struct pios_exbus_dev *exbus_dev)
|
|||||||
exbus_state = EXBUS_STATE_REQ;
|
exbus_state = EXBUS_STATE_REQ;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
goto stream_error;
|
return -1;
|
||||||
}
|
}
|
||||||
byte += sizeof(uint8_t);
|
byte += sizeof(uint8_t);
|
||||||
break;
|
break;
|
||||||
@ -209,8 +209,9 @@ static int PIOS_EXBUS_UnrollChannels(struct pios_exbus_dev *exbus_dev)
|
|||||||
else if(*byte == EXBUS_BYTE_NOREQ) {
|
else if(*byte == EXBUS_BYTE_NOREQ) {
|
||||||
exbus_state = EXBUS_STATE_LEN;
|
exbus_state = EXBUS_STATE_LEN;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
goto stream_error;
|
return -1;
|
||||||
|
}
|
||||||
byte += sizeof(uint8_t);
|
byte += sizeof(uint8_t);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -231,8 +232,9 @@ static int PIOS_EXBUS_UnrollChannels(struct pios_exbus_dev *exbus_dev)
|
|||||||
if(*byte == EXBUS_DATA_CHANNEL) {
|
if(*byte == EXBUS_DATA_CHANNEL) {
|
||||||
exbus_state = EXBUS_STATE_SUBLEN;
|
exbus_state = EXBUS_STATE_SUBLEN;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
goto stream_error;
|
return -1;
|
||||||
|
}
|
||||||
byte += sizeof(uint8_t);
|
byte += sizeof(uint8_t);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -251,15 +253,7 @@ static int PIOS_EXBUS_UnrollChannels(struct pios_exbus_dev *exbus_dev)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(; channel < EXBUS_MAX_CHANNELS; channel++) {
|
|
||||||
/* this channel was not received */
|
|
||||||
state->channel_data[channel] = PIOS_RCVR_INVALID;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
stream_error:
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update decoder state processing input byte from the stream */
|
/* Update decoder state processing input byte from the stream */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user