Added a check for a new byte when moving back to IDLE for MS/TP capture utility.
This commit is contained in:
@@ -71,6 +71,8 @@
|
|||||||
static volatile struct mstp_port_struct_t MSTP_Port;
|
static volatile struct mstp_port_struct_t MSTP_Port;
|
||||||
/* track the receive state to know when there is a broken packet */
|
/* track the receive state to know when there is a broken packet */
|
||||||
static MSTP_RECEIVE_STATE MSTP_Receive_State = MSTP_RECEIVE_STATE_IDLE;
|
static MSTP_RECEIVE_STATE MSTP_Receive_State = MSTP_RECEIVE_STATE_IDLE;
|
||||||
|
/* track the bytes that are incoming to know when to check for loss */
|
||||||
|
static bool DataAvailable;
|
||||||
/* buffers needed by mstp port struct */
|
/* buffers needed by mstp port struct */
|
||||||
static uint8_t RxBuffer[MAX_MPDU];
|
static uint8_t RxBuffer[MAX_MPDU];
|
||||||
static uint8_t TxBuffer[MAX_MPDU];
|
static uint8_t TxBuffer[MAX_MPDU];
|
||||||
@@ -1174,6 +1176,7 @@ int main(
|
|||||||
/* run forever */
|
/* run forever */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
RS485_Check_UART_Data(mstp_port);
|
RS485_Check_UART_Data(mstp_port);
|
||||||
|
DataAvailable = mstp_port->DataAvailable;
|
||||||
MSTP_Receive_Frame_FSM(mstp_port);
|
MSTP_Receive_Frame_FSM(mstp_port);
|
||||||
/* process the data portion of the frame */
|
/* process the data portion of the frame */
|
||||||
if (mstp_port->ReceivedValidFrame) {
|
if (mstp_port->ReceivedValidFrame) {
|
||||||
@@ -1192,7 +1195,8 @@ int main(
|
|||||||
mstp_structure_init(mstp_port);
|
mstp_structure_init(mstp_port);
|
||||||
Invalid_Frame_Count++;
|
Invalid_Frame_Count++;
|
||||||
packet_count++;
|
packet_count++;
|
||||||
} else if (mstp_port->receive_state == MSTP_RECEIVE_STATE_IDLE) {
|
} else if ((mstp_port->receive_state == MSTP_RECEIVE_STATE_IDLE) &&
|
||||||
|
(DataAvailable)) {
|
||||||
if (MSTP_Receive_State == MSTP_RECEIVE_STATE_IDLE) {
|
if (MSTP_Receive_State == MSTP_RECEIVE_STATE_IDLE) {
|
||||||
if (mstp_port->EventCount) {
|
if (mstp_port->EventCount) {
|
||||||
write_received_packet(mstp_port, 1);
|
write_received_packet(mstp_port, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user