B6 shutdown Lua and else

This commit is contained in:
rusefillc 2022-06-19 20:06:03 -04:00
parent 7165b6a34d
commit d9514d4479
2 changed files with 31 additions and 0 deletions

View File

@ -82,6 +82,7 @@ static void commonPassatB6() {
gppwm_channel *coolantControl = &engineConfiguration->gppwm[0];
strcpy(engineConfiguration->gpPwmNote[0], "Rad Fan");
coolantControl->loadAxis = GPPWM_Clt;
coolantControl->pwmFrequency = 25;
coolantControl->loadAxis = GPPWM_FuelLoad;
@ -125,6 +126,35 @@ static void commonPassatB6() {
engineConfiguration->useETBforIdleControl = true;
engineConfiguration->injectionMode = IM_SEQUENTIAL;
engineConfiguration->crankingInjectionMode = IM_SEQUENTIAL;
strncpy(config->luaScript, R"(
canRxAdd(0x050)
shallSleep = Timer.new();
-- we want to turn on with hardware switch while ignition key is off
hadIgnitionEvent = false;
function onCanRx(bus, id, dlc, data)
print('got CAN id=' ..id ..' dlc=' ..dlc)
id11 = id % 2048
if id11 == 0x050 then
-- looks like we have ignition key do not sleep!
shallSleep:reset();
hadIgnitionEvent = true;
end
end
function onTick()
if hadIgnitionEvent and shallSleep:getElapsedSeconds() > 3 then
-- looks like ignition key was removed
mcu_standby()
end
end
)", efi::size(config->luaScript));
#endif
}
/**

View File

@ -230,6 +230,7 @@ void canDashboardFiat(CanCycle cycle) {
void canDashboardVAG(CanCycle cycle) {
if (cycle.isInterval(CI::_10ms)) {
{
// https://github.com/commaai/opendbc/blob/57c8340a180dd8c75139b18050eb17c72c9cb6e4/vw_golf_mk4.dbc#L394
//VAG Dashboard
CanTxMessage msg(CanCategory::NBC, CAN_VAG_Motor_1);
msg.setShortValue(Sensor::getOrZero(SensorType::Rpm) * 4, 2); //RPM