From 5f708d5c92b3c657b29dbdecbad5fa0fa833391b Mon Sep 17 00:00:00 2001 From: rusefillc Date: Fri, 9 Sep 2022 21:35:15 -0400 Subject: [PATCH] E67 --- .../hellen/hellen-gm-e67/board_configuration.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/firmware/config/boards/hellen/hellen-gm-e67/board_configuration.cpp b/firmware/config/boards/hellen/hellen-gm-e67/board_configuration.cpp index e0729169cb..5c960db316 100644 --- a/firmware/config/boards/hellen/hellen-gm-e67/board_configuration.cpp +++ b/firmware/config/boards/hellen/hellen-gm-e67/board_configuration.cpp @@ -195,6 +195,9 @@ function getBitRange(data, bitIndex, bitWidth) return (value >> shift) & mask end +STARTER_OUTPUT_INDEX = 0 +startPwm(STARTER_OUTPUT_INDEX, 100, 0) + IGN_STATUS = 0x1f1 -- 0x514 VIN_Part1 = 1300 @@ -205,18 +208,25 @@ setTickRate(100) function canIgnStatus(bus, id, dlc, data) crankingBits = getBitRange(data, 2, 2) - local isCranking = (crankingBits == 2) + isCranking = (crankingBits == 2) print('crankingBits ' .. crankingBits .. ', isCranking ' .. isCranking) end canRxAdd(IGN_STATUS, canIgnStatus) +-- todo: take VIN from configuration? encode VIN? canVin1 = { 0x47, 0x4E, 0x4C, 0x43, 0x32, 0x45, 0x30, 0x34 } canVin2 = { 0x42, 0x52, 0x32, 0x31, 0x36, 0x33, 0x36, 0x36 } function onTick() txCan(1, VIN_Part1, 0, canVin1) txCan(1, VIN_Part2, 0, canVin2) + + if isCranking then + setPwmDuty(STARTER_OUTPUT_INDEX, 1) + else + setPwmDuty(STARTER_OUTPUT_INDEX, 0) + end end )", efi::size(config->luaScript));