From 05aa1a2da4fdbc04366c449b36a89098f30101f4 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Sat, 12 Dec 2020 20:06:21 -0800 Subject: [PATCH] send ext id --- firmware/can_helper.cpp | 6 +++--- firmware/can_helper.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/firmware/can_helper.cpp b/firmware/can_helper.cpp index e3e8499..a3720ac 100644 --- a/firmware/can_helper.cpp +++ b/firmware/can_helper.cpp @@ -2,8 +2,8 @@ #include -CanTxMessage::CanTxMessage(uint32_t eid, uint8_t dlc) { - m_frame.IDE = CAN_IDE_STD; +CanTxMessage::CanTxMessage(uint32_t eid, uint8_t dlc, bool isExtended) { + m_frame.IDE = isExtended ? CAN_IDE_EXT : CAN_IDE_STD; m_frame.EID = eid; m_frame.RTR = CAN_RTR_DATA; m_frame.DLC = dlc; @@ -12,7 +12,7 @@ CanTxMessage::CanTxMessage(uint32_t eid, uint8_t dlc) { CanTxMessage::~CanTxMessage() { // 100 ms timeout - canTransmit(&CAND1, CAN_ANY_MAILBOX, &m_frame, TIME_MS2I(100)); + canTransmitTimeout(&CAND1, CAN_ANY_MAILBOX, &m_frame, TIME_IMMEDIATE); } uint8_t& CanTxMessage::operator[](size_t index) { diff --git a/firmware/can_helper.h b/firmware/can_helper.h index 5886388..5ca3887 100644 --- a/firmware/can_helper.h +++ b/firmware/can_helper.h @@ -18,7 +18,7 @@ public: /** * Create a new CAN message, with the specified extended ID. */ - explicit CanTxMessage(uint32_t eid, uint8_t dlc = 8); + explicit CanTxMessage(uint32_t eid, uint8_t dlc = 8, bool isExtended = false); /** * Destruction of an instance of CanTxMessage will transmit the message over the wire.