This commit is contained in:
parent
8f3b680b2a
commit
90e8ffa215
|
@ -32,7 +32,11 @@ static void commonPassatB6() {
|
||||||
engineConfiguration->ignitionPins[i] = Gpio::Unassigned;
|
engineConfiguration->ignitionPins[i] = Gpio::Unassigned;
|
||||||
}
|
}
|
||||||
|
|
||||||
engineConfiguration->canNbcType = CAN_BUS_NBC_VAG;
|
// engineConfiguration->canNbcType = CAN_BUS_NBC_VAG;
|
||||||
|
|
||||||
|
engineConfiguration->enableAemXSeries = true;
|
||||||
|
engineConfiguration->afr.hwChannel = EFI_ADC_4;
|
||||||
|
|
||||||
|
|
||||||
// Injectors flow 1214 cc/min at 100 bar pressure
|
// Injectors flow 1214 cc/min at 100 bar pressure
|
||||||
engineConfiguration->injector.flow = 1214;
|
engineConfiguration->injector.flow = 1214;
|
||||||
|
@ -178,6 +182,22 @@ canRxAdd(BRAKE_2)
|
||||||
|
|
||||||
fuelCounter = 0
|
fuelCounter = 0
|
||||||
|
|
||||||
|
function setBitRange(data, totalBitIndex, bitWidth, value)
|
||||||
|
local byteIndex = totalBitIndex >> 3
|
||||||
|
local bitInByteIndex = totalBitIndex - byteIndex * 8
|
||||||
|
if (bitInByteIndex + bitWidth > 8) then
|
||||||
|
bitsToHandleNow = 8 - bitInByteIndex
|
||||||
|
setBitRange(data, totalBitIndex + bitsToHandleNow, bitWidth - bitsToHandleNow, value >> bitsToHandleNow)
|
||||||
|
bitWidth = bitsToHandleNow
|
||||||
|
end
|
||||||
|
mask = (1 << bitWidth) - 1
|
||||||
|
data[1 + byteIndex] = data[1 + byteIndex] & (~(mask << bitInByteIndex))
|
||||||
|
maskedValue = value & mask
|
||||||
|
shiftedValue = maskedValue << bitInByteIndex
|
||||||
|
data[1 + byteIndex] = data[1 + byteIndex] | shiftedValue
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function setTwoBytes(data, offset, value)
|
function setTwoBytes(data, offset, value)
|
||||||
data[offset + 1] = value % 255
|
data[offset + 1] = value % 255
|
||||||
data[offset + 2] = (value >> 8) % 255
|
data[offset + 2] = (value >> 8) % 255
|
||||||
|
@ -242,6 +262,8 @@ setTickRate(100)
|
||||||
everySecondTimer = Timer.new()
|
everySecondTimer = Timer.new()
|
||||||
canMotorInfoCounter = 0
|
canMotorInfoCounter = 0
|
||||||
|
|
||||||
|
counter = 0
|
||||||
|
|
||||||
function onTick()
|
function onTick()
|
||||||
counter = (counter + 1) % 16
|
counter = (counter + 1) % 16
|
||||||
|
|
||||||
|
@ -250,9 +272,9 @@ function onTick()
|
||||||
iat = getSensor("IAT") or 0
|
iat = getSensor("IAT") or 0
|
||||||
tps = getSensor("TPS1") or 0
|
tps = getSensor("TPS1") or 0
|
||||||
|
|
||||||
fakeTorque = interpolate(0, 6, 100, 60, tps)
|
fakeTorque = interpolate(0, 6, 100, 60, tps)
|
||||||
|
|
||||||
engineTorque = fakeTorque
|
engineTorque = fakeTorque
|
||||||
innerTorqWithoutExt = fakeTorque
|
innerTorqWithoutExt = fakeTorque
|
||||||
torqueLoss = 10
|
torqueLoss = 10
|
||||||
requestedTorque = fakeTorque
|
requestedTorque = fakeTorque
|
||||||
|
@ -284,18 +306,17 @@ function onTick()
|
||||||
mcu_standby()
|
mcu_standby()
|
||||||
end
|
end
|
||||||
|
|
||||||
if everySecondTimer:getElapsedSeconds() > 1 then
|
if everySecondTimer : getElapsedSeconds() > 1 then
|
||||||
everySecondTimer:reset()
|
everySecondTimer : reset()
|
||||||
|
|
||||||
fuelCounter = fuelCounter + 20
|
fuelCounter = fuelCounter + 20
|
||||||
|
|
||||||
canMotorInfoCounter = (canMotorInfoCounter + 1) % 8
|
canMotorInfoCounter = (canMotorInfoCounter + 1) % 8
|
||||||
canMotorInfo[1] = 0x90 + (canMotorInfoCounter * 2)
|
canMotorInfo[1] = 0x90 + (canMotorInfoCounter * 2)
|
||||||
txCan(1, MOTOR_INFO, 0, canMotorInfo)
|
txCan(1, MOTOR_INFO, 0, canMotorInfo)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
)", efi::size(config->luaScript));
|
)", efi::size(config->luaScript));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue