From 757c8f0b275e38f30b1f4aaae754f88c0a7cd719 Mon Sep 17 00:00:00 2001 From: MDAutomotiveProjects Date: Thu, 27 May 2021 13:46:28 +1000 Subject: [PATCH] Commit changes for downshift blip support, open loop ISC position table, removal of orphan ASAM tags (var not in linker file), added no fuel cut on vehicle stopped option. --- .cproject | 154 +++++++++++++++++------------------ source/Client/DIAG.c | 6 +- source/Client/EST.c | 8 ++ source/Client/FUEL.c | 2 +- source/Client/IAC.c | 33 +++++++- source/Client/IAC.h | 1 + source/Client/LSU4X.c | 4 +- source/Client/LSU4X.h | 30 +++---- source/Client/LSUH.c | 1 - source/Client/LSUH.h | 4 +- source/Client/SENSORS.c | 22 ++++- source/Client/TORQUE.c | 55 +++++++++++-- source/Client/TORQUE.h | 10 ++- source/Client/USERCAL.h | 58 +++++++++++-- source/Client/golf_mk6.h | 130 +++++++++++++++++++++++------ source/Peripherals/SDHC1HA.c | 1 + source/UserServices/CEM.h | 2 +- source/UserServices/TABLES.h | 2 +- 18 files changed, 376 insertions(+), 147 deletions(-) diff --git a/.cproject b/.cproject index 222e59e..e25d6c4 100644 --- a/.cproject +++ b/.cproject @@ -623,83 +623,83 @@ <vendor>NXP</vendor> <memory can_program="true" id="Flash" is_ro="true" size="512" type="Flash"/> <memory id="RAM" size="192" type="RAM"/> -<memoryInstance derived_from="Flash" driver="FTFE_4K.cfx" id="PROGRAM_FLASH" location="0x0" size="0x80000"/> -<memoryInstance derived_from="RAM" id="SRAM_UPPER" location="0x20000000" size="0x20000"/> -<memoryInstance derived_from="RAM" id="SRAM_LOWER" location="0x1fff0000" size="0x10000"/> -<memoryInstance derived_from="RAM" id="FLEX_RAM" location="0x14000000" size="0x1000"/> -<peripheralInstance derived_from="FTFE-FlashConfig" id="FTFE-FlashConfig" location="0x400"/> -<peripheralInstance derived_from="AIPS0" id="AIPS0" location="0x40000000"/> -<peripheralInstance derived_from="AIPS1" id="AIPS1" location="0x40080000"/> -<peripheralInstance derived_from="AXBS" id="AXBS" location="0x40004000"/> -<peripheralInstance derived_from="DMA" id="DMA" location="0x40008000"/> -<peripheralInstance derived_from="FB" id="FB" location="0x4000C000"/> -<peripheralInstance derived_from="SYSMPU" id="SYSMPU" location="0x4000D000"/> -<peripheralInstance derived_from="FMC" id="FMC" location="0x4001F000"/> -<peripheralInstance derived_from="FTFE" id="FTFE" location="0x40020000"/> -<peripheralInstance derived_from="DMAMUX" id="DMAMUX" location="0x40021000"/> -<peripheralInstance derived_from="CAN0" id="CAN0" location="0x40024000"/> -<peripheralInstance derived_from="RNG" id="RNG" location="0x40029000"/> -<peripheralInstance derived_from="SPI0" id="SPI0" location="0x4002C000"/> -<peripheralInstance derived_from="SPI1" id="SPI1" location="0x4002D000"/> -<peripheralInstance derived_from="SPI2" id="SPI2" location="0x400AC000"/> -<peripheralInstance derived_from="I2S0" id="I2S0" location="0x4002F000"/> -<peripheralInstance derived_from="CRC" id="CRC" location="0x40032000"/> -<peripheralInstance derived_from="USBDCD" id="USBDCD" location="0x40035000"/> -<peripheralInstance derived_from="PDB0" id="PDB0" location="0x40036000"/> -<peripheralInstance derived_from="PIT" id="PIT" location="0x40037000"/> -<peripheralInstance derived_from="FTM0" id="FTM0" location="0x40038000"/> -<peripheralInstance derived_from="FTM1" id="FTM1" location="0x40039000"/> -<peripheralInstance derived_from="FTM2" id="FTM2" location="0x4003A000"/> -<peripheralInstance derived_from="FTM3" id="FTM3" location="0x400B9000"/> -<peripheralInstance derived_from="ADC0" id="ADC0" location="0x4003B000"/> -<peripheralInstance derived_from="ADC1" id="ADC1" location="0x400BB000"/> -<peripheralInstance derived_from="RTC" id="RTC" location="0x4003D000"/> -<peripheralInstance derived_from="RFVBAT" id="RFVBAT" location="0x4003E000"/> -<peripheralInstance derived_from="LPTMR0" id="LPTMR0" location="0x40040000"/> -<peripheralInstance derived_from="RFSYS" id="RFSYS" location="0x40041000"/> -<peripheralInstance derived_from="SIM" id="SIM" location="0x40047000"/> -<peripheralInstance derived_from="PORTA" id="PORTA" location="0x40049000"/> -<peripheralInstance derived_from="PORTB" id="PORTB" location="0x4004A000"/> -<peripheralInstance derived_from="PORTC" id="PORTC" location="0x4004B000"/> -<peripheralInstance derived_from="PORTD" id="PORTD" location="0x4004C000"/> -<peripheralInstance derived_from="PORTE" id="PORTE" location="0x4004D000"/> -<peripheralInstance derived_from="WDOG" id="WDOG" location="0x40052000"/> -<peripheralInstance derived_from="EWM" id="EWM" location="0x40061000"/> -<peripheralInstance derived_from="CMT" id="CMT" location="0x40062000"/> -<peripheralInstance derived_from="MCG" id="MCG" location="0x40064000"/> -<peripheralInstance derived_from="OSC" id="OSC" location="0x40065000"/> -<peripheralInstance derived_from="I2C0" id="I2C0" location="0x40066000"/> -<peripheralInstance derived_from="I2C1" id="I2C1" location="0x40067000"/> -<peripheralInstance derived_from="I2C2" id="I2C2" location="0x400E6000"/> -<peripheralInstance derived_from="UART0" id="UART0" location="0x4006A000"/> -<peripheralInstance derived_from="UART1" id="UART1" location="0x4006B000"/> -<peripheralInstance derived_from="UART2" id="UART2" location="0x4006C000"/> -<peripheralInstance derived_from="UART3" id="UART3" location="0x4006D000"/> -<peripheralInstance derived_from="UART4" id="UART4" location="0x400EA000"/> -<peripheralInstance derived_from="UART5" id="UART5" location="0x400EB000"/> -<peripheralInstance derived_from="USB0" id="USB0" location="0x40072000"/> -<peripheralInstance derived_from="CMP0" id="CMP0" location="0x40073000"/> -<peripheralInstance derived_from="CMP1" id="CMP1" location="0x40073008"/> -<peripheralInstance derived_from="CMP2" id="CMP2" location="0x40073010"/> -<peripheralInstance derived_from="VREF" id="VREF" location="0x40074000"/> -<peripheralInstance derived_from="LLWU" id="LLWU" location="0x4007C000"/> -<peripheralInstance derived_from="PMC" id="PMC" location="0x4007D000"/> -<peripheralInstance derived_from="SMC" id="SMC" location="0x4007E000"/> -<peripheralInstance derived_from="RCM" id="RCM" location="0x4007F000"/> -<peripheralInstance derived_from="SDHC" id="SDHC" location="0x400B1000"/> -<peripheralInstance derived_from="ENET" id="ENET" location="0x400C0000"/> -<peripheralInstance derived_from="DAC0" id="DAC0" location="0x400CC000"/> -<peripheralInstance derived_from="DAC1" id="DAC1" location="0x400CD000"/> -<peripheralInstance derived_from="GPIOA" id="GPIOA" location="0x400FF000"/> -<peripheralInstance derived_from="GPIOB" id="GPIOB" location="0x400FF040"/> -<peripheralInstance derived_from="GPIOC" id="GPIOC" location="0x400FF080"/> -<peripheralInstance derived_from="GPIOD" id="GPIOD" location="0x400FF0C0"/> -<peripheralInstance derived_from="GPIOE" id="GPIOE" location="0x400FF100"/> -<peripheralInstance derived_from="SystemControl" id="SystemControl" location="0xE000E000"/> -<peripheralInstance derived_from="SysTick" id="SysTick" location="0xE000E010"/> -<peripheralInstance derived_from="NVIC" id="NVIC" location="0xE000E100"/> -<peripheralInstance derived_from="MCM" id="MCM" location="0xE0080000"/> -<peripheralInstance derived_from="CAU" id="CAU" location="0xE0081000"/> +<memoryInstance derived_from="Flash" driver="FTFE_4K.cfx" id="PROGRAM_FLASH" location="0x00000000" size="0x00080000"/> +<memoryInstance derived_from="RAM" id="SRAM_UPPER" location="0x20000000" size="0x00020000"/> +<memoryInstance derived_from="RAM" id="SRAM_LOWER" location="0x1fff0000" size="0x00010000"/> +<memoryInstance derived_from="RAM" id="FLEX_RAM" location="0x14000000" size="0x00001000"/> +<peripheralInstance derived_from="FTFE-FlashConfig" determined="infoFile" id="FTFE-FlashConfig" location="0x400"/> +<peripheralInstance derived_from="AIPS0" determined="infoFile" id="AIPS0" location="0x40000000"/> +<peripheralInstance derived_from="AIPS1" determined="infoFile" id="AIPS1" location="0x40080000"/> +<peripheralInstance derived_from="AXBS" determined="infoFile" id="AXBS" location="0x40004000"/> +<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x40008000"/> +<peripheralInstance derived_from="FB" determined="infoFile" id="FB" location="0x4000C000"/> +<peripheralInstance derived_from="SYSMPU" determined="infoFile" id="SYSMPU" location="0x4000D000"/> +<peripheralInstance derived_from="FMC" determined="infoFile" id="FMC" location="0x4001F000"/> +<peripheralInstance derived_from="FTFE" determined="infoFile" id="FTFE" location="0x40020000"/> +<peripheralInstance derived_from="DMAMUX" determined="infoFile" id="DMAMUX" location="0x40021000"/> +<peripheralInstance derived_from="CAN0" determined="infoFile" id="CAN0" location="0x40024000"/> +<peripheralInstance derived_from="RNG" determined="infoFile" id="RNG" location="0x40029000"/> +<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x4002C000"/> +<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4002D000"/> +<peripheralInstance derived_from="SPI2" determined="infoFile" id="SPI2" location="0x400AC000"/> +<peripheralInstance derived_from="I2S0" determined="infoFile" id="I2S0" location="0x4002F000"/> +<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x40032000"/> +<peripheralInstance derived_from="USBDCD" determined="infoFile" id="USBDCD" location="0x40035000"/> +<peripheralInstance derived_from="PDB0" determined="infoFile" id="PDB0" location="0x40036000"/> +<peripheralInstance derived_from="PIT" determined="infoFile" id="PIT" location="0x40037000"/> +<peripheralInstance derived_from="FTM0" determined="infoFile" id="FTM0" location="0x40038000"/> +<peripheralInstance derived_from="FTM1" determined="infoFile" id="FTM1" location="0x40039000"/> +<peripheralInstance derived_from="FTM2" determined="infoFile" id="FTM2" location="0x4003A000"/> +<peripheralInstance derived_from="FTM3" determined="infoFile" id="FTM3" location="0x400B9000"/> +<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x4003B000"/> +<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x400BB000"/> +<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x4003D000"/> +<peripheralInstance derived_from="RFVBAT" determined="infoFile" id="RFVBAT" location="0x4003E000"/> +<peripheralInstance derived_from="LPTMR0" determined="infoFile" id="LPTMR0" location="0x40040000"/> +<peripheralInstance derived_from="RFSYS" determined="infoFile" id="RFSYS" location="0x40041000"/> +<peripheralInstance derived_from="SIM" determined="infoFile" id="SIM" location="0x40047000"/> +<peripheralInstance derived_from="PORTA" determined="infoFile" id="PORTA" location="0x40049000"/> +<peripheralInstance derived_from="PORTB" determined="infoFile" id="PORTB" location="0x4004A000"/> +<peripheralInstance derived_from="PORTC" determined="infoFile" id="PORTC" location="0x4004B000"/> +<peripheralInstance derived_from="PORTD" determined="infoFile" id="PORTD" location="0x4004C000"/> +<peripheralInstance derived_from="PORTE" determined="infoFile" id="PORTE" location="0x4004D000"/> +<peripheralInstance derived_from="WDOG" determined="infoFile" id="WDOG" location="0x40052000"/> +<peripheralInstance derived_from="EWM" determined="infoFile" id="EWM" location="0x40061000"/> +<peripheralInstance derived_from="CMT" determined="infoFile" id="CMT" location="0x40062000"/> +<peripheralInstance derived_from="MCG" determined="infoFile" id="MCG" location="0x40064000"/> +<peripheralInstance derived_from="OSC" determined="infoFile" id="OSC" location="0x40065000"/> +<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40066000"/> +<peripheralInstance derived_from="I2C1" determined="infoFile" id="I2C1" location="0x40067000"/> +<peripheralInstance derived_from="I2C2" determined="infoFile" id="I2C2" location="0x400E6000"/> +<peripheralInstance derived_from="UART0" determined="infoFile" id="UART0" location="0x4006A000"/> +<peripheralInstance derived_from="UART1" determined="infoFile" id="UART1" location="0x4006B000"/> +<peripheralInstance derived_from="UART2" determined="infoFile" id="UART2" location="0x4006C000"/> +<peripheralInstance derived_from="UART3" determined="infoFile" id="UART3" location="0x4006D000"/> +<peripheralInstance derived_from="UART4" determined="infoFile" id="UART4" location="0x400EA000"/> +<peripheralInstance derived_from="UART5" determined="infoFile" id="UART5" location="0x400EB000"/> +<peripheralInstance derived_from="USB0" determined="infoFile" id="USB0" location="0x40072000"/> +<peripheralInstance derived_from="CMP0" determined="infoFile" id="CMP0" location="0x40073000"/> +<peripheralInstance derived_from="CMP1" determined="infoFile" id="CMP1" location="0x40073008"/> +<peripheralInstance derived_from="CMP2" determined="infoFile" id="CMP2" location="0x40073010"/> +<peripheralInstance derived_from="VREF" determined="infoFile" id="VREF" location="0x40074000"/> +<peripheralInstance derived_from="LLWU" determined="infoFile" id="LLWU" location="0x4007C000"/> +<peripheralInstance derived_from="PMC" determined="infoFile" id="PMC" location="0x4007D000"/> +<peripheralInstance derived_from="SMC" determined="infoFile" id="SMC" location="0x4007E000"/> +<peripheralInstance derived_from="RCM" determined="infoFile" id="RCM" location="0x4007F000"/> +<peripheralInstance derived_from="SDHC" determined="infoFile" id="SDHC" location="0x400B1000"/> +<peripheralInstance derived_from="ENET" determined="infoFile" id="ENET" location="0x400C0000"/> +<peripheralInstance derived_from="DAC0" determined="infoFile" id="DAC0" location="0x400CC000"/> +<peripheralInstance derived_from="DAC1" determined="infoFile" id="DAC1" location="0x400CD000"/> +<peripheralInstance derived_from="GPIOA" determined="infoFile" id="GPIOA" location="0x400FF000"/> +<peripheralInstance derived_from="GPIOB" determined="infoFile" id="GPIOB" location="0x400FF040"/> +<peripheralInstance derived_from="GPIOC" determined="infoFile" id="GPIOC" location="0x400FF080"/> +<peripheralInstance derived_from="GPIOD" determined="infoFile" id="GPIOD" location="0x400FF0C0"/> +<peripheralInstance derived_from="GPIOE" determined="infoFile" id="GPIOE" location="0x400FF100"/> +<peripheralInstance derived_from="SystemControl" determined="infoFile" id="SystemControl" location="0xE000E000"/> +<peripheralInstance derived_from="SysTick" determined="infoFile" id="SysTick" location="0xE000E010"/> +<peripheralInstance derived_from="NVIC" determined="infoFile" id="NVIC" location="0xE000E100"/> +<peripheralInstance derived_from="MCM" determined="infoFile" id="MCM" location="0xE0080000"/> +<peripheralInstance derived_from="CAU" determined="infoFile" id="CAU" location="0xE0081000"/> </chip> <processor> <name gcc_name="cortex-m4">Cortex-M4</name> diff --git a/source/Client/DIAG.c b/source/Client/DIAG.c index 206f747..7de9b68 100644 --- a/source/Client/DIAG.c +++ b/source/Client/DIAG.c @@ -573,18 +573,20 @@ void USERDIAG_vRun(puint32 const pu32Arg) { u8Temp = (uint8)USERCAL_stRAMCAL.u16ETCOverride; } - else if ((0 != TORQUE_u16GearShiftCount) && (TRUE == TORQUE_boDownShift)) + else if ((0 != TORQUE_u16GearShiftCount) && (TRUE == TORQUE_boDownShift) && (TRUE == TORQUE_boVehicleMovingDS)) { - u8Temp = (TORQUE_u16RevMatchRPM - 800) / 300; + u8Temp = TORQUE_u16RevMatchPosition & 0x1f; } else { if (100000 > MAP_tKiloPaFiltered)//todo chatters here { + /* 0x10 <= IAC_u8SlaveTarget < 0x20 */ u8Temp = 0x3f & IAC_u8SlaveTarget; } else { + /* 0x20 <= MAP_u8PressureThrottleTrim < 0x3f */ u8Temp = MAP_u8PressureThrottleTrim; } } diff --git a/source/Client/EST.c b/source/Client/EST.c index 7d10184..745801e 100644 --- a/source/Client/EST.c +++ b/source/Client/EST.c @@ -467,8 +467,16 @@ void EST_vRun(puint32 const pu32Arg) } else { + if ((TRUE == TORQUE_boVehicleMovingUS) || (TRUE == TORQUE_boVehicleMovingDS)) + { EST_u16Timing = ((TORQUE_u32ESTTorqueModifier * EST_u16TimingBase) + ((0x100 - TORQUE_u32ESTTorqueModifier) * EST_u16TimingStaged)) / 0x100; + } + else + { + /* Just set the base timing without delta limits */ + EST_u16Timing = EST_u16TimingBase; + } } } diff --git a/source/Client/FUEL.c b/source/Client/FUEL.c index d590fb1..b6a9c55 100644 --- a/source/Client/FUEL.c +++ b/source/Client/FUEL.c @@ -634,7 +634,6 @@ void FUEL_vRun(puint32 const pu32Arg) { FUEL_u32ADSamples[u32SampleCount] = FUEL_u32ADCRaw; u32SampleCount = u32SampleCount % FUEL_nSampleCount; - u32SampleCount++; if (0 == u32SampleCount) { @@ -661,6 +660,7 @@ void FUEL_vRun(puint32 const pu32Arg) } FUEL_boNewSample = FALSE; + u32SampleCount++; } boFuelCutsActive = SENSORS_boGetAuxActive(SENSORS_enAUX_LAUNCH_LOW); diff --git a/source/Client/IAC.c b/source/Client/IAC.c index 4f6955b..21bcede 100644 --- a/source/Client/IAC.c +++ b/source/Client/IAC.c @@ -43,7 +43,10 @@ uint32 IAC_u32IdleEntryTimer; uint32 IAC_u32RPMLongAverage; SPREADAPI_ttSpreadIDX IAC_tSpreadISCTargetIDX; TABLEAPI_ttTableIDX IAC_tTableISCTargetIDX; +SPREADAPI_ttSpreadIDX IAC_tSpreadOpenLoopPosIDX; +TABLEAPI_ttTableIDX IAC_tTableOpenLoopPosIDX; uint16 IAC_u16ISCTarget; +uint16 IAC_u16OpenLoopPos; uint16 IAC_u16ISCTargetRamp; //ASAM mode=readvalue name="IAC Target RPM" type=uint16 offset=0 min=0 max=4095 m=1 b=0 units="RPM" format=4.0 help="IAC Current Target RPM" uint16 IAC_u16ISCTargetRampOld; @@ -108,6 +111,12 @@ void IAC_vStart(puint32 const pu32Arg) /* Request and initialise required Kernel managed table for ISC target */ IAC_tTableISCTargetIDX = SETUP_tSetupTable((void*)&USERCAL_stRAMCAL.aUserISCSpeedTargetTable, (void*)&IAC_u16ISCTarget, TYPE_enUInt16, 17, IAC_tSpreadISCTargetIDX, NULL); + + /* Request and initialise required Kernel managed spread for ISC open loop position spread*/ + IAC_tSpreadOpenLoopPosIDX = SETUP_tSetupSpread((void*)&CTS_tTempCFiltered, (void*)&USERCAL_stRAMCAL.aUserISCOpenLoopPosSpread , TYPE_enInt32, 17, SPREADAPI_enSpread4ms, NULL); + + /* Request and initialise required Kernel managed table for ISC open loop position */ + IAC_tTableOpenLoopPosIDX = SETUP_tSetupTable((void*)&USERCAL_stRAMCAL.aUserISCOpenLoopPosTable, (void*)&IAC_u16OpenLoopPos, TYPE_enUInt16, 17, IAC_tSpreadOpenLoopPosIDX, NULL); } void IAC_vRun(puint32 const pu32Arg) @@ -146,8 +155,25 @@ void IAC_vRun(puint32 const pu32Arg) USER_vSVC(SYSAPI_enCalculateTable, (void*)&IAC_tTableISCTargetIDX, NULL, NULL); + /* Calculate the current spread for ISC target */ + USER_vSVC(SYSAPI_enCalculateSpread, (void*)&IAC_tSpreadOpenLoopPosIDX, + NULL, NULL); + + /* Lookup the current value for ISC target */ + USER_vSVC(SYSAPI_enCalculateTable, (void*)&IAC_tTableOpenLoopPosIDX, + NULL, NULL); + + if ((TRUE == USERCAL_stRAMCAL.u8VehicleStoppedFuelCutEnable) || + ((FALSE == USERCAL_stRAMCAL.u8VehicleStoppedFuelCutEnable) && + (TRUE == TORQUE_boVehicleMovingUS))) + { IAC_boOverrunCutRPMEnable = (IAC_u16ISCTarget + USERCAL_stRAMCAL.u16OverrunCutEnableRPM) > CAM_u32RPMRaw ? FALSE : IAC_boOverrunCutRPMEnable; IAC_boOverrunCutRPMEnable = (IAC_u16ISCTarget + USERCAL_stRAMCAL.u16OverrunCutDisableRPM) < CAM_u32RPMRaw ? TRUE : IAC_boOverrunCutRPMEnable; + } + else + { + IAC_boOverrunCutRPMEnable = FALSE; + } u32IdleEntryRPM = IAC_u16ISCTarget + USERCAL_stRAMCAL.u16IdleEntryOffset; IAC_u16ISCTargetRamp = IAC_u16ISCTarget + u16TargetRamp + u16AfterStartTargetRamp; @@ -394,7 +420,10 @@ void IAC_vRun(puint32 const pu32Arg) IAC_u32ISCDuty = u16ISCMax >= IAC_u32ISCDuty ? IAC_u32ISCDuty : u16ISCMax; } - IAC_u8SlaveTarget = 0x10 + (IAC_u32ISCDuty / 0x100); + s32Temp = (IAC_u32ISCDuty - 2048) + 3 * ((sint32)IAC_u16OpenLoopPos << 4); + s32Temp /= 4; + s32Temp = 0 > s32Temp ? 0 : s32Temp; + IAC_u8SlaveTarget = 0x10 + (s32Temp / 0x100); #endif //BUILD_BSP_IAC_STEPPER @@ -409,7 +438,7 @@ void IAC_vRun(puint32 const pu32Arg) IAC_s32ISCESTTrim[1] = 0; /* Open loop duty */ - IAC_u32ISCDuty = (u16ISCMin + u16ISCMax) / 2; + IAC_u32ISCDuty = IAC_u16OpenLoopPos << 4; IAC_u8SlaveTarget = 0x10 + (IAC_u32ISCDuty / 0x100); u16TargetRamp = USERCAL_stRAMCAL.u16ISCEntryRamp; } diff --git a/source/Client/IAC.h b/source/Client/IAC.h index 8c6dee9..3f90dd6 100644 --- a/source/Client/IAC.h +++ b/source/Client/IAC.h @@ -50,6 +50,7 @@ typedef enum /* GLOBAL VARIABLE DECLARATIONS ***********************************************/ EXTERN uint32 IAC_u32ISCDuty; +//ASAM mode=readvalue name="IAC Duty" type=uint32 offset=0 min=0 max=100 m=0.024 b=0 units="%" format=4.1 help="IAC Duty Position" EXTERN IAC_tenControlState IAC_enControlState; EXTERN bool IAC_boOverrunCutRPMEnable; EXTERN sint32 IAC_s32ISCESTTrim[2]; diff --git a/source/Client/LSU4X.c b/source/Client/LSU4X.c index 7eea0da..671fc18 100644 --- a/source/Client/LSU4X.c +++ b/source/Client/LSU4X.c @@ -29,14 +29,14 @@ /* LOCAL VARIABLE DEFINITIONS (STATIC) ****************************************/ DACAPI_ttOutputVoltage LSU4X_atDACVoltageQueue[LSU_DEVICE_COUNT][LSU4X_nDACQueueSize]; GPM6_ttVolts LSU4X_atNernstSenseVoltsDC[LSU_DEVICE_COUNT]; -//ASAM mode=readvalue name="Nernst Sense 1 Volts" type=uint32 offset=0 min=0 max=5 m=0.001 b=0 units="V" format=4.3 help="Nernst Sense Volts Left" +//ASAMREMOVED!! mode=readvalue name="Nernst Sense 1 Volts" type=uint32 offset=0 min=0 max=5 m=0.001 b=0 units="V" format=4.3 help="Nernst Sense Volts Left" GPM6_ttVolts LSU4X_atNernstSenseVoltsACHigh[LSU_DEVICE_COUNT];/*CR1_42*/ GPM6_ttVolts LSU4X_atNernstSenseVoltsACLow[LSU_DEVICE_COUNT];/*CR1_42*/ sint32 LSU4X_ai32PumpCurrentADC[LSU_DEVICE_COUNT]; sint32 LSU4X_ai32PumpCurrentADC[LSU_DEVICE_COUNT]; sint32 LSU4X_ai32PumpCurrentADCFiltered[LSU_DEVICE_COUNT]; GPM6_ttMicroAmps LSU4X_atPumpCurrentMicroAmps[LSU_DEVICE_COUNT];/*CR1_42*/ -//ASAM mode=readvalue name="Pump Current 1" type=sint32 offset=0 min=-20000 max=20000 m=0.001 b=0 units="uA" format=4.3 help="Pump 1 Current (uA)" +//ASAMREMOVED!! mode=readvalue name="Pump Current 1" type=sint32 offset=0 min=-20000 max=20000 m=0.001 b=0 units="uA" format=4.3 help="Pump 1 Current (uA)" GPM6_ttMicroAmps LSU4X_atPumpCurrentMicroAmpsNorm[LSU_DEVICE_COUNT];/*CR1_42*/ CTRLAPI_ttPIDIDX LSU4X_atPIDLSU4XIDX[LSU_DEVICE_COUNT]; SPREADAPI_ttSpreadIDX LSU4X_atSpreadLSU4XIDX[LSU_DEVICE_COUNT]; diff --git a/source/Client/LSU4X.h b/source/Client/LSU4X.h index f08bba6..83de96d 100644 --- a/source/Client/LSU4X.h +++ b/source/Client/LSU4X.h @@ -88,25 +88,25 @@ typedef struct EXTERN uint32 LSU4X_au32ACSampleCount[LSU_DEVICE_COUNT]; EXTERN uint32 LSU4X_au32DCSampleCount[LSU_DEVICE_COUNT]; EXTERN uint16 LSU4X_u16PWMPeriod; -//ASAM mode=readvalue name="PWMPeriod" type=uint8 offset=0 min=0 max=5 m=0.001 b=1 units="dl" format=6.0 help="PWM Period" +//REMOVED!!ASAMREMOVED!! mode=readvalue name="PWMPeriod" type=uint8 offset=0 min=0 max=5 m=0.001 b=1 units="dl" format=6.0 help="PWM Period" EXTERN uint16 LSU4X_u16PWMLastStart; -//ASAM mode=readvalue name="PWMLastStart" type=uint8 offset=0 min=0 max=5 m=0.001 b=1 units="dl" format=6.0 help="PWM Period Last Origin" +//REMOVED!!ASAMREMOVED!! mode=readvalue name="PWMLastStart" type=uint8 offset=0 min=0 max=5 m=0.001 b=1 units="dl" format=6.0 help="PWM Period Last Origin" EXTERN GPM6_ttOhms LSU4X_atNernstSenseOhms[LSU_DEVICE_COUNT]; -//ASAM mode=readvalue name="Nernst Rout 1" type=uint32 offset=0 min=0 max=1000 m=0.001 b=0 units="Ohm" format=3.0 help="Nernst 1 output impedence" -//ASAM mode=readvalue name="Nernst Rout 2" type=uint32 offset=4 min=0 max=1000 m=0.001 b=0 units="Ohm" format=3.0 help="Nernst 2 output impedence" +//REMOVED!!ASAMREMOVED!! mode=readvalue name="Nernst Rout 1" type=uint32 offset=0 min=0 max=1000 m=0.001 b=0 units="Ohm" format=3.0 help="Nernst 1 output impedence" +//REMOVED!!ASAMREMOVED!! mode=readvalue name="Nernst Rout 2" type=uint32 offset=4 min=0 max=1000 m=0.001 b=0 units="Ohm" format=3.0 help="Nernst 2 output impedence" EXTERN GPM6_ttLambda LSU4X_atLambdaRaw[LSU_DEVICE_COUNT]; -//ASAM mode=readvalue name="Lambda 1" type=uint16 offset=0 min=0 max=5 m=0.001 b=0 units="dl" format=4.3 help="Lambda 1 Measurement (dimensionless)" -//ASAM mode=readvalue name="AFR 1" type=uint16 offset=0 min=0 max=50 m=0.0147 b=0 units="ARF" format=2.3 help="AFR 1 Measurement (dimensionless)" -//ASAM mode=readvalue name="Lambda 2" type=uint16 offset=2 min=0 max=5 m=0.001 b=0 units="dl" format=4.3 help="Lambda 2 Measurement (dimensionless)" +//REMOVED!!ASAMREMOVED!! mode=readvalue name="Lambda 1" type=uint16 offset=0 min=0 max=5 m=0.001 b=0 units="dl" format=4.3 help="Lambda 1 Measurement (dimensionless)" +//REMOVED!!ASAMREMOVED!! mode=readvalue name="AFR 1" type=uint16 offset=0 min=0 max=50 m=0.0147 b=0 units="ARF" format=2.3 help="AFR 1 Measurement (dimensionless)" +//REMOVED!!ASAMREMOVED!! mode=readvalue name="Lambda 2" type=uint16 offset=2 min=0 max=5 m=0.001 b=0 units="dl" format=4.3 help="Lambda 2 Measurement (dimensionless)" EXTERN uint32 LSU4X_aau32ACSamples[LSU_DEVICE_COUNT][LSU4X_nACSamplesCount]; -//ASAM mode=readvalue name="Samples1" type=uint32 offset=0 min=0 max=5 m=1 b=0 units="n" format=6.0 help="sample 1" -//ASAM mode=readvalue name="Samples2" type=uint32 offset=4 min=0 max=5 m=1 b=0 units="n" format=6.0 help="sample 2" -//ASAM mode=readvalue name="Samples3" type=uint32 offset=8 min=0 max=5 m=1 b=0 units="n" format=6.0 help="sample 3" -//ASAM mode=readvalue name="Samples4" type=uint32 offset=12 min=0 max=5 m=1 b=0 units="n" format=6.0 help="sample 4" -//ASAM mode=readvalue name="Samples5" type=uint32 offset=16 min=0 max=5 m=1 b=0 units="n" format=6.0 help="sample 5" -//ASAM mode=readvalue name="Samples6" type=uint32 offset=20 min=0 max=5 m=1 b=0 units="n" format=6.0 help="sample 6" -//ASAM mode=readvalue name="Samples7" type=uint32 offset=24 min=0 max=5 m=1 b=0 units="n" format=6.0 help="sample 7" -//ASAM mode=readvalue name="Samples8" type=uint32 offset=28 min=0 max=5 m=1 b=0 units="n" format=6.0 help="sample 8" +//REMOVED!!ASAMREMOVED!! mode=readvalue name="Samples1" type=uint32 offset=0 min=0 max=5 m=1 b=0 units="n" format=6.0 help="sample 1" +//REMOVED!!ASAMREMOVED!! mode=readvalue name="Samples2" type=uint32 offset=4 min=0 max=5 m=1 b=0 units="n" format=6.0 help="sample 2" +//REMOVED!!ASAMREMOVED!! mode=readvalue name="Samples3" type=uint32 offset=8 min=0 max=5 m=1 b=0 units="n" format=6.0 help="sample 3" +//REMOVED!!ASAMREMOVED!! mode=readvalue name="Samples4" type=uint32 offset=12 min=0 max=5 m=1 b=0 units="n" format=6.0 help="sample 4" +//REMOVED!!ASAMREMOVED!! mode=readvalue name="Samples5" type=uint32 offset=16 min=0 max=5 m=1 b=0 units="n" format=6.0 help="sample 5" +//REMOVED!!ASAMREMOVED!! mode=readvalue name="Samples6" type=uint32 offset=20 min=0 max=5 m=1 b=0 units="n" format=6.0 help="sample 6" +//REMOVED!!ASAMREMOVED!! mode=readvalue name="Samples7" type=uint32 offset=24 min=0 max=5 m=1 b=0 units="n" format=6.0 help="sample 7" +//REMOVED!!ASAMREMOVED!! mode=readvalue name="Samples8" type=uint32 offset=28 min=0 max=5 m=1 b=0 units="n" format=6.0 help="sample 8" EXTERN sint32 LSU4X_aas32DCSamples[LSU_DEVICE_COUNT][LSU4X_nDCSamplesCount]; EXTERN uint8 LSU4X_au8ACCallBackWait[LSU_DEVICE_COUNT]; diff --git a/source/Client/LSUH.c b/source/Client/LSUH.c index 39ba41b..6c680bb 100644 --- a/source/Client/LSUH.c +++ b/source/Client/LSUH.c @@ -32,7 +32,6 @@ TEPMAPI_tstTimedEvent LSUH_aastTimedEvents[LSU_DEVICE_COUNT][TEPMAPI_nEventsMax]; #endif //LSUH_TEPM uint32 LSUH_au32TEPMTimeout[LSU_DEVICE_COUNT]; -//ASAM mode=readvalue name="Heater Duty 1" type=uint32 offset=0 min=0 max=100 m=0.001 b=0 units="%" format=6.3 help="Heater Left Duty Cycle" uint32 LSUH_u32HeaterDutyMax; uint32 LSUH_au32HeaterLowADCOnRaw[LSU_DEVICE_COUNT]; uint32 LSUH_au32HeaterLowADCOffRaw[LSU_DEVICE_COUNT]; diff --git a/source/Client/LSUH.h b/source/Client/LSUH.h index 0980ac2..b2c005d 100644 --- a/source/Client/LSUH.h +++ b/source/Client/LSUH.h @@ -62,7 +62,7 @@ #endif EXTERN uint32 LSUH_au32HeaterDuty[LSU_DEVICE_COUNT]; - +//ASAMREMOVED!! mode=readvalue name="Heater Duty 1" type=uint32 offset=0 min=0 max=100 m=0.1 b=0 units="%" format=4.1 help="Heater Left Duty Cycle" /* GLOBAL TYPE DEFINITIONS ****************************************************/ /******************************************************************************* @@ -86,7 +86,7 @@ EXTERN uint32 LSUH_au32ACADCDeltaFiltered[LSU_DEVICE_COUNT]; EXTERN uint32 LSUH_aau32ADADCSamples[LSU_DEVICE_COUNT][LSUH_nHeaterOhmsSamples]; EXTERN uint32 LSUH_au32ACADCDelta[LSU_DEVICE_COUNT]; EXTERN GPM6_ttOhms LSUH_atHeaterOhms[LSU_DEVICE_COUNT]; -//ASAM mode=readvalue name="Heater Ohms 1" type=uint32 offset=0 min=0 max=10 m=0.001 b=0 units="Ohms" format=5.3 help="Heater 1 Ohms" +//ASAMREMOVED!! mode=readvalue name="Heater Ohms 1" type=uint32 offset=0 min=0 max=10 m=0.001 b=0 units="Ohms" format=5.3 help="Heater 1 Ohms" /* GLOBAL FUNCTION DECLARATIONS ***********************************************/ diff --git a/source/Client/SENSORS.c b/source/Client/SENSORS.c index ce10b66..9050c9a 100644 --- a/source/Client/SENSORS.c +++ b/source/Client/SENSORS.c @@ -548,6 +548,7 @@ static void SENSORS_vGetCANSensorData() static uint8 u8OldGear; static uint8 u8OldDistCount; static sint16 s16OldDistance; + static uint32 u32VSSTimeout = 0; USER_vSVC(SYSAPI_enGetRawCommsBuffer, (void*)&enEHIOResource, (void*)NULL, (void*)NULL); @@ -596,7 +597,16 @@ static void SENSORS_vGetCANSensorData() TORQUE_u8ATXSelectedGear = 0xf & pu8CANDataBuffer[18]; TORQUE_boDownShift = u8OldGear > (0xf & pu8CANDataBuffer[18]) ? TRUE : FALSE; u8OldGear = 0xf & pu8CANDataBuffer[18]; - TORQUE_u16GearShiftCount = USERCAL_stRAMCAL.u16ShiftCountLimit; + + if (0 == TORQUE_boDownShift) + { + TORQUE_u16GearShiftCount = USERCAL_stRAMCAL.u16ShiftUpCountLimit; + } + else + { + TORQUE_u16GearShiftCount = USERCAL_stRAMCAL.u16ShiftDownCountLimit; + } + TORQUE_u16GearShiftPressureControlCount = USERCAL_stRAMCAL.u16ShiftCountPressureControlLimit; } else @@ -672,8 +682,16 @@ static void SENSORS_vGetCANSensorData() SENSORS_u16CANVSS = ((uint16)s32Temp / 2) + (SENSORS_u16CANVSS / 2); s16OldDistance = s16Temp; + u32VSSTimeout = 0; + } + else if (u32VSSTimeout > 125) + { + SENSORS_u16CANVSS = 0; + } + else + { + u32VSSTimeout++; } - /* Calculate gear */ diff --git a/source/Client/TORQUE.c b/source/Client/TORQUE.c index cabceb1..26590bd 100644 --- a/source/Client/TORQUE.c +++ b/source/Client/TORQUE.c @@ -33,6 +33,8 @@ SPREADAPI_ttSpreadIDX TORQUE_tSpreadTorquePedalIDX; TABLEAPI_ttTableIDX TORQUE_tTableTorquePedalIDX; SPREADAPI_ttSpreadIDX TORQUE_tSpreadETCScaleIDX; TABLEAPI_ttTableIDX TORQUE_tTableETCScaleIDX; +SPREADAPI_ttSpreadIDX TORQUE_tSpreadRevMatchIDX; +TABLEAPI_ttTableIDX TORQUE_tTableRevMatchIDX; /* LOCAL FUNCTION PROTOTYPES (STATIC) *****************************************/ @@ -45,13 +47,24 @@ void TORQUE_vStart(puint32 const pu32Arg) /* Request and initialise required Kernel managed table for ETC scale function */ TORQUE_tTableETCScaleIDX = SETUP_tSetupTable((void*)&USERCAL_stRAMCAL.aUserETCScaleTable, (void*)&TORQUE_u16ETCScale, TYPE_enUInt16, 17, TORQUE_tSpreadETCScaleIDX, NULL); + + /* Request and initialise required Kernel managed spread for ETC rev match */ + TORQUE_tSpreadRevMatchIDX = SETUP_tSetupSpread((void*)&TORQUE_u32RevMatchRPM, (void*)&USERCAL_stRAMCAL.aUserETCRPMMatchSpread, TYPE_enUInt32, 17, SPREADAPI_enSpread4ms, NULL); + + /* Request and initialise required Kernel managed table for launch and flat shift fuel cuts */ + TORQUE_tTableRevMatchIDX = SETUP_tSetupTable((void*)&USERCAL_stRAMCAL.aUserETCRPMMatchTable, (void*)&TORQUE_u16RevMatchPosition, TYPE_enUInt16, 17, TORQUE_tSpreadRevMatchIDX, NULL); } void TORQUE_vRun(puint32 const pu32Arg) { uint32 u32Temp; + uint16 u16Temp; static uint32 u32DSGCutsCount; + TORQUE_boVehicleMovingDS = USERCAL_stRAMCAL.u16ATXTorqueOnVSS < SENSORS_u16CANVSS ? TRUE : TORQUE_boVehicleMovingDS; + TORQUE_boVehicleMovingDS = USERCAL_stRAMCAL.u16ATXTorqueOffVSS > SENSORS_u16CANVSS ? FALSE : TORQUE_boVehicleMovingDS; + TORQUE_boVehicleMovingUS = 150 < SENSORS_u16CANVSS ? TRUE : TORQUE_boVehicleMovingUS; + TORQUE_boVehicleMovingUS = 50 > SENSORS_u16CANVSS ? FALSE : TORQUE_boVehicleMovingUS; if (10000 < MAP_tKiloPaFiltered) { @@ -114,7 +127,8 @@ void TORQUE_vRun(puint32 const pu32Arg) TORQUE_u32TorquePedalEstimateScaled = u32Temp; /* Apply ATX torque mode */ - if (EST_nIgnitionReqDSGStage1 == EST_enIgnitionTimingRequest) + if ((EST_nIgnitionReqDSGStage1 == EST_enIgnitionTimingRequest) + && (TRUE == TORQUE_boVehicleMovingUS)) { TORQUE_u32ESTTorqueModifier = 160; TORQUE_u32FuelTorqueModifier = 220; @@ -126,8 +140,9 @@ void TORQUE_vRun(puint32 const pu32Arg) u32DSGCutsCount = 0; } - else if ((EST_nIgnitionReqDSGStage2 == EST_enIgnitionTimingRequest) || + else if (((EST_nIgnitionReqDSGStage2 == EST_enIgnitionTimingRequest) || (EST_nIgnitionReqDSGCutsStage3 == EST_enIgnitionTimingRequest)) + && (TRUE == TORQUE_boVehicleMovingUS)) { if (u32DSGCutsCount > USERCAL_stRAMCAL.u16TorqueReductionMaxDuration) { @@ -157,6 +172,7 @@ void TORQUE_vRun(puint32 const pu32Arg) } else { + /* No torque modification if no shift or vehicle not moving */ TORQUE_u32OutputTorqueModified = TORQUE_u32OutputTorqueEstimate; TORQUE_u32ESTTorqueModifier = 0x100; TORQUE_u32DBWTorqueModifier = 0x100; @@ -180,25 +196,50 @@ void TORQUE_vRun(puint32 const pu32Arg) USER_vSVC(SYSAPI_enCalculateTable, (void*)&TORQUE_tTableETCScaleIDX, NULL, NULL); - /* Compute rev match RPM */ + + /* Compute Rev Match RPM */ if (0 != TORQUE_u16GearShiftCount) { - if (TRUE == TORQUE_boDownShift) + if ((TRUE == TORQUE_boDownShift) && (TRUE == TORQUE_boVehicleMovingDS)) { if ((6 > TORQUE_u8ATXSelectedGear) && (0 < TORQUE_u8ATXSelectedGear)) { u32Temp = 1000 * SENSORS_u16CANVSS; - TORQUE_u16RevMatchRPM = (uint16)(u32Temp / USERCAL_stRAMCAL.u16VSSPerRPM[TORQUE_u8ATXSelectedGear - 1]); + + TORQUE_u32RevMatchRPM = (uint16)(u32Temp / USERCAL_stRAMCAL.u16VSSPerRPM[TORQUE_u8ATXSelectedGear - 1]); + + /* Calculate the current spread for Rev Match scale */ + USER_vSVC(SYSAPI_enCalculateSpread, (void*)&TORQUE_tSpreadRevMatchIDX, + NULL, NULL); + + /* Lookup the current Rev Match ETC position */ + USER_vSVC(SYSAPI_enCalculateTable, (void*)&TORQUE_tTableRevMatchIDX, + NULL, NULL); + + if (USERCAL_stRAMCAL.u16ShiftDownCountLimit > USERCAL_stRAMCAL.u16ShiftDownBlipLimit) + { + /* How long into the down-shift? */ + u16Temp = USERCAL_stRAMCAL.u16ShiftDownCountLimit - TORQUE_u16GearShiftCount; + + if (u16Temp > USERCAL_stRAMCAL.u16ShiftDownBlipLimit) + { + TORQUE_u16RevMatchPosition *= TORQUE_u16GearShiftCount; + u16Temp = USERCAL_stRAMCAL.u16ShiftDownCountLimit - USERCAL_stRAMCAL.u16ShiftDownBlipLimit; + TORQUE_u16RevMatchPosition /= u16Temp; + } + } } } else { - TORQUE_u16RevMatchRPM = 1500; + TORQUE_u32RevMatchRPM = 1500; + TORQUE_u16RevMatchPosition = 0; } } else { - TORQUE_u16RevMatchRPM = 1500; + TORQUE_u32RevMatchRPM = 1500; + TORQUE_u16RevMatchPosition = 0; } } diff --git a/source/Client/TORQUE.h b/source/Client/TORQUE.h index 53afa66..af3cff0 100644 --- a/source/Client/TORQUE.h +++ b/source/Client/TORQUE.h @@ -55,8 +55,14 @@ EXTERN uint16 TORQUE_u16GearShiftPressureControlCount; //ASAM mode=readvalue name="Shift Control Pressure Count" type=uint16 offset=0 min=0 max=65535 m=1 b=0 units="dl" format=5.0 help="Shift Control Pressure Count" EXTERN uint8 TORQUE_u8ATXSelectedGear; //ASAM mode=readvalue name="ATX Selected Gear" type=uint8 offset=0 min=0 max=255 m=1 b=0 units="dl" format=1.0 help="ATX Selected Gear" -EXTERN uint16 TORQUE_u16RevMatchRPM; -//ASAM mode=readvalue name="Rev Match RPM" type=uint16 offset=0 min=0 max=65535 m=1 b=0 units="RPM" format=4.0 help="Rev Match Downshift RPM" +EXTERN uint32 TORQUE_u32RevMatchRPM; +//ASAM mode=readvalue name="Rev Match RPM" type=uint32 offset=0 min=0 max=65535 m=1 b=0 units="RPM" format=4.0 help="Rev Match Downshift RPM" +EXTERN uint16 TORQUE_u16RevMatchPosition; +//ASAM mode=readvalue name="Rev Match ETC Position" type=uint16 offset=0 min=0 max=65535 m=1 b=0 units="dl" format=4.0 help="Rev Match ETC Position" +EXTERN bool TORQUE_boVehicleMovingUS; +//ASAM mode=readvalue name="ATX Vehicle Moving Upshifts" type=uint8 offset=0 min=0 max=1 m=1 b=0 units="dl" format=1.0 help="ATX Vehicle Moving Upshifts" +EXTERN bool TORQUE_boVehicleMovingDS; +//ASAM mode=readvalue name="ATX Vehicle Moving Downshifts" type=uint8 offset=0 min=0 max=1 m=1 b=0 units="dl" format=1.0 help="ATX Vehicle Moving Downshifts" /* GLOBAL FUNCTION DECLARATIONS ***********************************************/ void TORQUE_vStart(uint32 * const pu32Arg); diff --git a/source/Client/USERCAL.h b/source/Client/USERCAL.h index eb1c182..f0fd848 100644 --- a/source/Client/USERCAL.h +++ b/source/Client/USERCAL.h @@ -40,6 +40,7 @@ #define GOLF_MK6_CAL #define TEST_60_M2_off #define FIESTA_36_M1_off +#define FIESTA_36_M1_TEENSY_ADAPT_off #define TEENSY_ADAPT_BASEoff #ifdef TESTCAL @@ -64,6 +65,9 @@ #ifdef GOLF_MK6_CAL #include "Golf_Mk6.h" + #ifndef BUILD_SPARKDOG_PF + #error "Bad build config" + #endif #endif #ifdef TEST_60_M2 @@ -74,8 +78,15 @@ #include "FIESTA_36_M1.h" #endif +#ifdef FIESTA_36_M1_TEENSY_ADAPT +#include "FIESTA_36_M1_TEENSY_ADAPT.h" +#endif + #ifdef TEENSY_ADAPT_BASE #include "teensy_adapt_base.h" + #ifndef BUILD_SPARKDOG_TEENSY_ADAPT + #error "Bad build config" + #endif #endif //TEENSY_ADAPT_BASE #pragma GCC diagnostic pop @@ -385,7 +396,7 @@ typedef struct uint32 aUserETCScaleSpread[17]; uint16 aUserETCScaleTable[17]; uint16 u16TorqueReductionMaxFuelCut; - uint16 u16ShiftCountLimit; + uint16 u16ShiftUpCountLimit; uint16 au16BoostTarget[6]; uint16 u16GDIPressureMin; uint16 u16GDIPressureMax; @@ -411,6 +422,15 @@ typedef struct uint16 u16ETCOverrideKeys; uint16 u16ETCOverride; uint16 u16DiagType; + uint32 aUserETCRPMMatchSpread[17]; + uint16 aUserETCRPMMatchTable[17]; + uint16 u16ShiftDownCountLimit; + uint16 u16ShiftDownBlipLimit; + uint16 u16ATXTorqueOnVSS; + uint16 u16ATXTorqueOffVSS; + GPM6_ttTempC aUserISCOpenLoopPosSpread[17]; + uint16 aUserISCOpenLoopPosTable[17]; + uint8 u8VehicleStoppedFuelCutEnable; uint16 u16CRC16; uint8* offsets; } BUILD_PACKING USERCAL_tstCalibration; @@ -861,7 +881,7 @@ EXTERN USERCAL_tstCalibration BUILD_PACKING USERCAL_stRAMCAL; //ASAM mode=writeaxis_pts name="ETC Scale Table_XAXIS" parent="USERCAL_stRAMCAL" type=uint32 offset=10722 min=0 max=10000 m=1 b=0 units="RPM" format=4.0 help="XXXX X Axis HTML=366.HTML" xcount=17 xindexvar="Engine Speed Raw" //ASAM mode=writecurve name="ETC Scale Table" parent="USERCAL_stRAMCAL" type=uint16 offset=10790 min=0 max=101 m=1.6 b=0 units="V" format=4.1 help="XXX Curve HTML=367.HTML" xcount=17 xindexvar="Engine Speed Raw" //ASAM mode=writevalue name="Torque Reduction Max Fuel Cut" parent="USERCAL_stRAMCAL" type=uint16 offset=10824 min=0 max=100 m=1 b=0 units="%" format=3.2 help="Pressure Control Hyst HTML=368.HTML" -//ASAM mode=writevalue name="Shift Time Limit" parent="USERCAL_stRAMCAL" type=uint16 offset=10826 min=0 max=1 m=0.008 b=0 units="s" format=3.2 help="Pressure Control Hyst HTML=369.HTML" +//ASAM mode=writevalue name="Shift Up Time Limit" parent="USERCAL_stRAMCAL" type=uint16 offset=10826 min=0 max=1 m=0.008 b=0 units="s" format=3.2 help="Pressure Control Hyst HTML=369.HTML" //ASAM mode=writevalue name="Boost Target 1" parent="USERCAL_stRAMCAL" type=uint16 offset=10828 min=0 max=200 m=0.01 b=0 units="kPa" format=4.2 help="Boost Gear 1 HTML=370.HTML" //ASAM mode=writevalue name="Boost Target 2" parent="USERCAL_stRAMCAL" type=uint16 offset=10830 min=0 max=200 m=0.01 b=0 units="kPa" format=4.2 help="Boost Gear 2 HTML=371.HTML" @@ -915,12 +935,25 @@ EXTERN USERCAL_tstCalibration BUILD_PACKING USERCAL_stRAMCAL; //ASAM mode=writevalue name="VSS Per 1k RPM G8" parent="USERCAL_stRAMCAL" type=uint16 offset=12197 min=0 max=6555 m=0.1 b=0 units="km/h" format=5.1 help="VSS Per 1000 RPM G8 HTML=408.HTML" //ASAM mode=writevalue name="VSS CAN Calibration" parent="USERCAL_stRAMCAL" type=uint16 offset=12199 max=65535 m=1 b=0 units="dl" format=5.0 help="VSS CAN Calibration HTML=409.HTML" +//ASAM mode=writevalue name="ETC Override Keys" parent="USERCAL_stRAMCAL" type=uint16 offset=12201 min=0 max=65535 m=1 b=0 units="dl" format=5.0 help="ETC Override Keys HTML=410.HTML" +//ASAM mode=writevalue name="ETC Override" parent="USERCAL_stRAMCAL"typ e=uint16 offset=12203 min=0 max=255 m=1 b=0 units="dl" format=5.0 help="ETC Override HTML=411.HTML" +//ASAM mode=writevalue name="Vehicle Model Diag" parent="USERCAL_stRAMCAL" type=uint16 offset=12205 min=0 max=255 units="ENUMERATION VAG_GTI_DSG_DQ250_Mk6=0 VAG_GTI_MT6_Mk6=1" format=3.0 help="ETC Override HTML=412.HTML" -//ASAM mode=writevalue name="ETC Override Keys" type=uint16 offset=12201 min=0 max=65535 m=1 b=0 units="dl" format=5.0 help="ETC Override Keys" -//ASAM mode=writevalue name="ETC Override" type=uint16 offset=12203 min=0 max=255 m=1 b=0 units="dl" format=5.0 help="ETC Override" -//ASAM mode=writevalue name="Vehicle Model Diag" type=uint16 offset=12205 min=0 max=255 units="ENUMERATION VAG_GTI_DSG_DQ250_Mk6=0 VAG_GTI_MT6_Mk6=1" format=3.0 help="ETC Override" +//ASAM mode=writeaxis_pts name="ETC RPM Match Table_XAXIS" parent="USERCAL_stRAMCAL" type=uint32 offset=12207 min=0 max=10000 m=1 b=0 units="RPM" format=4.0 xcount=17 xindexvar="Rev Match RPM" help="TODO HTML=413.HTML" +//ASAM mode=writecurve name="ETC RPM Match Table" parent="USERCAL_stRAMCAL" type=uint16 offset=12275 min=0 max=15 m=1 b=0 units="counts" format=3.1 xcount=17 xindexvar="Rev Match RPM" help="TODO HTML=414.HTML" -//ASAM mode=writevalue name="CAL CRC" parent="USERCAL_stRAMCAL" type=uint16 offset=12207 min=0 max=255 m=1 b=0 units="dl" format=3.0 help="CAL CRC16" +//ASAM mode=writevalue name="Shift Down Time Limit" parent="USERCAL_stRAMCAL" type=uint16 offset=12309 min=0 max=5 m=0.008 b=0 units="s" format=3.2 help="Pressure Control Hyst HTML=415.HTML" +//ASAM mode=writevalue name="Shift Down Blip Limit" parent="USERCAL_stRAMCAL" type=uint16 offset=12311 min=0 max=5 m=0.008 b=0 units="s" format=3.2 help="Pressure Control Hyst HTML=416.HTML" + +//ASAM mode=writevalue name="ATX Torque On VSS" parent="USERCAL_stRAMCAL" type=uint16 offset=12313 min=0 max=50 m=0.1 b=0 units="kph" format=3.2 help="Pressure Control Hyst HTML=417.HTML" +//ASAM mode=writevalue name="ATX Torque Off VSS" parent="USERCAL_stRAMCAL" type=uint16 offset=12315 min=0 max=50 m=0.1 b=0 units="kph" format=3.2 help="Pressure Control Hyst HTML=418.HTML" + +//ASAM mode=writeaxis_pts name="ISC Open Loop Position Table_XAXIS" parent="USERCAL_stRAMCAL" type=sint32 offset=12317 min=0 max=200 m=0.001 b=0 units="degrees C" format=4.3 help="ISC Target X Axis HTML=419.HTML" xcount=17 xindexvar="Coolant Temperature" +//ASAM mode=writecurve name="ISC Open Loop Position Table" parent="USERCAL_stRAMCAL" type=uint16 offset=12385 min=0 max=100 m=0.4 b=0 units="%" format=4.3 help="ISC Target Curve HTML=420.HTML" xcount=17 xindexvar="Coolant Temperature" + +//ASAM mode=writevalue name="Vehicle Stopped Fuel Cut Enable" parent="USERCAL_stRAMCAL" type=uint8 offset=12419 min=0 max=1 m=1 b=0 units="bool" format=1.0 help="Vehicle Stopped Fuel Cut Enable HTML=421.HTML" + +//ASAM mode=writevalue name="CAL CRC" parent="USERCAL_stRAMCAL" type=uint16 offset=12420 min=0 max=255 m=1 b=0 units="dl" format=3.0 help="CAL CRC16" /* NOTE MUST ALWAYS INCLUDE CAL STRUCT ELEMENTS ONE FOR ONE AND IN ORDER */ /* Testing offsets table for ASAM parsing tool here */ @@ -1193,7 +1226,7 @@ EXTERN USERCAL_tstCalibration BUILD_PACKING USERCAL_stRAMCAL; offsetof(USERCAL_tstCalibration, aUserETCScaleSpread[17]),\ offsetof(USERCAL_tstCalibration, aUserETCScaleTable[17]),\ offsetof(USERCAL_tstCalibration, u16TorqueReductionMaxFuelCut),\ - offsetof(USERCAL_tstCalibration, u16ShiftCountLimit),\ + offsetof(USERCAL_tstCalibration, u16ShiftUpCountLimit),\ offsetof(USERCAL_tstCalibration, au16BoostTarget),\ offsetof(USERCAL_tstCalibration, u16GDIPressureMin),\ offsetof(USERCAL_tstCalibration, u16GDIPressureMax),\ @@ -1219,10 +1252,19 @@ EXTERN USERCAL_tstCalibration BUILD_PACKING USERCAL_stRAMCAL; offsetof(USERCAL_tstCalibration, u16ETCOverrideKeys),\ offsetof(USERCAL_tstCalibration, u16ETCOverride),\ offsetof(USERCAL_tstCalibration, u16DiagType),\ + offsetof(USERCAL_tstCalibration, aUserETCRPMMatchSpread),\ + offsetof(USERCAL_tstCalibration, aUserETCRPMMatchTable),\ + offsetof(USERCAL_tstCalibration, u16ShiftDownCountLimit),\ + offsetof(USERCAL_tstCalibration, u16ShiftDownBlipLimit),\ + offsetof(USERCAL_tstCalibration, u16ATXTorqueOnVSS),\ + offsetof(USERCAL_tstCalibration, u16ATXTorqueOffVSS),\ + offsetof(USERCAL_tstCalibration, aUserISCOpenLoopPosSpread),\ + offsetof(USERCAL_tstCalibration, aUserISCOpenLoopPosTable),\ + offsetof(USERCAL_tstCalibration, u8VehicleStoppedFuelCutEnable),\ offsetof(USERCAL_tstCalibration, u16CRC16)} const uint32 __attribute__((used)) au32Offsets[]=OFFSETS_DATA; -//ASAM mode=readvalue name="au32Offsets" type=uint32 offset=12209 min=0 max=65535 m=1 b=0 units="dl" format=8.0 help="Internal" +//ASAM mode=readvalue name="au32Offsets" type=uint32 offset=12422 min=0 max=65535 m=1 b=0 units="dl" format=8.0 help="Internal" #endif /* GLOBAL FUNCTION DECLARATIONS ***********************************************/ diff --git a/source/Client/golf_mk6.h b/source/Client/golf_mk6.h index d53824b..240d44b 100644 --- a/source/Client/golf_mk6.h +++ b/source/Client/golf_mk6.h @@ -1868,7 +1868,7 @@ EH_IO_GPSE5,\ /* aUserFuelFlowRateSpread */\ {0,1500,3000,4500,6000,7500,9000,10500,12000,13500,15000,16500,18000,19500,21000,22500,24000},\ /* aUserFuelFlowRateTable */\ -{0,3547,5015,6143,7094,7931,8688,9384,10124,10641,11216,11764,12289,12793,13274,13741,14191},\ +{0,3000,3800,5400,6800,7931,8688,9384,10124,10641,11216,11764,12289,12793,13274,13741,14191},\ /* u8VariableFuelPressureEnable */\ 1,\ /* s32FuelPressureSensorGain */\ @@ -1882,23 +1882,23 @@ EH_IO_GPSE5,\ /* u8FuelPrimeEnable */\ 0,\ /* aUserTimingMapStage1 */\ -{ {130,130,130,130,120,60,0,0,0,0,0,0,0,0,0,0,0},\ - { 130,130,130,130,120,120,120,120,120,120,120,120,120,120,120,120,120},\ - { 130,130,130,130,120,120,120,120,120,120,120,120,120,120,120,120,120},\ - { 130,130,140,160,180,200,200,200,200,180,160,140,120,120,120,120,120},\ - { 130,150,180,210,240,270,270,250,230,210,190,170,150,130,110,90,70},\ - { 130,150,180,210,240,270,270,250,230,210,190,170,150,130,110,90,70},\ - { 130,150,180,210,240,270,270,250,230,210,190,170,150,130,110,90,70},\ - { 130,150,180,210,240,270,270,250,230,210,190,170,150,130,110,90,70},\ - { 130,150,180,210,240,270,270,250,230,210,190,170,150,130,110,90,70},\ - { 130,150,180,210,240,270,270,250,230,210,190,170,150,130,110,90,70},\ - { 130,150,180,210,240,270,270,250,230,210,190,170,150,130,110,90,70},\ - { 130,150,180,210,240,270,270,250,230,210,190,170,150,130,110,90,70},\ - { 130,150,180,210,240,270,270,250,230,210,190,170,150,130,110,90,70},\ - { 130,150,180,210,240,270,270,250,230,210,190,170,150,130,110,90,70},\ - { 130,150,180,210,240,270,270,250,230,210,190,170,150,130,110,90,70},\ - { 130,150,180,210,240,270,270,250,230,210,190,170,150,130,110,90,70},\ - { 90,90,90,90,90,90,90,90,90,90,90,80,80,80,80,80,80}},\ + { {120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120},\ + { 120,120,120,120,120,110,100,90,90,90,90,90,90,90,90,90,90},\ + { 120,120,120,110,100,90,80,70,70,70,70,70,70,70,70,70,70},\ + { 120,110,100,90,80,70,60,50,40,30,30,30,30,30,30,30,30},\ + { 120,110,100,90,80,70,60,50,40,30,30,20,20,10,10,10,10},\ + { 120,110,100,90,80,70,60,50,40,30,30,20,20,10,10,10,10},\ + { 120,110,100,90,80,70,60,50,40,30,30,20,20,10,10,10,10},\ + { 120,110,100,90,80,70,60,50,40,30,30,20,20,10,10,10,10},\ + { 120,110,100,90,80,70,60,50,40,30,30,20,20,10,10,10,10},\ + { 120,110,100,90,80,70,60,50,40,30,30,20,20,10,10,10,10},\ + { 120,110,100,90,80,70,60,50,40,30,30,20,20,10,10,10,10},\ + { 120,110,100,90,80,70,60,50,40,30,30,20,20,10,10,10,10},\ + { 120,110,100,90,80,70,60,50,40,30,30,20,20,10,10,10,10},\ + { 120,110,100,90,80,70,60,50,40,30,30,20,20,10,10,10,10},\ + { 120,110,100,90,80,70,60,50,40,30,30,20,20,10,10,10,10},\ + { 120,110,100,90,80,70,60,50,40,30,30,20,20,10,10,10,10},\ + { 120,110,100,90,80,70,60,50,40,30,30,20,20,10,10,10,10}},\ /* aUserTorquePedalTransferSpread */\ {0,1400,2800,4200,5600,7000,8400,9800,11200,12600,14000,15400,16800,18800,20800,22800,24800},\ /* aUserTorquePedalTransferTable */\ @@ -1990,9 +1990,9 @@ EH_IO_GPSE3,\ /* u16ISCColdISCMax */\ 4000,\ /* u16ISCHotISCMin */\ -100,\ +10,\ /* u16ISCHotISCMax */\ -2000,\ +3000,\ /* u16GDIValveMin */\ 2200,\ /* u16GDIValveMax */\ @@ -2095,12 +2095,12 @@ EH_IO_GPSE3,\ 46u},\ /* u16TorqueReductionMaxFuelCut */\ 10u,\ -/* u16ShiftCountLimit */\ -100u,\ +/* u16ShiftUpCountLimit */\ +30u,\ /* au16BoostTarget */\ {16000u,18000u,19000u,19000u,19000u,19000u},\ /* u16GDIPressureMin */\ -7000u,\ +4000u,\ /* u16GDIPressureMax */\ 18500u,\ /* u16GDIMAPMin */\ @@ -2202,7 +2202,89 @@ EH_IO_GPSE3,\ /* u16ETCOverride */\ 0,\ /* u16DiagType */\ -1,\ +0,\ +/* aUserETCRPMMatchSpread */\ +{1000u,\ +1250u,\ +1500u,\ +1750u,\ +2000u,\ +2250u,\ +2500u,\ +2750u,\ +3000u,\ +3250u,\ +3500u,\ +3750u,\ +4000u,\ +4500u,\ +5000u,\ +5500u,\ +6000u},\ +/* aUserETCRPMMatchTable */\ +{5u,\ +7u,\ +8u,\ +9u,\ +10u,\ +10u,\ +11u,\ +11u,\ +12u,\ +13u,\ +14u,\ +15u,\ +15u,\ +15u,\ +15u,\ +15u,\ +15u},\ +/* u16ShiftDownCountLimit */\ +100u,\ +/* u16ShiftDownBlipLimit */\ +15u,\ +/* u16ATXTorqueOnVSS */\ +350u,\ +/* u16ATXTorqueOffVSS */\ +300u,\ +/* aUserISCOpenLoopPosSpread */\ +{-40000,\ + -30000,\ + -20000,\ + -10000,\ + 0,\ + 10000,\ + 20000,\ + 30000,\ + 40000,\ + 50000,\ + 60000,\ + 70000,\ + 80000,\ + 90000,\ + 100000,\ + 110000,\ + 120000},\ +/* aUserISCOpenLoopPosTable */\ +{ 200u,\ + 180u,\ + 170u,\ + 160u,\ + 150u,\ + 140u,\ + 130u,\ + 120u,\ + 110u,\ + 100u,\ + 90u,\ + 90u,\ + 90u,\ + 90u,\ + 90u,\ + 90u,\ + 90u},\ +/* u8VehicleStoppedFuelCutEnable */\ + 0,\ /* u16CRC16 */\ 0x1234,\ (uint8*)&au32Offsets\ diff --git a/source/Peripherals/SDHC1HA.c b/source/Peripherals/SDHC1HA.c index ca32107..ebd7e77 100644 --- a/source/Peripherals/SDHC1HA.c +++ b/source/Peripherals/SDHC1HA.c @@ -92,6 +92,7 @@ #include #include #include +#include "sdhc.h" #include "mk64f12.h" #include "sim.h" #include "irq.h" diff --git a/source/UserServices/CEM.h b/source/UserServices/CEM.h index c858c3b..6c979e5 100644 --- a/source/UserServices/CEM.h +++ b/source/UserServices/CEM.h @@ -62,7 +62,7 @@ EXTERN uint32 CEM_u32CrankErrorCounts; EXTERN uint32 CEM_u32CamErrorCounts; //ASAM mode=readvalue name="Cam Error Counts" type=uint32 offset=0 min=0 max=65535 m=1 b=0 units="counts" format=5.3 help="Cam Error Counts" EXTERN uint32 CEM_u32CrankRunningErrorCounts; -//ASAM mode=readvalue name="Crank Running Error Counts" type=uint32 offset=0 min=0 max=65535 m=1 b=0 units="counts" format=5.3 help="Crank Running Error Counts" +//ASAMREMOVED!! mode=readvalue name="Crank Running Error Counts" type=uint32 offset=0 min=0 max=65535 m=1 b=0 units="counts" format=5.3 help="Crank Running Error Counts" EXTERN uint32 CEM_u32CamRunningErrorCounts; //ASAM mode=readvalue name="Cam Running Error Counts" type=uint32 offset=0 min=0 max=65535 m=1 b=0 units="counts" format=5.3 help="Cam Running Error Counts" diff --git a/source/UserServices/TABLES.h b/source/UserServices/TABLES.h index 7332f92..204311e 100644 --- a/source/UserServices/TABLES.h +++ b/source/UserServices/TABLES.h @@ -15,7 +15,7 @@ #include "TABLESAPI.h" #include "SYSAPI.h" -#define TABLE_nKernelTableCount 30u +#define TABLE_nKernelTableCount 35u #define TABLE_nUserTableCount 25u void TABLES_vStart(puint32 const pu32Arg);