@@ -982,7 +982,8 @@ def _process_rx(self, msg: CanMessage) -> ProcessRxReport:
982982 immediate_tx_msg_required = True
983983
984984 return self .ProcessRxReport (immediate_tx_required = immediate_tx_msg_required , frame_received = frame_complete )
985-
985+
986+
986987 def _process_tx (self ) -> ProcessTxReport :
987988 """Process the transmit state machine"""
988989 output_msg = None # Value outputted. If None, no subsequent call to _process_tx will be done.
@@ -1076,7 +1077,7 @@ def _process_tx(self) -> ProcessTxReport:
10761077 if total_size <= self .params .tx_data_length - size_offset - len (self .address .get_tx_payload_prefix ()):
10771078 # Will raise if size is not what was requested
10781079 payload = self .active_send_request .generator .consume (total_size , enforce_exact = True )
1079-
1080+
10801081 if size_on_first_byte :
10811082 msg_data = self .address .get_tx_payload_prefix () + bytearray ([0x0 | len (payload )]) + payload
10821083 else :
@@ -1090,7 +1091,8 @@ def _process_tx(self) -> ProcessTxReport:
10901091 self .tx_state = self .TxState .TRANSMIT_SF_STANDBY
10911092 else :
10921093 output_msg = msg_temp
1093-
1094+ self ._stop_sending (success = True )
1095+
10941096 # Multi frame - First Frame
10951097 else :
10961098 self .tx_frame_length = total_size
@@ -1125,7 +1127,6 @@ def _process_tx(self) -> ProcessTxReport:
11251127 # This states serves if the rate limiter prevent from starting a new transmission.
11261128 # We need to pop the isotp frame to know if the rate limiter must kick, but since the data is already popped,
11271129 # we can't stay in IDLE state. So we come here until the rate limiter gives us permission to proceed.
1128-
11291130 if self .tx_standby_msg is not None :
11301131 if len (self .tx_standby_msg .data ) <= allowed_bytes :
11311132 output_msg = self .tx_standby_msg
@@ -1151,7 +1152,7 @@ def _process_tx(self) -> ProcessTxReport:
11511152 payload = self .active_send_request .generator .consume (payload_length , enforce_exact = False )
11521153 if len (payload ) > 0 : # Corner case. If generator size is a multiple of ll_data_length, we will get an empty payload on last frame.
11531154 msg_data = self .address .get_tx_payload_prefix () + bytearray ([0x20 | self .tx_seqnum ]) + payload
1154- arbitration_id = self .address .get_tx_arbitration_id ()
1155+ arbitration_id = self .address .get_tx_arbitration_id ()
11551156 output_msg = self ._make_tx_msg (arbitration_id , msg_data )
11561157 self .tx_seqnum = (self .tx_seqnum + 1 ) & 0xF
11571158 self .timer_tx_stmin .start ()
0 commit comments