mirror of https://github.com/FOME-Tech/fome-fw.git
harley CAN Lua
This commit is contained in:
parent
467db16828
commit
0820fa178d
|
@ -817,7 +817,38 @@ startPwm(outputIndex, 100, 0)
|
||||||
rpmLimitSetting = findSetting("compReleaseRpm", 300)
|
rpmLimitSetting = findSetting("compReleaseRpm", 300)
|
||||||
compReleaseDulationLimit = findSetting("compReleaseDur", 6000)
|
compReleaseDulationLimit = findSetting("compReleaseDur", 6000)
|
||||||
|
|
||||||
|
every200msTimer = Timer.new();
|
||||||
|
everySecondTimer = Timer.new();
|
||||||
|
|
||||||
|
-- cranking!
|
||||||
|
packet542 = {0x20, 0xc2, 0x81, 0xd9, 0x00, 0x00, 0x00, 0x00}
|
||||||
|
|
||||||
|
-- every 200ms
|
||||||
|
packet540 = {0x00, 0x00, 0x5a, 0x4c, 0xff, 0x00, 0x00, 0x00}
|
||||||
|
|
||||||
|
-- every 1000ms
|
||||||
|
packet502 = {0x01}
|
||||||
|
packet546 = {0x35, 0x48, 0x44, 0x31, 0x46, 0x48}
|
||||||
|
packet547 = {0x50, 0x41, 0x31, 0x4b, 0x42, 0x36}
|
||||||
|
packet548 = {0x33, 0x34, 0x38, 0x32, 0x32, 0x00}
|
||||||
|
|
||||||
function onTick()
|
function onTick()
|
||||||
|
txCan(1, 0x542, 1, packet542)
|
||||||
|
|
||||||
|
if every200msTimer:getElapsedSeconds() > 1 then
|
||||||
|
every200msTimer:reset();
|
||||||
|
txCan(1, 0x540, 1, packet540)
|
||||||
|
end
|
||||||
|
|
||||||
|
if everySecondTimer:getElapsedSeconds() > 1 then
|
||||||
|
everySecondTimer:reset();
|
||||||
|
txCan(1, 0x502, 1, packet502)
|
||||||
|
txCan(1, 0x546, 1, packet546)
|
||||||
|
txCan(1, 0x547, 1, packet547)
|
||||||
|
txCan(1, 0x548, 1, packet548)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
rpm = getSensor("RPM")
|
rpm = getSensor("RPM")
|
||||||
-- handle nil RPM, todo: change firmware to avoid nil RPM
|
-- handle nil RPM, todo: change firmware to avoid nil RPM
|
||||||
rpm = (rpm == nil and 0 or rpm)
|
rpm = (rpm == nil and 0 or rpm)
|
||||||
|
|
Loading…
Reference in New Issue