aboutsummaryrefslogtreecommitdiffstats
path: root/fw/can.c
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2025-11-07 12:37:47 -0500
committerSam Anthony <sam@samanthony.xyz>2025-11-07 12:37:47 -0500
commit5185feb984da4c7a4537d1bd090f530732c0e071 (patch)
tree1950cff3db4cb162be86fb8b41dfcaa5e2e44c4f /fw/can.c
parent2f28635ba7d96f5fd5c029ba01e41ceb3ecaebfd (diff)
downloadcan-gauge-interface-5185feb984da4c7a4537d1bd090f530732c0e071.zip
transmit line number on error
Diffstat (limited to 'fw/can.c')
-rw-r--r--fw/can.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/fw/can.c b/fw/can.c
index 8376049..421c69b 100644
--- a/fw/can.c
+++ b/fw/can.c
@@ -261,7 +261,7 @@ readRxbn(U8 n, CanFrame *frame) {
CAN_CS = 0;
// Start reading at RXBnSIDH
- (void)spiTx(CMD_READ_RX | (U8)((n & 1u) << 2u));
+ (void)spiTx(CMD_READ_RX | (U8)((n & 1) << 2u));
// Read ID
sidh = spiTx(0u);
@@ -270,13 +270,9 @@ readRxbn(U8 n, CanFrame *frame) {
eid0 = spiTx(0u);
packId(&frame->id, sidh, sidl, eid8, eid0);
- // Read RTR and DLC
+ // Read DLC and RTR
frame->dlc = spiTx(0u);
- if (frame->id.isExt) {
- frame->rtr = frame->dlc & RTR;
- } else {
- frame->rtr = sidl & SRR;
- }
+ frame->rtr = (sidl & IDE) ? (frame->dlc & RTR) : (sidl & SRR);
frame->dlc &= 0xF;
// Read data