From 0278c21a852193cfb8fd0132f1b4116c5c50c553 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Thu, 20 Apr 2023 12:52:36 -0400 Subject: [PATCH] CAN lua refactoring --- firmware/config/engines/harley.cpp | 5 ++--- firmware/config/engines/hyundai.cpp | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/firmware/config/engines/harley.cpp b/firmware/config/engines/harley.cpp index b4b34ebb00..611a7b4d30 100644 --- a/firmware/config/engines/harley.cpp +++ b/firmware/config/engines/harley.cpp @@ -51,16 +51,15 @@ canRxAdd(0x500) function onCanRx(bus, id, dlc, data) --print('got CAN id=' .. id .. ' dlc=' .. dlc) - id11 = id % 2048 - if id11 == 0x500 then --Check can state of BCM + if id == 0x500 then --Check can state of BCM canState = data[1] if canState == 01 then packet502[1] = 0x01 else packet502[1] = 0x00 end - if id11 == 0x570 then + if id == 0x570 then curState = data[1] if curState == 06 then -- Cranking TODO: MUST ONLY DO THIS ON RPM TILL STARt packet542[2] = 0x82 diff --git a/firmware/config/engines/hyundai.cpp b/firmware/config/engines/hyundai.cpp index 486be909ee..a254d74947 100644 --- a/firmware/config/engines/hyundai.cpp +++ b/firmware/config/engines/hyundai.cpp @@ -28,7 +28,6 @@ canRxAdd(0x4f0) packet4f1 = { 0xFA, 0x54, 0x00, 0x0, 0x00, 0x51, 0x00, 0x00 } function onCanRx(bus, id, dlc, data) - id11 = id % 2048 print('got CAN id=' .. id .. ' dlc=' .. dlc) -- todo: add filtering logic if needed