Skip to content

Commit 99cbb42

Browse files
Fixed iso15765 example for Issue #17.
-Bitfields shift offset was off by 1... -enableFlowControlTransmission needed to be set. Signed-off-by: David Rebbe <drebbe@intrepidcs.com>
1 parent 3f95d7c commit 99cbb42

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

examples/iso15765_example.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ def transmit_iso15765_msg(device, netid=ics.NETID_HSCAN, is_canfd=False):
6565
# CmISO157652TxMessage.flags bitfield union isn't implemented as of 2.12, we need to do it manually.
6666
msg.flags = 0
6767
# paddingEnable
68-
msg.flags |= (1 << 6)
68+
msg.flags |= (1 << 5)
6969
# CANFD: Enable + BRS
7070
if is_canfd:
71-
msg.flags |= (1 << 7) | (1 << 8)
71+
msg.flags |= (1 << 6) | (1 << 7)
7272
# tx_dl
73-
msg.flags |= (8 << 24)
73+
msg.flags |= (8 << 23)
7474
# Data
7575
msg.data = [x for x in range(number_of_bytes)]
76-
76+
7777
# Transmit the message
7878
print("Transmitting iso15765 message on {}...".format(dev_name(device)))
7979
ics.iso15765_transmit_message(device, netid, msg, 3000)
@@ -95,11 +95,13 @@ def setup_rx_iso15765_msg(device, netid=ics.NETID_HSCAN, is_canfd=False):
9595
msg.cf_timeout = 1000
9696
# CmISO157652RxMessage.flags bitfield union isn't implemented as of 2.12, we need to do it manually.
9797
msg.flags = 0
98+
# enableFlowControlTransmission = 1
99+
msg.flags |= (1 << 4)
98100
# paddingEnable
99-
msg.flags |= (1 << 6)
101+
msg.flags |= (1 << 5)
100102
# CANFD: Enable + BRS
101103
if is_canfd:
102-
msg.flags |= (1 << 7) | (1 << 8)
104+
msg.flags |= (1 << 6) | (1 << 7)
103105

104106
print_message(msg)
105107
print("Setting up iso15765 message on {}...".format(dev_name(device)))

0 commit comments

Comments
 (0)