@@ -78,16 +78,19 @@ async def _monitor_recv(self):
78
78
self .log .debug (f"ee_idx { str (ee_idx )} " )
79
79
self .log .debug (f"ss_idx { str (ss_idx )} " )
80
80
81
- if (self ._eof_arr [rr ] == 1 ) and (in_frame ):
82
- # Checks if there is a packet that is being processed and if it ends in this region.
83
- self .log .debug ("Frame End" )
84
- in_frame = False
85
- eof_done = True
86
- frame += data_bytes [rs_inx :ee_idx ]
87
- self .item_cnt += len (data_bytes [rs_inx :ee_idx ])* 8 // self ._item_width
88
- self .log .debug (f"frame done { frame .hex ()} " )
89
- self ._recv (frame )
90
- self .frame_cnt += 1
81
+ if self ._eof_arr [rr ] == 1 :
82
+ if in_frame :
83
+ # Checks if there is a packet that is being processed and if it ends in this region.
84
+ self .log .debug ("Frame End" )
85
+ in_frame = False
86
+ eof_done = True
87
+ frame += data_bytes [rs_inx :ee_idx ]
88
+ self .item_cnt += len (data_bytes [rs_inx :ee_idx ])* 8 // self ._item_width
89
+ self .log .debug (f"frame done { frame .hex ()} " )
90
+ self ._recv (frame )
91
+ self .frame_cnt += 1
92
+ elif self ._sof_arr [rr ] == 1 and (self ._eof_pos_arr [rr ] < self ._sof_pos_arr [rr ]):
93
+ raise MFBProtocolError ("MFB error: an end-of-frame received before a start-of-frame!" )
91
94
92
95
if in_frame :
93
96
# Region with a valid 'middle of packet'.
@@ -99,15 +102,15 @@ async def _monitor_recv(self):
99
102
# Checking for beginning of a packet.
100
103
self .log .debug ("Frame Start" )
101
104
if in_frame :
102
- raise MFBProtocolError ("Duplicate start-of-frame received on MFB bus !" )
105
+ raise MFBProtocolError ("MFB error: a start-of-frame received without an end-of-frame !" )
103
106
in_frame = True
104
107
frame = b""
105
108
106
109
if (self ._eof_arr [rr ] == 1 ) and (not eof_done ):
107
110
# Checking if the packet ends in the same regions where it began.
108
111
self .log .debug ("Frame End in single region" )
109
112
if not in_frame :
110
- raise MFBProtocolError ("Duplicate end-of-frame received on MFB bus !" )
113
+ raise MFBProtocolError ("MFB error: an end-of-frame received without a start-of-frame !" )
111
114
in_frame = False
112
115
frame += data_bytes [ss_idx :ee_idx ]
113
116
self .item_cnt += len (data_bytes [ss_idx :ee_idx ])* 8 // self ._item_width
0 commit comments