diff --git a/firmware/config/engines/citroenBerlingoTU3JP.cpp b/firmware/config/engines/citroenBerlingoTU3JP.cpp index debac234cc..b02fc7f8b1 100644 --- a/firmware/config/engines/citroenBerlingoTU3JP.cpp +++ b/firmware/config/engines/citroenBerlingoTU3JP.cpp @@ -15,6 +15,45 @@ #include "thermistors.h" #include "citroenBerlingoTU3JP.h" +static fuel_table_t tps_fuel_table = { +{/*0 engineLoad=0.00*/ /*0 800.0*/4.00, /*1 1213.0*/4.00, /*2 1626.0*/4.00, /*3 2040.0*/4.00, /*4 2453.0*/4.00, /*5 2866.0*/4.00, /*6 3280.0*/4.00, /*7 3693.0*/4.00, /*8 4106.0*/4.00, /*9 4520.0*/4.00, /*10 4933.0*/4.00, /*11 5346.0*/4.00, /*12 5760.0*/4.00, /*13 6173.0*/4.00, /*14 6586.0*/4.00, /*15 7000.0*/4.00}, +{/*1 engineLoad=6.66*/ /*0 800.0*/5.07, /*1 1213.0*/5.07, /*2 1626.0*/5.07, /*3 2040.0*/5.07, /*4 2453.0*/5.07, /*5 2866.0*/5.07, /*6 3280.0*/5.07, /*7 3693.0*/5.07, /*8 4106.0*/5.07, /*9 4520.0*/5.07, /*10 4933.0*/5.07, /*11 5346.0*/5.07, /*12 5760.0*/5.07, /*13 6173.0*/5.07, /*14 6586.0*/5.07, /*15 7000.0*/5.07}, +{/*2 engineLoad=13.33*/ /*0 800.0*/6.13, /*1 1213.0*/6.13, /*2 1626.0*/6.13, /*3 2040.0*/6.13, /*4 2453.0*/6.13, /*5 2866.0*/6.13, /*6 3280.0*/6.13, /*7 3693.0*/6.13, /*8 4106.0*/6.13, /*9 4520.0*/6.13, /*10 4933.0*/6.13, /*11 5346.0*/6.13, /*12 5760.0*/6.13, /*13 6173.0*/6.13, /*14 6586.0*/6.13, /*15 7000.0*/6.13}, +{/*3 engineLoad=20.00*/ /*0 800.0*/7.20, /*1 1213.0*/7.20, /*2 1626.0*/7.20, /*3 2040.0*/7.20, /*4 2453.0*/7.20, /*5 2866.0*/7.20, /*6 3280.0*/7.20, /*7 3693.0*/7.20, /*8 4106.0*/7.20, /*9 4520.0*/7.20, /*10 4933.0*/7.20, /*11 5346.0*/7.20, /*12 5760.0*/7.20, /*13 6173.0*/7.20, /*14 6586.0*/7.20, /*15 7000.0*/7.20}, +{/*4 engineLoad=26.66*/ /*0 800.0*/8.27, /*1 1213.0*/8.27, /*2 1626.0*/8.27, /*3 2040.0*/8.27, /*4 2453.0*/8.27, /*5 2866.0*/8.27, /*6 3280.0*/8.27, /*7 3693.0*/8.27, /*8 4106.0*/8.27, /*9 4520.0*/8.27, /*10 4933.0*/8.27, /*11 5346.0*/8.27, /*12 5760.0*/8.27, /*13 6173.0*/8.27, /*14 6586.0*/8.27, /*15 7000.0*/8.27}, +{/*5 engineLoad=33.33*/ /*0 800.0*/9.33, /*1 1213.0*/9.33, /*2 1626.0*/9.33, /*3 2040.0*/9.33, /*4 2453.0*/9.33, /*5 2866.0*/9.33, /*6 3280.0*/9.33, /*7 3693.0*/9.33, /*8 4106.0*/9.33, /*9 4520.0*/9.33, /*10 4933.0*/9.33, /*11 5346.0*/9.33, /*12 5760.0*/9.33, /*13 6173.0*/9.33, /*14 6586.0*/9.33, /*15 7000.0*/9.33}, +{/*6 engineLoad=40.00*/ /*0 800.0*/10.40, /*1 1213.0*/10.40, /*2 1626.0*/10.40, /*3 2040.0*/10.40, /*4 2453.0*/10.40, /*5 2866.0*/10.40, /*6 3280.0*/10.40, /*7 3693.0*/10.40, /*8 4106.0*/10.40, /*9 4520.0*/10.40, /*10 4933.0*/10.40, /*11 5346.0*/10.40, /*12 5760.0*/10.40, /*13 6173.0*/10.40, /*14 6586.0*/10.40, /*15 7000.0*/10.40}, +{/*7 engineLoad=46.66*/ /*0 800.0*/11.47, /*1 1213.0*/11.47, /*2 1626.0*/11.47, /*3 2040.0*/11.47, /*4 2453.0*/11.47, /*5 2866.0*/11.47, /*6 3280.0*/11.47, /*7 3693.0*/11.47, /*8 4106.0*/11.47, /*9 4520.0*/11.47, /*10 4933.0*/11.47, /*11 5346.0*/11.47, /*12 5760.0*/11.47, /*13 6173.0*/11.47, /*14 6586.0*/11.47, /*15 7000.0*/11.47}, +{/*8 engineLoad=53.33*/ /*0 800.0*/12.53, /*1 1213.0*/12.53, /*2 1626.0*/12.53, /*3 2040.0*/12.53, /*4 2453.0*/12.53, /*5 2866.0*/12.53, /*6 3280.0*/12.53, /*7 3693.0*/12.53, /*8 4106.0*/12.53, /*9 4520.0*/12.53, /*10 4933.0*/12.53, /*11 5346.0*/12.53, /*12 5760.0*/12.53, /*13 6173.0*/12.53, /*14 6586.0*/12.53, /*15 7000.0*/12.53}, +{/*9 engineLoad=60.00*/ /*0 800.0*/12.60, /*1 1213.0*/13.60, /*2 1626.0*/13.60, /*3 2040.0*/13.60, /*4 2453.0*/13.60, /*5 2866.0*/13.60, /*6 3280.0*/13.60, /*7 3693.0*/13.60, /*8 4106.0*/13.60, /*9 4520.0*/13.60, /*10 4933.0*/13.60, /*11 5346.0*/13.60, /*12 5760.0*/13.60, /*13 6173.0*/13.60, /*14 6586.0*/13.60, /*15 7000.0*/13.60}, +{/*10 engineLoad=66.66*/ /*0 800.0*/14.67, /*1 1213.0*/14.67, /*2 1626.0*/14.67, /*3 2040.0*/14.67, /*4 2453.0*/14.67, /*5 2866.0*/14.67, /*6 3280.0*/14.67, /*7 3693.0*/14.67, /*8 4106.0*/14.67, /*9 4520.0*/14.67, /*10 4933.0*/14.67, /*11 5346.0*/14.67, /*12 5760.0*/14.67, /*13 6173.0*/14.67, /*14 6586.0*/14.67, /*15 7000.0*/14.67}, +{/*11 engineLoad=73.33*/ /*0 800.0*/15.73, /*1 1213.0*/15.73, /*2 1626.0*/15.73, /*3 2040.0*/15.73, /*4 2453.0*/15.73, /*5 2866.0*/15.73, /*6 3280.0*/15.73, /*7 3693.0*/15.73, /*8 4106.0*/15.73, /*9 4520.0*/15.73, /*10 4933.0*/15.73, /*11 5346.0*/15.73, /*12 5760.0*/15.73, /*13 6173.0*/15.73, /*14 6586.0*/15.73, /*15 7000.0*/15.73}, +{/*12 engineLoad=80.00*/ /*0 800.0*/16.80, /*1 1213.0*/16.80, /*2 1626.0*/16.80, /*3 2040.0*/16.80, /*4 2453.0*/16.80, /*5 2866.0*/16.80, /*6 3280.0*/16.80, /*7 3693.0*/16.80, /*8 4106.0*/16.80, /*9 4520.0*/16.80, /*10 4933.0*/16.80, /*11 5346.0*/16.80, /*12 5760.0*/16.80, /*13 6173.0*/16.80, /*14 6586.0*/16.80, /*15 7000.0*/16.80}, +{/*13 engineLoad=86.66*/ /*0 800.0*/17.87, /*1 1213.0*/17.87, /*2 1626.0*/17.87, /*3 2040.0*/17.87, /*4 2453.0*/17.87, /*5 2866.0*/17.87, /*6 3280.0*/17.87, /*7 3693.0*/17.87, /*8 4106.0*/17.87, /*9 4520.0*/17.87, /*10 4933.0*/17.87, /*11 5346.0*/17.87, /*12 5760.0*/17.87, /*13 6173.0*/17.87, /*14 6586.0*/17.87, /*15 7000.0*/17.87}, +{/*14 engineLoad=93.33*/ /*0 800.0*/18.93, /*1 1213.0*/18.93, /*2 1626.0*/18.93, /*3 2040.0*/18.93, /*4 2453.0*/18.93, /*5 2866.0*/18.93, /*6 3280.0*/18.93, /*7 3693.0*/18.93, /*8 4106.0*/18.93, /*9 4520.0*/18.93, /*10 4933.0*/18.93, /*11 5346.0*/18.93, /*12 5760.0*/18.93, /*13 6173.0*/18.93, /*14 6586.0*/18.93, /*15 7000.0*/18.93}, +{/*15 engineLoad=100.00*/ /*0 800.0*/20.00, /*1 1213.0*/20.00, /*2 1626.0*/20.00, /*3 2040.0*/20.00, /*4 2453.0*/20.00, /*5 2866.0*/20.00, /*6 3280.0*/20.00, /*7 3693.0*/20.00, /*8 4106.0*/20.00, /*9 4520.0*/20.00, /*10 4933.0*/20.00, /*11 5346.0*/20.00, /*12 5760.0*/20.00, /*13 6173.0*/20.00, /*14 6586.0*/20.00, /*15 7000.0*/20.00} +}; + +static ignition_table_t tps_advance_table = { +{/*0 engineLoad=0.00*/ /*0 800.0*/+15.00, /*1 1213.0*/+16.33, /*2 1626.0*/+17.67, /*3 2040.0*/+19.00, /*4 2453.0*/+20.33, /*5 2866.0*/+21.67, /*6 3280.0*/+23.00, /*7 3693.0*/+24.33, /*8 4106.0*/+25.67, /*9 4520.0*/+27.00, /*10 4933.0*/+28.33, /*11 5346.0*/+29.67, /*12 5760.0*/+31.00, /*13 6173.0*/+32.33, /*14 6586.0*/+33.67, /*15 7000.0*/+35.00}, +{/*1 engineLoad=6.66*/ /*0 800.0*/+14.80, /*1 1213.0*/+16.12, /*2 1626.0*/+17.45, /*3 2040.0*/+18.77, /*4 2453.0*/+20.10, /*5 2866.0*/+21.42, /*6 3280.0*/+22.75, /*7 3693.0*/+24.07, /*8 4106.0*/+25.40, /*9 4520.0*/+26.72, /*10 4933.0*/+28.04, /*11 5346.0*/+29.37, /*12 5760.0*/+30.69, /*13 6173.0*/+32.02, /*14 6586.0*/+33.34, /*15 7000.0*/+34.67}, +{/*2 engineLoad=13.33*/ /*0 800.0*/+14.60, /*1 1213.0*/+15.92, /*2 1626.0*/+17.23, /*3 2040.0*/+18.55, /*4 2453.0*/+19.86, /*5 2866.0*/+21.18, /*6 3280.0*/+22.49, /*7 3693.0*/+23.81, /*8 4106.0*/+25.12, /*9 4520.0*/+26.44, /*10 4933.0*/+27.76, /*11 5346.0*/+29.07, /*12 5760.0*/+30.39, /*13 6173.0*/+31.70, /*14 6586.0*/+33.02, /*15 7000.0*/+34.33}, +{/*3 engineLoad=20.00*/ /*0 800.0*/+14.40, /*1 1213.0*/+15.71, /*2 1626.0*/+17.01, /*3 2040.0*/+18.32, /*4 2453.0*/+19.63, /*5 2866.0*/+20.93, /*6 3280.0*/+22.24, /*7 3693.0*/+23.55, /*8 4106.0*/+24.85, /*9 4520.0*/+26.16, /*10 4933.0*/+27.47, /*11 5346.0*/+28.77, /*12 5760.0*/+30.08, /*13 6173.0*/+31.39, /*14 6586.0*/+32.69, /*15 7000.0*/+34.00}, +{/*4 engineLoad=26.66*/ /*0 800.0*/+14.20, /*1 1213.0*/+15.50, /*2 1626.0*/+16.80, /*3 2040.0*/+18.09, /*4 2453.0*/+19.39, /*5 2866.0*/+20.69, /*6 3280.0*/+21.99, /*7 3693.0*/+23.28, /*8 4106.0*/+24.58, /*9 4520.0*/+25.88, /*10 4933.0*/+27.18, /*11 5346.0*/+28.48, /*12 5760.0*/+29.77, /*13 6173.0*/+31.07, /*14 6586.0*/+32.37, /*15 7000.0*/+33.67}, +{/*5 engineLoad=33.33*/ /*0 800.0*/+14.00, /*1 1213.0*/+15.29, /*2 1626.0*/+16.58, /*3 2040.0*/+17.87, /*4 2453.0*/+19.16, /*5 2866.0*/+20.44, /*6 3280.0*/+21.73, /*7 3693.0*/+23.02, /*8 4106.0*/+24.31, /*9 4520.0*/+25.60, /*10 4933.0*/+26.89, /*11 5346.0*/+28.18, /*12 5760.0*/+29.47, /*13 6173.0*/+30.76, /*14 6586.0*/+32.04, /*15 7000.0*/+33.33}, +{/*6 engineLoad=40.00*/ /*0 800.0*/+13.80, /*1 1213.0*/+15.08, /*2 1626.0*/+16.36, /*3 2040.0*/+17.64, /*4 2453.0*/+18.92, /*5 2866.0*/+20.20, /*6 3280.0*/+21.48, /*7 3693.0*/+22.76, /*8 4106.0*/+24.04, /*9 4520.0*/+25.32, /*10 4933.0*/+26.60, /*11 5346.0*/+27.88, /*12 5760.0*/+29.16, /*13 6173.0*/+30.44, /*14 6586.0*/+31.72, /*15 7000.0*/+33.00}, +{/*7 engineLoad=46.66*/ /*0 800.0*/+13.60, /*1 1213.0*/+14.87, /*2 1626.0*/+16.14, /*3 2040.0*/+17.41, /*4 2453.0*/+18.68, /*5 2866.0*/+19.96, /*6 3280.0*/+21.23, /*7 3693.0*/+22.50, /*8 4106.0*/+23.77, /*9 4520.0*/+25.04, /*10 4933.0*/+26.31, /*11 5346.0*/+27.58, /*12 5760.0*/+28.85, /*13 6173.0*/+30.12, /*14 6586.0*/+31.40, /*15 7000.0*/+32.67}, +{/*8 engineLoad=53.33*/ /*0 800.0*/+13.40, /*1 1213.0*/+14.66, /*2 1626.0*/+15.92, /*3 2040.0*/+17.19, /*4 2453.0*/+18.45, /*5 2866.0*/+19.71, /*6 3280.0*/+20.97, /*7 3693.0*/+22.24, /*8 4106.0*/+23.50, /*9 4520.0*/+24.76, /*10 4933.0*/+26.02, /*11 5346.0*/+27.28, /*12 5760.0*/+28.55, /*13 6173.0*/+29.81, /*14 6586.0*/+31.07, /*15 7000.0*/+32.33}, +{/*9 engineLoad=60.00*/ /*0 800.0*/+13.20, /*1 1213.0*/+14.45, /*2 1626.0*/+15.71, /*3 2040.0*/+16.96, /*4 2453.0*/+18.21, /*5 2866.0*/+19.47, /*6 3280.0*/+20.72, /*7 3693.0*/+21.97, /*8 4106.0*/+23.23, /*9 4520.0*/+24.48, /*10 4933.0*/+25.73, /*11 5346.0*/+26.99, /*12 5760.0*/+28.24, /*13 6173.0*/+29.49, /*14 6586.0*/+30.75, /*15 7000.0*/+32.00}, +{/*10 engineLoad=66.66*/ /*0 800.0*/+13.00, /*1 1213.0*/+14.24, /*2 1626.0*/+15.49, /*3 2040.0*/+16.73, /*4 2453.0*/+17.98, /*5 2866.0*/+19.22, /*6 3280.0*/+20.47, /*7 3693.0*/+21.71, /*8 4106.0*/+22.96, /*9 4520.0*/+24.20, /*10 4933.0*/+25.44, /*11 5346.0*/+26.69, /*12 5760.0*/+27.93, /*13 6173.0*/+29.18, /*14 6586.0*/+30.42, /*15 7000.0*/+31.67}, +{/*11 engineLoad=73.33*/ /*0 800.0*/+12.80, /*1 1213.0*/+14.04, /*2 1626.0*/+15.27, /*3 2040.0*/+16.51, /*4 2453.0*/+17.74, /*5 2866.0*/+18.98, /*6 3280.0*/+20.21, /*7 3693.0*/+21.45, /*8 4106.0*/+22.68, /*9 4520.0*/+23.92, /*10 4933.0*/+25.16, /*11 5346.0*/+26.39, /*12 5760.0*/+27.63, /*13 6173.0*/+28.86, /*14 6586.0*/+30.10, /*15 7000.0*/+31.33}, +{/*12 engineLoad=80.00*/ /*0 800.0*/+12.60, /*1 1213.0*/+13.83, /*2 1626.0*/+15.05, /*3 2040.0*/+16.28, /*4 2453.0*/+17.51, /*5 2866.0*/+18.73, /*6 3280.0*/+19.96, /*7 3693.0*/+21.19, /*8 4106.0*/+22.41, /*9 4520.0*/+23.64, /*10 4933.0*/+24.87, /*11 5346.0*/+26.09, /*12 5760.0*/+27.32, /*13 6173.0*/+28.55, /*14 6586.0*/+29.77, /*15 7000.0*/+31.00}, +{/*13 engineLoad=86.66*/ /*0 800.0*/+12.40, /*1 1213.0*/+13.62, /*2 1626.0*/+14.84, /*3 2040.0*/+16.05, /*4 2453.0*/+17.27, /*5 2866.0*/+18.49, /*6 3280.0*/+19.71, /*7 3693.0*/+20.92, /*8 4106.0*/+22.14, /*9 4520.0*/+23.36, /*10 4933.0*/+24.58, /*11 5346.0*/+25.80, /*12 5760.0*/+27.01, /*13 6173.0*/+28.23, /*14 6586.0*/+29.45, /*15 7000.0*/+30.67}, +{/*14 engineLoad=93.33*/ /*0 800.0*/+12.20, /*1 1213.0*/+13.41, /*2 1626.0*/+14.62, /*3 2040.0*/+15.83, /*4 2453.0*/+17.04, /*5 2866.0*/+18.24, /*6 3280.0*/+19.45, /*7 3693.0*/+20.66, /*8 4106.0*/+21.87, /*9 4520.0*/+23.08, /*10 4933.0*/+24.29, /*11 5346.0*/+25.50, /*12 5760.0*/+26.71, /*13 6173.0*/+27.92, /*14 6586.0*/+29.12, /*15 7000.0*/+30.33}, +{/*15 engineLoad=100.00*/ /*0 800.0*/+12.00, /*1 1213.0*/+13.20, /*2 1626.0*/+14.40, /*3 2040.0*/+15.60, /*4 2453.0*/+16.80, /*5 2866.0*/+18.00, /*6 3280.0*/+19.20, /*7 3693.0*/+20.40, /*8 4106.0*/+21.60, /*9 4520.0*/+22.80, /*10 4933.0*/+24.00, /*11 5346.0*/+25.20, /*12 5760.0*/+26.40, /*13 6173.0*/+27.60, /*14 6586.0*/+28.80, /*15 7000.0*/+30.00} +}; + + void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) { engineConfiguration->engineType = CITROEN_TU3JP; @@ -37,7 +76,7 @@ void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfigur * Cranking fuel setting * TODO: they recomend using something like -40C for low point and +80C for high point */ - engineConfiguration->crankingSettings.baseCrankingFuel = 4; + engineConfiguration->crankingSettings.baseCrankingFuel = 15; /** * Algorithm Alpha-N setting @@ -72,8 +111,8 @@ void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfigur boardConfiguration->injectionPins[3] = GPIO_UNASSIGNED; boardConfiguration->ignitionPins[0] = GPIOC_14; - boardConfiguration->ignitionPins[1] = GPIOC_15; - boardConfiguration->ignitionPins[2] = GPIO_UNASSIGNED; + boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; + boardConfiguration->ignitionPins[2] = GPIOC_15; boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; boardConfiguration->fuelPumpPin = GPIOB_9; @@ -95,7 +134,7 @@ void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfigur // Frankenstein analog input #3: PC3 adc13 IAT // Frankenstein analog input #4: PC1 adc11 CLT // Frankenstein analog input #5: PA0 adc0 vBatt - // Frankenstein analog input #6: PC2 adc12 + // Frankenstein analog input #6: PC2 adc12 WBO // Frankenstein analog input #7: PA4 adc4 // Frankenstein analog input #8: PA2 adc2 // Frankenstein analog input #9: PA6 adc6 @@ -133,9 +172,16 @@ void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfigur */ engineConfiguration->vbattAdcChannel = EFI_ADC_0; engineConfiguration->vbattDividerCoeff = ((float) (2.7 + 10)) / 2.7 * 2; - + /** + * WBO Innovate LC-1 + */ + engineConfiguration->afrSensor.afrAdcChannel = EFI_ADC_12; /** * Other */ // engineConfiguration->mafAdcChannel = GPIO_UNASSIGNED; + + copyFuelTable(tps_fuel_table, engineConfiguration->fuelTable); + copyTimingTable(tps_advance_table, engineConfiguration->ignitionTable); + } diff --git a/firmware/config/engines/ford_aspire.cpp b/firmware/config/engines/ford_aspire.cpp index d8b72680ef..fd58f88afb 100644 --- a/firmware/config/engines/ford_aspire.cpp +++ b/firmware/config/engines/ford_aspire.cpp @@ -24,7 +24,7 @@ * The convenient way to override these default would be to tune this map using TunerStudio software * with which rusEfi is integrated */ -static float default_aspire_fuel_table[FUEL_LOAD_COUNT][FUEL_RPM_COUNT] = { +static fuel_table_t default_aspire_fuel_table = { /* RPM 800.000000 1213.333374 1626.666748 2040.000000 2453.333496 2866.666748 3280.000000 3693.333496 4106.666992 4520.000000 4933.333496 5346.666992 5760.000000 6173.333496 6586.666992 7000.000000*/ /* Load 1.200000 */{ 1.542000, 1.547600, 1.551867, 1.570000, 1.550000, 0.908666, 0.794800, 0.775200, 0.791733, 0.800000, 0.798667, 0.805733, 0.810000, 0.810000, 0.810000, 0.810000}, /* Load 1.413333 */{ 1.532133, 1.565325, 1.551244, 1.552773, 1.546018, 0.802089, 0.810000, 0.788507, 0.808898, 0.744987, 0.701378, 0.711404, 0.744667, 0.810000, 0.810000, 0.810000}, @@ -44,7 +44,7 @@ static float default_aspire_fuel_table[FUEL_LOAD_COUNT][FUEL_RPM_COUNT] = { /* Load 4.400000 */{ 17.010000, 15.250000, 15.680000, 15.440000, 15.270000, 15.470000, 15.800000, 15.730000, 15.600000, 15.790000, 16.120001, 16.110001, 15.630000, 15.150000, 15.150000, 15.150000} }; -static float default_aspire_timing_table[AD_LOAD_COUNT][AD_RPM_COUNT] = { +static ignition_table_t default_aspire_timing_table = { /* RPM 800.000000 1213.333374 1626.666748 2040.000000 2453.333496 2866.666748 3280.000000 3693.333496 4106.666992 4520.000000 4933.333496 5346.666992 5760.000000 6173.333496 6586.666992 7000.000000*/ /* Load 1.200000 */{ -0.662000, +7.730000, +16.722000, +23.139999, +29.398001, +31.268000, +32.108002, +30.436001, +30.896000, +26.656000, +24.704000, +25.108000, +25.132000, +25.459999, +25.459999, +25.459999}, /* Load 1.413333 */{ -0.546000, +7.662000, +16.882000, +23.482000, +29.520000, +31.323999, +32.108002, +30.656000, +30.468000, +26.879999, +24.746000, +24.742001, +29.032000, +25.562000, +25.562000, +25.562000}, @@ -71,19 +71,8 @@ static void setDefaultAspireMaps(engine_configuration_s *engineConfiguration) { setTimingLoadBin(engineConfiguration, 1.2, 4.4); setTimingRpmBin(engineConfiguration, 800, 7000); - // todo: extract an array16x16 type? extract a method? - for (int k = 0; k < FUEL_LOAD_COUNT; k++) { - for (int r = 0; r < FUEL_RPM_COUNT; r++) { - engineConfiguration->fuelTable[k][r] = default_aspire_fuel_table[k][r]; - } - } - - // todo: extract an array16x16 type? extract a method? - for (int k = 0; k < AD_LOAD_COUNT; k++) { - for (int r = 0; r < AD_RPM_COUNT; r++) { - engineConfiguration->ignitionTable[k][r] = default_aspire_timing_table[k][r]; - } - } + copyFuelTable(default_aspire_fuel_table, engineConfiguration->fuelTable); + copyTimingTable(default_aspire_timing_table, engineConfiguration->ignitionTable); } void setFordAspireEngineConfiguration(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) { diff --git a/firmware/config/engines/mazda_miata.cpp b/firmware/config/engines/mazda_miata.cpp index 239c2d145a..dcf94f5479 100644 --- a/firmware/config/engines/mazda_miata.cpp +++ b/firmware/config/engines/mazda_miata.cpp @@ -19,7 +19,7 @@ // setFrankenso_01_LCD #include "honda_accord.h" -static float miata_maf_fuel_table[16][16] = { +static const fuel_table_t miata_maf_fuel_table = { {/*0 engineLoad=1.2*//*0 800.0*/1.53, /*1 1213.0*/0.92, /*2 1626.0*/0.74, /*3 2040.0*/0.69, /*4 2453.0*/0.69, /*5 2866.0*/0.67, /*6 3280.0*/0.67, /*7 3693.0*/0.67, /*8 4106.0*/0.67, /*9 4520.0*/1.02, /*10 4933.0*/0.98, /*11 5346.0*/0.98, /*12 5760.0*/0.92, /*13 6173.0*/0.89, /*14 6586.0*/0.82, /*15 7000.0*/0.87}, {/*1 engineLoad=1.413333*//*0 800.0*/2.98, /*1 1213.0*/2.07, /*2 1626.0*/1.74, /*3 2040.0*/1.55, /*4 2453.0*/1.43, /*5 2866.0*/1.18, /*6 3280.0*/0.0, /*7 3693.0*/0.0, /*8 4106.0*/0.0, /*9 4520.0*/0.0, /*10 4933.0*/0.0, /*11 5346.0*/0.0, /*12 5760.0*/0.0, /*13 6173.0*/0.0, /*14 6586.0*/0.0, /*15 7000.0*/0.0}, {/*2 engineLoad=1.626666*//*0 800.0*/4.9, /*1 1213.0*/3.45, /*2 1626.0*/2.76, /*3 2040.0*/2.35, /*4 2453.0*/2.08, /*5 2866.0*/1.84, /*6 3280.0*/0.0, /*7 3693.0*/0.0, /*8 4106.0*/0.0, /*9 4520.0*/0.0, /*10 4933.0*/0.0, /*11 5346.0*/0.0, /*12 5760.0*/0.0, /*13 6173.0*/0.0, /*14 6586.0*/0.0, /*15 7000.0*/0.0}, @@ -38,7 +38,7 @@ static float miata_maf_fuel_table[16][16] = { {/*15 engineLoad=4.399995*//*0 800.0*/12.08, /*1 1213.0*/12.17, /*2 1626.0*/12.34, /*3 2040.0*/12.43, /*4 2453.0*/12.74, /*5 2866.0*/12.91, /*6 3280.0*/12.71, /*7 3693.0*/12.54, /*8 4106.0*/12.97, /*9 4520.0*/13.53, /*10 4933.0*/14.87, /*11 5346.0*/15.48, /*12 5760.0*/16.1, /*13 6173.0*/16.18, /*14 6586.0*/15.93, /*15 7000.0*/0.0} }; -static float miata_maf_advance_table[16][16] = { +static ignition_table_t miata_maf_advance_table = { {/*0 engineLoad=1.200*/ /*0 800.0*/+4.498, /*1 1213.0*/+11.905, /*2 1626.0*/+23.418, /*3 2040.0*/+25.357, /*4 2453.0*/+25.441, /*5 2866.0*/+25.468, /*6 3280.0*/+29.425, /*7 3693.0*/+32.713, /*8 4106.0*/+35.556, /*9 4520.0*/+37.594, /*10 4933.0*/+36.165, /*11 5346.0*/+30.578, /*12 5760.0*/+29.145, /*13 6173.0*/+29.065, /*14 6586.0*/+27.071, /*15 7000.0*/+28.282}, {/*1 engineLoad=1.413*/ /*0 800.0*/+4.87, /*1 1213.0*/+12.138, /*2 1626.0*/+23.389, /*3 2040.0*/+25.501, /*4 2453.0*/+25.441, /*5 2866.0*/+25.468, /*6 3280.0*/+29.125, /*7 3693.0*/+33.074, /*8 4106.0*/+34.203, /*9 4520.0*/+37.769, /*10 4933.0*/+35.899, /*11 5346.0*/+30.519, /*12 5760.0*/+28.88, /*13 6173.0*/+28.74, /*14 6586.0*/+27.189, /*15 7000.0*/+27.826}, {/*2 engineLoad=1.626*/ /*0 800.0*/+4.817, /*1 1213.0*/+12.262, /*2 1626.0*/+23.925, /*3 2040.0*/+25.501, /*4 2453.0*/+25.5, /*5 2866.0*/+25.468, /*6 3280.0*/+29.364, /*7 3693.0*/+33.489, /*8 4106.0*/+34.839, /*9 4520.0*/+37.545, /*10 4933.0*/+35.875, /*11 5346.0*/+30.353, /*12 5760.0*/+29.052, /*13 6173.0*/+28.37, /*14 6586.0*/+27.072, /*15 7000.0*/+26.828}, @@ -214,19 +214,9 @@ static void setMiata1994_common(engine_configuration_s *engineConfiguration, boa engineConfiguration->crankingChargeAngle = 70; - // todo: extract an array16x16 type? extract a method? - for (int k = 0; k < FUEL_LOAD_COUNT; k++) { - for (int r = 0; r < FUEL_RPM_COUNT; r++) { - engineConfiguration->fuelTable[k][r] = miata_maf_fuel_table[k][r]; - } - } + copyFuelTable(miata_maf_fuel_table, engineConfiguration->fuelTable); - // todo: extract an array16x16 type? extract a method? - for (int k = 0; k < AD_LOAD_COUNT; k++) { - for (int r = 0; r < AD_RPM_COUNT; r++) { - engineConfiguration->ignitionTable[k][r] = miata_maf_advance_table[k][r]; - } - } + copyTimingTable(miata_maf_advance_table, engineConfiguration->ignitionTable); // boardConfiguration->triggerSimulatorPins[0] = GPIOD_2; // 2G - YEL/BLU @@ -330,18 +320,8 @@ void setMiata1996(engine_configuration_s *engineConfiguration, board_configurati commonMiataNa(engineConfiguration, boardConfiguration); engineConfiguration->displacement = 1.839; - for (int k = 0; k < FUEL_LOAD_COUNT; k++) { - for (int r = 0; r < FUEL_RPM_COUNT; r++) { - engineConfiguration->fuelTable[k][r] = miata_maf_fuel_table[k][r]; - } - } - - // todo: extract an array16x16 type? extract a method? - for (int k = 0; k < AD_LOAD_COUNT; k++) { - for (int r = 0; r < AD_RPM_COUNT; r++) { - engineConfiguration->ignitionTable[k][r] = miata_maf_advance_table[k][r]; - } - } + copyFuelTable(miata_maf_fuel_table, engineConfiguration->fuelTable); + copyTimingTable(miata_maf_advance_table, engineConfiguration->ignitionTable); // upside down boardConfiguration->triggerInputPins[0] = GPIOA_5; diff --git a/firmware/controllers/algo/advance_map.h b/firmware/controllers/algo/advance_map.h index b9d34dd5ef..546ad034b8 100644 --- a/firmware/controllers/algo/advance_map.h +++ b/firmware/controllers/algo/advance_map.h @@ -8,9 +8,6 @@ #ifndef ADVANCE_H_ #define ADVANCE_H_ -#define AD_LOAD_COUNT 16 -#define AD_RPM_COUNT 16 - #include "engine.h" float getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_S); diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index f0e7887588..a47bbc471f 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -636,3 +636,19 @@ void commonFrankensoAnalogInputs(engine_configuration_s *engineConfiguration) { engineConfiguration->vbattAdcChannel = EFI_ADC_14; } +void copyFuelTable(fuel_table_t const source, fuel_table_t destination) { + for (int k = 0; k < FUEL_LOAD_COUNT; k++) { + for (int r = 0; r < FUEL_RPM_COUNT; r++) { + destination[k][r] = source[k][r]; + } + } +} + +void copyTimingTable(ignition_table_t const source, ignition_table_t destination) { + for (int k = 0; k < IGN_LOAD_COUNT; k++) { + for (int r = 0; r < IGN_RPM_COUNT; r++) { + destination[k][r] = source[k][r]; + } + } +} + diff --git a/firmware/controllers/algo/engine_configuration.h b/firmware/controllers/algo/engine_configuration.h index fe83daed64..ada9a1e466 100644 --- a/firmware/controllers/algo/engine_configuration.h +++ b/firmware/controllers/algo/engine_configuration.h @@ -37,10 +37,6 @@ typedef struct { #define FUEL_RPM_COUNT 16 #define FUEL_LOAD_COUNT 16 -#define VE_RPM_COUNT 16 -#define VE_LOAD_COUNT 16 -#define AFR_RPM_COUNT 16 -#define AFR_LOAD_COUNT 16 #define LE_COMMAND_LENGTH 200 #define LE_COMMAND_COUNT 16 @@ -54,6 +50,9 @@ typedef char le_formula_t[LE_COMMAND_LENGTH]; #define IGN_LOAD_COUNT 16 #define IGN_RPM_COUNT 16 +typedef float fuel_table_t[FUEL_LOAD_COUNT][FUEL_RPM_COUNT]; +typedef float ignition_table_t[IGN_LOAD_COUNT][IGN_RPM_COUNT]; + #define DWELL_CURVE_SIZE 8 typedef enum { @@ -440,17 +439,17 @@ typedef struct { air_pressure_sensor_config_s baroSensor; - float veLoadBins[VE_LOAD_COUNT]; - float veRpmBins[VE_RPM_COUNT]; - float afrLoadBins[AFR_LOAD_COUNT]; - float afrRpmBins[AFR_RPM_COUNT]; + float veLoadBins[FUEL_LOAD_COUNT]; + float veRpmBins[FUEL_RPM_COUNT]; + float afrLoadBins[FUEL_LOAD_COUNT]; + float afrRpmBins[FUEL_RPM_COUNT]; // the large tables are always in the end - that's related to TunerStudio paging implementation - float fuelTable[FUEL_LOAD_COUNT][FUEL_RPM_COUNT]; // size 1024 - float ignitionTable[IGN_LOAD_COUNT][IGN_RPM_COUNT]; // size 1024 + fuel_table_t fuelTable; // size 1024 + ignition_table_t ignitionTable; // size 1024 - float veTable[VE_LOAD_COUNT][VE_RPM_COUNT]; // size 1024 - float afrTable[AFR_LOAD_COUNT][AFR_RPM_COUNT]; // size 1024 + fuel_table_t veTable; // size 1024 + fuel_table_t afrTable; // size 1024 board_configuration_s bc; @@ -551,4 +550,7 @@ void commonFrankensoAnalogInputs(engine_configuration_s *engineConfiguration); } #endif /* __cplusplus */ +void copyFuelTable(fuel_table_t const source, fuel_table_t destination); +void copyTimingTable(ignition_table_t const source, ignition_table_t destination); + #endif /* ENGINE_CONFIGURATION_H_ */ diff --git a/firmware/controllers/math/speed_density.cpp b/firmware/controllers/math/speed_density.cpp index a376b60a29..e1e9d628a2 100644 --- a/firmware/controllers/math/speed_density.cpp +++ b/firmware/controllers/math/speed_density.cpp @@ -80,11 +80,11 @@ float getSpeedDensityFuel(Engine *engine, int rpm) { } void setDetaultVETable(engine_configuration_s *engineConfiguration) { - setRpmTableBin(engineConfiguration->veRpmBins, VE_RPM_COUNT); - setTableBin2(engineConfiguration->veLoadBins, VE_LOAD_COUNT, 10, 300, 1); + setRpmTableBin(engineConfiguration->veRpmBins, FUEL_RPM_COUNT); + setTableBin2(engineConfiguration->veLoadBins, FUEL_LOAD_COUNT, 10, 300, 1); - setRpmTableBin(engineConfiguration->afrRpmBins, AFR_RPM_COUNT); - setTableBin2(engineConfiguration->afrLoadBins, VE_LOAD_COUNT, 10, 300, 1); + setRpmTableBin(engineConfiguration->afrRpmBins, FUEL_RPM_COUNT); + setTableBin2(engineConfiguration->afrLoadBins, FUEL_LOAD_COUNT, 10, 300, 1); veMap.setAll(0.8); afrMap.setAll(14.7); diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index e3c0d49ad6..ff70c838f6 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -256,7 +256,7 @@ void firmwareError(const char *fmt, ...) { } } -static char UNUSED_RAM_SIZE[7000]; +static char UNUSED_RAM_SIZE[6000]; static char UNUSED_CCM_SIZE[11000] CCM_OPTIONAL; @@ -265,5 +265,5 @@ int getRusEfiVersion(void) { return 1; // this is here to make the compiler happy about the unused array if (UNUSED_CCM_SIZE == 0) return 1; // this is here to make the compiler happy about the unused array - return 20141130; + return 20141201; }