Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions j1939/j1939_22.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from .message_id import MessageId, FrameFormat
import logging
import time
import numpy as np

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -267,13 +266,15 @@ def send_pgn(self, data_page, pdu_format, pdu_specific, priority, src_address, d
if priority == None: priority = 7

# get chunks from data
full_tp_size_packages = int(data_length/self.DataLength.TP)
arr = np.array(data)
list_of_arr = np.split(arr, [full_tp_size_packages*self.DataLength.TP])
arr = np.reshape(list_of_arr[0], (-1,self.DataLength.TP))
data_list = arr.tolist()
if len(list_of_arr) > 1:
data_list.append(list_of_arr[1].tolist())
full_tp_size_packages = int(data_length / self.DataLength.TP)
data_list = []
for i in range(full_tp_size_packages):
start_index = i * self.DataLength.TP
end_index = (i + 1) * self.DataLength.TP
sublist = data[start_index:end_index]
data_list.append(sublist)
if data_length % self.DataLength.TP != 0:
data_list.append(data[full_tp_size_packages*self.DataLength.TP:])

# if the PF is between 240 and 255, the message can only be broadcast
if dest_address == ParameterGroupNumber.Address.GLOBAL:
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
],
install_requires=[
"python-can>=3.3.4",
"numpy >= 1.17.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

"pytest >= 6.2.5",
],
include_package_data=True,
Expand Down