This commit is contained in:
rusefillc 2022-08-29 10:50:56 -04:00
parent 1651588ac3
commit 4c8e28dfab
2 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,31 @@
-- DBW protocol for legacy standalone systems
BASE_CAN_ID = 256
setTickRate(100)
-- Little-endian System, "Intel"
function setTwoBytesLsb(data, offset, value)
value = math.floor(value)
data[offset + 2] = value >> 8
data[offset + 1] = value & 0xff
end
-- MOTOROLA order, MSB (Most Significant Byte/Big Endian) comes first
function setTwoBytesMsb(data, offset, value)
value = math.floor(value)
data[offset + 1] = value >> 8
data[offset + 2] = value & 0xff
end
protocolPacket = { 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
function onTick()
local ppsValue = getSensor("AcceleratorPedal")
local TPS = getSensor("TPS1")
setTwoBytesMsb(protocolPacket, 0, ppsValue / 100 * 1024)
setTwoBytesMsb(protocolPacket, 2, TPS / 100 * 1024)
txCan(1, BASE_CAN_ID + 0, 0, protocolPacket)
end

View File

@ -198,7 +198,8 @@ void initializeMazdaMiataVVtCamShape(TriggerWaveform *s) {
} }
// https://rusefi.com/forum/viewtopic.php?f=17&t=2417 // https://rusefi.com/forum/viewtopic.php?f=17&t=2417
// Mazda Skyactiv // 2014 Mazda 2 Skyactive 1.3
// P3-VPS Skyactiv-G
void initializeMazdaMysteryCamShape(TriggerWaveform *s) { void initializeMazdaMysteryCamShape(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR); s->initialize(FOUR_STROKE_CAM_SENSOR);