diff --git a/firmware/config/engines/mazda_miata_1_6.cpp b/firmware/config/engines/mazda_miata_1_6.cpp index 550f1d5190..124564a307 100644 --- a/firmware/config/engines/mazda_miata_1_6.cpp +++ b/firmware/config/engines/mazda_miata_1_6.cpp @@ -16,29 +16,10 @@ #include "fsio_impl.h" #include "thermistors.h" #include "mazda_miata_1_6.h" +#include "mazda_miata_base_maps.h" EXTERN_CONFIG; -// todo: use these defaults wider? make them global defaults maybe? -static const float hardCodedcrankingCycleBins[8] = {1.0, 16.0, 35.0, 54.0, 76.0, 102.0, 132.0, 169.0}; -static const float hardCodedcrankingCycleCoef[8] = {1.9800034, 1.800003, 1.5999985, 1.4000015, 1.2300034, 1.1200027, 1.050003, 1.0199966}; - -/* Generated by TS2C on Thu Jul 30 00:03:20 EDT 2020*/ -static void setCrankingCycleBins(DECLARE_CONFIG_PARAMETER_SIGNATURE) { - MEMCPY(config->crankingCycleBins, hardCodedcrankingCycleBins); - MEMCPY(config->crankingCycleCoef, hardCodedcrankingCycleCoef); -} - -// todo: use these defaults wider? make them global defaults maybe? -static const float hardCodedcrankingFuelBins[8] = {-20.0, -10.0, 3.6799927, 22.77002, 34.049805, 49.95996, 65.0, 90.0}; -static const float hardCodedcrankingFuelCoef[8] = {2.7999878, 2.2000122, 1.6900024, 1.2900009, 1.199997, 1.050003, 1.0, 1.0}; - -/* Generated by TS2C on Thu Jul 30 00:03:20 EDT 2020*/ -static void setCrankingFuelBins(DECLARE_CONFIG_PARAMETER_SIGNATURE) { - MEMCPY(config->crankingFuelBins, hardCodedcrankingFuelBins); - MEMCPY(config->crankingFuelCoef, hardCodedcrankingFuelCoef); -} - static const float hardCodedmafDecodingBins[256] = {0.099999905, 0.19999981, 0.29999924, 0.39999962, 0.5, 0.5999985, 0.70000076, 0.79999924, 0.9000015, 1.0, 1.0999985, 1.199997, 1.300003, 1.4000015, 1.5, 1.5999985, 1.699997, 1.800003, 1.9000015, 2.0, 2.100006, 2.2000122, 2.2999878, 2.399994, 2.5, 2.600006, 2.7000122, 2.7999878, 2.899994, 3.0, 3.100006, 3.2000122, 3.2999878, 3.399994, 3.5, 3.600006, 3.7000122, 3.7999878, 3.899994, 4.0, 4.0999756, 4.200012, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988}; static const float hardCodedmafDecoding[256] = {570.0, 437.0, 351.5, 293.55078, 237.0, 186.0, 145.0, 116.0, 96.0, 78.84961, 65.549805, 56.049805, 48.0, 40.0, 33.25, 29.449951, 25.649902, 22.800049, 20.899902, 19.0, 17.100098, 16.149902, 13.775024, 12.824951, 11.400024, 10.449951, 9.5, 8.550049, 8.454956, 8.359985, 8.300049, 8.199951, 7.5999756, 7.125, 7.125, 7.125, 6.6500244, 6.6500244, 6.6500244, 6.6500244, 6.6500244, 6.6500244, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; @@ -49,70 +30,37 @@ static void setMafDecodingBins(DECLARE_CONFIG_PARAMETER_SIGNATURE) { MEMCPY(config->mafDecoding, hardCodedmafDecoding); } -static const float hardCodediacCoastingBins[16] = {-40.0, -30.0, -20.0, -10.0, 0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}; +static const float hardCodedveLoadBins[16] = {20.0, 30.0, 34.0, 38.0, 43.0, 48.0, 54.0, 60.0, 67.0, 74.0, 82.0, 90.0, 99.0, 108.0, 118.0, 128.0}; -static const float hardCodediacCoasting[16] = {-40.0, -30.0, -20.0, -10.0, 0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}; +static const float hardCodedveRpmBins[16] = {650.0, 950.0, 1250.0, 1600.0, 1950.0, 2350.0, 2750.0, 3200.0, 3700.0, 4200.0, 4700.0, 5200.0, 5800.0, 6400.0, 7100.0, 7800.0}; -/* Generated by TS2C on Fri Jul 31 14:02:18 EDT 2020*/ -static void setIacCoastingBins(DECLARE_CONFIG_PARAMETER_SIGNATURE) { - MEMCPY(engineConfiguration->iacCoastingBins, hardCodediacCoastingBins); - MEMCPY(engineConfiguration->iacCoasting, hardCodediacCoasting); -} - -static const float hardCodedcltIdleCorrBins[16] = {-40.0, -30.0, -20.0, -10.0, 0.0, 9.439941, 19.120117, 30.810059, 42.509766, 54.529785, 64.21973, 71.90039, 80.0, 90.0, 100.0, 110.0}; - -static const float hardCodedcltIdleCorr[16] = {-40.0, -30.0, -20.0, -10.0, 0.0, 9.439941, 19.120117, 30.810059, 42.509766, 54.529785, 64.21973, 71.90039, 80.0, 90.0, 100.0, 110.0}; - -/* Generated by TS2C on Fri Jul 31 14:02:18 EDT 2020*/ -static void setCltIdleCorrBins(DECLARE_CONFIG_PARAMETER_SIGNATURE) { - MEMCPY(config->cltIdleCorrBins, hardCodedcltIdleCorrBins); - MEMCPY(config->cltIdleCorr, hardCodedcltIdleCorr); -} - -static const float hardCodedcltIdleRpmBins[16] = {-40.0, -30.0, -20.0, 0.0, 10.0, 20.0, 30.0, 40.0, 60.0, 70.0, 80.0, 90.0, 100.0, 120.0, 130.0, 140.0}; - -static const float hardCodedcltIdleRpm[16] = {-40.0, -30.0, -20.0, 0.0, 10.0, 20.0, 30.0, 40.0, 60.0, 70.0, 80.0, 90.0, 100.0, 120.0, 130.0, 140.0}; - -/* Generated by TS2C on Fri Jul 31 14:02:18 EDT 2020*/ -static void setCltIdleRpmBins(DECLARE_CONFIG_PARAMETER_SIGNATURE) { - MEMCPY(engineConfiguration->cltIdleRpmBins, hardCodedcltIdleRpmBins); - MEMCPY(engineConfiguration->cltIdleRpm, hardCodedcltIdleRpm); -} - - -static const float ve16RpmBins[FUEL_RPM_COUNT] = { -650.0,1100.0,1550.0,2000.0, -2450.0,2900.0,3350.0,3800.0, -4250.0,4700.0,5150.0,5650.0, -6100.0,6550.0,7000.0,7450.0}; - -static const float ve16LoadBins[FUEL_LOAD_COUNT] = { - 30.0, 35.0, 40.0, 45.0, - 50.0, 60.0, 80.0, 100.0, - 120.0, 140.0, 150.0, 160.0, - 170.0, 180.0, 190.0, 200.0}; - -#if DEFAULT_FUEL_LOAD_COUNT == FUEL_LOAD_COUNT -static const fuel_table_t mapBased16VeTable = { - /* Generated by TS2C on Sun Oct 02 19:40:18 EDT 2016*/ - {/* 0 30.000 *//* 0 650.0*/23.348, /* 1 1100.0*/32.544, /* 2 1550.0*/50.000, /* 3 2000.0*/57.000, /* 4 2450.0*/53.000, /* 5 2900.0*/53.000, /* 6 3350.0*/57.000, /* 7 3800.0*/59.000, /* 8 4250.0*/59.000, /* 9 4700.0*/59.000, /* 10 5150.0*/59.000, /* 11 5650.0*/61.000, /* 12 6100.0*/65.000, /* 13 6550.0*/65.000, /* 14 7000.0*/65.000, /* 15 7450.0*/65.000, }, - {/* 1 35.000 *//* 0 650.0*/31.877, /* 1 1100.0*/36.888, /* 2 1550.0*/50.000, /* 3 2000.0*/57.000, /* 4 2450.0*/53.000, /* 5 2900.0*/53.000, /* 6 3350.0*/57.000, /* 7 3800.0*/59.000, /* 8 4250.0*/59.000, /* 9 4700.0*/59.000, /* 10 5150.0*/59.000, /* 11 5650.0*/61.000, /* 12 6100.0*/65.000, /* 13 6550.0*/65.000, /* 14 7000.0*/65.000, /* 15 7450.0*/65.000, }, - {/* 2 40.000 *//* 0 650.0*/40.406, /* 1 1100.0*/41.232, /* 2 1550.0*/50.452, /* 3 2000.0*/57.000, /* 4 2450.0*/53.847, /* 5 2900.0*/53.909, /* 6 3350.0*/57.900, /* 7 3800.0*/56.264, /* 8 4250.0*/57.443, /* 9 4700.0*/58.621, /* 10 5150.0*/59.799, /* 11 5650.0*/61.000, /* 12 6100.0*/62.285, /* 13 6550.0*/63.463, /* 14 7000.0*/64.642, /* 15 7450.0*/65.818, }, - {/* 3 45.000 *//* 0 650.0*/39.632, /* 1 1100.0*/41.232, /* 2 1550.0*/46.203, /* 3 2000.0*/55.525, /* 4 2450.0*/49.387, /* 5 2900.0*/51.656, /* 6 3350.0*/53.514, /* 7 3800.0*/56.264, /* 8 4250.0*/57.443, /* 9 4700.0*/57.728, /* 10 5150.0*/59.799, /* 11 5650.0*/61.107, /* 12 6100.0*/61.252, /* 13 6550.0*/62.515, /* 14 7000.0*/63.530, /* 15 7450.0*/64.545, }, - {/* 4 50.000 *//* 0 650.0*/38.858, /* 1 1100.0*/42.271, /* 2 1550.0*/41.954, /* 3 2000.0*/53.756, /* 4 2450.0*/44.928, /* 5 2900.0*/49.404, /* 6 3350.0*/49.128, /* 7 3800.0*/56.362, /* 8 4250.0*/57.214, /* 9 4700.0*/56.834, /* 10 5150.0*/58.917, /* 11 5650.0*/59.863, /* 12 6100.0*/60.221, /* 13 6550.0*/61.566, /* 14 7000.0*/62.417, /* 15 7450.0*/63.270, }, - {/* 5 60.000 *//* 0 650.0*/49.634, /* 1 1100.0*/42.053, /* 2 1550.0*/49.601, /* 3 2000.0*/47.654, /* 4 2450.0*/52.109, /* 5 2900.0*/48.840, /* 6 3350.0*/53.876, /* 7 3800.0*/55.312, /* 8 4250.0*/52.585, /* 9 4700.0*/54.218, /* 10 5150.0*/58.088, /* 11 5650.0*/58.660, /* 12 6100.0*/59.175, /* 13 6550.0*/59.690, /* 14 7000.0*/60.206, /* 15 7450.0*/60.720, }, - {/* 6 80.000 *//* 0 650.0*/45.650, /* 1 1100.0*/52.751, /* 2 1550.0*/51.744, /* 3 2000.0*/58.603, /* 4 2450.0*/56.427, /* 5 2900.0*/55.073, /* 6 3350.0*/57.869, /* 7 3800.0*/55.562, /* 8 4250.0*/54.198, /* 9 4700.0*/56.585, /* 10 5150.0*/56.427, /* 11 5650.0*/56.253, /* 12 6100.0*/56.095, /* 13 6550.0*/55.938, /* 14 7000.0*/55.779, /* 15 7450.0*/55.623, }, - {/* 7 100.000 *//* 0 650.0*/45.541, /* 1 1100.0*/43.911, /* 2 1550.0*/69.598, /* 3 2000.0*/69.534, /* 4 2450.0*/56.299, /* 5 2900.0*/66.710, /* 6 3350.0*/64.073, /* 7 3800.0*/59.968, /* 8 4250.0*/62.489, /* 9 4700.0*/68.074, /* 10 5150.0*/73.266, /* 11 5650.0*/75.644, /* 12 6100.0*/53.636, /* 13 6550.0*/55.891, /* 14 7000.0*/58.144, /* 15 7450.0*/60.398, }, - {/* 8 120.000 *//* 0 650.0*/51.418, /* 1 1100.0*/52.427, /* 2 1550.0*/53.436, /* 3 2000.0*/54.445, /* 4 2450.0*/55.453, /* 5 2900.0*/57.040, /* 6 3350.0*/59.458, /* 7 3800.0*/63.820, /* 8 4250.0*/63.933, /* 9 4700.0*/70.255, /* 10 5150.0*/76.251, /* 11 5650.0*/75.242, /* 12 6100.0*/58.230, /* 13 6550.0*/60.543, /* 14 7000.0*/62.858, /* 15 7450.0*/65.172, }, - {/* 9 140.000 *//* 0 650.0*/57.118, /* 1 1100.0*/59.040, /* 2 1550.0*/60.962, /* 3 2000.0*/62.884, /* 4 2450.0*/64.806, /* 5 2900.0*/69.796, /* 6 3350.0*/68.924, /* 7 3800.0*/72.413, /* 8 4250.0*/76.775, /* 9 4700.0*/79.393, /* 10 5150.0*/81.138, /* 11 5650.0*/80.267, /* 12 6100.0*/73.067, /* 13 6550.0*/76.288, /* 14 7000.0*/79.510, /* 15 7450.0*/82.730, }, - {/* 10 150.000 *//* 0 650.0*/59.967, /* 1 1100.0*/62.346, /* 2 1550.0*/64.725, /* 3 2000.0*/67.104, /* 4 2450.0*/69.796, /* 5 2900.0*/84.629, /* 6 3350.0*/77.647, /* 7 3800.0*/79.393, /* 8 4250.0*/85.499, /* 9 4700.0*/88.990, /* 10 5150.0*/87.246, /* 11 5650.0*/84.629, /* 12 6100.0*/80.487, /* 13 6550.0*/84.160, /* 14 7000.0*/87.836, /* 15 7450.0*/91.511, }, - {/* 11 160.000 *//* 0 650.0*/62.816, /* 1 1100.0*/65.652, /* 2 1550.0*/68.486, /* 3 2000.0*/71.322, /* 4 2450.0*/74.158, /* 5 2900.0*/86.373, /* 6 3350.0*/80.267, /* 7 3800.0*/82.010, /* 8 4250.0*/87.246, /* 9 4700.0*/93.352, /* 10 5150.0*/93.352, /* 11 5650.0*/93.352, /* 12 6100.0*/87.905, /* 13 6550.0*/92.032, /* 14 7000.0*/96.161, /* 15 7450.0*/100.287, }, - {/* 12 170.000 *//* 0 650.0*/63.690, /* 1 1100.0*/63.690, /* 2 1550.0*/63.690, /* 3 2000.0*/81.138, /* 4 2450.0*/86.373, /* 5 2900.0*/87.246, /* 6 3350.0*/87.246, /* 7 3800.0*/87.246, /* 8 4250.0*/86.373, /* 9 4700.0*/87.246, /* 10 5150.0*/87.246, /* 11 5650.0*/87.246, /* 12 6100.0*/95.323, /* 13 6550.0*/99.904, /* 14 7000.0*/104.485, /* 15 7450.0*/109.066, }, - {/* 13 180.000 *//* 0 650.0*/64.562, /* 1 1100.0*/64.562, /* 2 1550.0*/64.562, /* 3 2000.0*/82.010, /* 4 2450.0*/89.862, /* 5 2900.0*/90.735, /* 6 3350.0*/90.735, /* 7 3800.0*/90.735, /* 8 4250.0*/90.735, /* 9 4700.0*/90.735, /* 10 5150.0*/90.735, /* 11 5650.0*/90.735, /* 12 6100.0*/103.355, /* 13 6550.0*/108.388, /* 14 7000.0*/113.422, /* 15 7450.0*/118.458, }, - {/* 14 190.000 *//* 0 650.0*/65.435, /* 1 1100.0*/65.435, /* 2 1550.0*/65.435, /* 3 2000.0*/82.884, /* 4 2450.0*/90.735, /* 5 2900.0*/92.479, /* 6 3350.0*/93.352, /* 7 3800.0*/93.352, /* 8 4250.0*/93.352, /* 9 4700.0*/93.352, /* 10 5150.0*/93.352, /* 11 5650.0*/93.352, /* 12 6100.0*/110.774, /* 13 6550.0*/116.262, /* 14 7000.0*/121.749, /* 15 7450.0*/127.237, }, - {/* 15 200.000 *//* 0 650.0*/66.307, /* 1 1100.0*/66.307, /* 2 1550.0*/66.307, /* 3 2000.0*/83.756, /* 4 2450.0*/91.608, /* 5 2900.0*/93.352, /* 6 3350.0*/94.224, /* 7 3800.0*/94.224, /* 8 4250.0*/94.224, /* 9 4700.0*/94.224, /* 10 5150.0*/94.224, /* 11 5650.0*/94.224, /* 12 6100.0*/118.805, /* 13 6550.0*/124.742, /* 14 7000.0*/130.684, /* 15 7450.0*/136.627, }, +static const float hardCodedveTable[16][16] = { +/* Generated by TS2C on Sun Aug 02 10:02:25 EDT 2020*/ +{/* 0 20.000 *//* 0 650.0*/40.592, /* 1 950.0*/42.715, /* 2 1250.0*/44.205, /* 3 1600.0*/44.998, /* 4 1950.0*/45.586, /* 5 2350.0*/45.141, /* 6 2750.0*/42.739, /* 7 3200.0*/41.176, /* 8 3700.0*/39.921, /* 9 4200.0*/41.272, /* 10 4700.0*/43.726, /* 11 5200.0*/47.937, /* 12 5800.0*/52.229, /* 13 6400.0*/55.654, /* 14 7100.0*/58.140, /* 15 7800.0*/58.763, }, +{/* 1 30.000 *//* 0 650.0*/46.506, /* 1 950.0*/49.126, /* 2 1250.0*/49.847, /* 3 1600.0*/49.706, /* 4 1950.0*/49.866, /* 5 2350.0*/50.828, /* 6 2750.0*/51.849, /* 7 3200.0*/50.064, /* 8 3700.0*/48.359, /* 9 4200.0*/49.920, /* 10 4700.0*/54.116, /* 11 5200.0*/58.954, /* 12 5800.0*/64.546, /* 13 6400.0*/66.713, /* 14 7100.0*/67.738, /* 15 7800.0*/68.457, }, +{/* 2 34.000 *//* 0 650.0*/51.408, /* 1 950.0*/55.035, /* 2 1250.0*/56.457, /* 3 1600.0*/55.807, /* 4 1950.0*/56.117, /* 5 2350.0*/57.554, /* 6 2750.0*/59.953, /* 7 3200.0*/58.324, /* 8 3700.0*/55.696, /* 9 4200.0*/56.141, /* 10 4700.0*/59.908, /* 11 5200.0*/65.525, /* 12 5800.0*/70.589, /* 13 6400.0*/71.985, /* 14 7100.0*/72.969, /* 15 7800.0*/73.576, }, +{/* 3 38.000 *//* 0 650.0*/55.131, /* 1 950.0*/58.797, /* 2 1250.0*/60.825, /* 3 1600.0*/62.831, /* 4 1950.0*/62.511, /* 5 2350.0*/63.555, /* 6 2750.0*/66.933, /* 7 3200.0*/66.365, /* 8 3700.0*/63.211, /* 9 4200.0*/63.721, /* 10 4700.0*/67.063, /* 11 5200.0*/72.315, /* 12 5800.0*/76.385, /* 13 6400.0*/78.133, /* 14 7100.0*/78.436, /* 15 7800.0*/78.577, }, +{/* 4 43.000 *//* 0 650.0*/62.427, /* 1 950.0*/64.929, /* 2 1250.0*/68.336, /* 3 1600.0*/70.803, /* 4 1950.0*/70.206, /* 5 2350.0*/71.101, /* 6 2750.0*/74.762, /* 7 3200.0*/74.345, /* 8 3700.0*/71.209, /* 9 4200.0*/70.365, /* 10 4700.0*/73.419, /* 11 5200.0*/78.221, /* 12 5800.0*/82.753, /* 13 6400.0*/83.884, /* 14 7100.0*/84.646, /* 15 7800.0*/84.760, }, +{/* 5 48.000 *//* 0 650.0*/69.850, /* 1 950.0*/72.581, /* 2 1250.0*/75.672, /* 3 1600.0*/78.355, /* 4 1950.0*/78.085, /* 5 2350.0*/80.211, /* 6 2750.0*/82.045, /* 7 3200.0*/81.545, /* 8 3700.0*/78.744, /* 9 4200.0*/78.467, /* 10 4700.0*/78.896, /* 11 5200.0*/83.297, /* 12 5800.0*/87.946, /* 13 6400.0*/90.166, /* 14 7100.0*/91.174, /* 15 7800.0*/91.355, }, +{/* 6 54.000 *//* 0 650.0*/75.722, /* 1 950.0*/79.103, /* 2 1250.0*/82.361, /* 3 1600.0*/84.630, /* 4 1950.0*/84.046, /* 5 2350.0*/85.438, /* 6 2750.0*/86.868, /* 7 3200.0*/86.240, /* 8 3700.0*/84.198, /* 9 4200.0*/83.970, /* 10 4700.0*/85.578, /* 11 5200.0*/89.898, /* 12 5800.0*/93.576, /* 13 6400.0*/96.423, /* 14 7100.0*/97.712, /* 15 7800.0*/98.025, }, +{/* 7 60.000 *//* 0 650.0*/80.931, /* 1 950.0*/83.518, /* 2 1250.0*/86.618, /* 3 1600.0*/90.079, /* 4 1950.0*/88.666, /* 5 2350.0*/88.837, /* 6 2750.0*/90.304, /* 7 3200.0*/89.797, /* 8 3700.0*/89.359, /* 9 4200.0*/89.215, /* 10 4700.0*/91.475, /* 11 5200.0*/95.601, /* 12 5800.0*/98.813, /* 13 6400.0*/101.662, /* 14 7100.0*/103.927, /* 15 7800.0*/104.533, }, +{/* 8 67.000 *//* 0 650.0*/85.475, /* 1 950.0*/87.373, /* 2 1250.0*/90.576, /* 3 1600.0*/94.341, /* 4 1950.0*/93.254, /* 5 2350.0*/92.835, /* 6 2750.0*/94.631, /* 7 3200.0*/93.803, /* 8 3700.0*/93.489, /* 9 4200.0*/95.245, /* 10 4700.0*/97.738, /* 11 5200.0*/101.731, /* 12 5800.0*/105.341, /* 13 6400.0*/107.920, /* 14 7100.0*/109.300, /* 15 7800.0*/110.264, }, +{/* 9 74.000 *//* 0 650.0*/90.588, /* 1 950.0*/92.696, /* 2 1250.0*/94.371, /* 3 1600.0*/99.087, /* 4 1950.0*/98.227, /* 5 2350.0*/98.105, /* 6 2750.0*/99.515, /* 7 3200.0*/98.095, /* 8 3700.0*/99.186, /* 9 4200.0*/101.554, /* 10 4700.0*/105.278, /* 11 5200.0*/108.206, /* 12 5800.0*/111.131, /* 13 6400.0*/112.939, /* 14 7100.0*/114.120, /* 15 7800.0*/114.274, }, +{/* 10 82.000 *//* 0 650.0*/96.035, /* 1 950.0*/96.933, /* 2 1250.0*/99.341, /* 3 1600.0*/102.952, /* 4 1950.0*/103.774, /* 5 2350.0*/103.973, /* 6 2750.0*/103.334, /* 7 3200.0*/105.005, /* 8 3700.0*/106.212, /* 9 4200.0*/109.098, /* 10 4700.0*/111.624, /* 11 5200.0*/114.729, /* 12 5800.0*/116.929, /* 13 6400.0*/118.501, /* 14 7100.0*/118.165, /* 15 7800.0*/118.979, }, +{/* 11 90.000 *//* 0 650.0*/100.834, /* 1 950.0*/101.388, /* 2 1250.0*/103.619, /* 3 1600.0*/107.806, /* 4 1950.0*/107.164, /* 5 2350.0*/106.776, /* 6 2750.0*/106.612, /* 7 3200.0*/108.891, /* 8 3700.0*/112.385, /* 9 4200.0*/114.962, /* 10 4700.0*/117.627, /* 11 5200.0*/120.118, /* 12 5800.0*/121.564, /* 13 6400.0*/122.254, /* 14 7100.0*/122.201, /* 15 7800.0*/121.964, }, +{/* 12 99.000 *//* 0 650.0*/104.415, /* 1 950.0*/105.773, /* 2 1250.0*/107.849, /* 3 1600.0*/109.719, /* 4 1950.0*/109.161, /* 5 2350.0*/108.677, /* 6 2750.0*/108.340, /* 7 3200.0*/110.866, /* 8 3700.0*/114.415, /* 9 4200.0*/117.876, /* 10 4700.0*/120.450, /* 11 5200.0*/123.946, /* 12 5800.0*/125.295, /* 13 6400.0*/124.855, /* 14 7100.0*/125.070, /* 15 7800.0*/124.014, }, +{/* 13 108.000 *//* 0 650.0*/105.599, /* 1 950.0*/106.125, /* 2 1250.0*/107.606, /* 3 1600.0*/108.824, /* 4 1950.0*/109.716, /* 5 2350.0*/108.998, /* 6 2750.0*/109.269, /* 7 3200.0*/110.926, /* 8 3700.0*/114.086, /* 9 4200.0*/117.390, /* 10 4700.0*/119.910, /* 11 5200.0*/123.648, /* 12 5800.0*/124.843, /* 13 6400.0*/126.550, /* 14 7100.0*/126.680, /* 15 7800.0*/125.881, }, +{/* 14 118.000 *//* 0 650.0*/105.855, /* 1 950.0*/106.603, /* 2 1250.0*/107.652, /* 3 1600.0*/109.393, /* 4 1950.0*/110.349, /* 5 2350.0*/109.481, /* 6 2750.0*/109.790, /* 7 3200.0*/111.735, /* 8 3700.0*/114.132, /* 9 4200.0*/116.603, /* 10 4700.0*/119.263, /* 11 5200.0*/121.682, /* 12 5800.0*/123.221, /* 13 6400.0*/125.171, /* 14 7100.0*/128.184, /* 15 7800.0*/128.348, }, +{/* 15 128.000 *//* 0 650.0*/104.430, /* 1 950.0*/105.297, /* 2 1250.0*/107.271, /* 3 1600.0*/108.832, /* 4 1950.0*/108.953, /* 5 2350.0*/110.116, /* 6 2750.0*/111.153, /* 7 3200.0*/112.316, /* 8 3700.0*/114.148, /* 9 4200.0*/116.354, /* 10 4700.0*/118.107, /* 11 5200.0*/119.835, /* 12 5800.0*/121.332, /* 13 6400.0*/124.078, /* 14 7100.0*/127.961, /* 15 7800.0*/130.209, } }; -#endif + +/* Generated by TS2C on Sun Aug 02 10:02:25 EDT 2020*/ +static void setVeTable(DECLARE_CONFIG_PARAMETER_SIGNATURE) { + MEMCPY(config->veLoadBins, hardCodedveLoadBins); + MEMCPY(config->veRpmBins, hardCodedveRpmBins); + MEMCPY(config->veTable, hardCodedveTable); +} + #if IGN_LOAD_COUNT == DEFAULT_IGN_LOAD_COUNT static const ignition_table_t mapBased16IgnitionTable = { @@ -153,12 +101,12 @@ static void miataNAcommonEngineSettings(DECLARE_CONFIG_PARAMETER_SIGNATURE) { MEMCPY(config->ignitionTable, mapBased16IgnitionTable); #endif - setCrankingCycleBins(PASS_CONFIG_PARAMETER_SIGNATURE); - setCrankingFuelBins(PASS_CONFIG_PARAMETER_SIGNATURE); + miataNA_setCrankingCycleBins(PASS_CONFIG_PARAMETER_SIGNATURE); + miataNA_setCrankingFuelBins(PASS_CONFIG_PARAMETER_SIGNATURE); - setCltIdleCorrBins(PASS_CONFIG_PARAMETER_SIGNATURE); - setCltIdleRpmBins(PASS_CONFIG_PARAMETER_SIGNATURE); - setIacCoastingBins(PASS_CONFIG_PARAMETER_SIGNATURE); + miataNA_setCltIdleCorrBins(PASS_CONFIG_PARAMETER_SIGNATURE); + miataNA_setCltIdleRpmBins(PASS_CONFIG_PARAMETER_SIGNATURE); + miataNA_setIacCoastingBins(PASS_CONFIG_PARAMETER_SIGNATURE); setMafDecodingBins(PASS_CONFIG_PARAMETER_SIGNATURE); engineConfiguration->idle.solenoidFrequency = 160; @@ -180,11 +128,8 @@ void miataNAcommon(DECLARE_CONFIG_PARAMETER_SIGNATURE) { static void setMiataNA6_settings(DECLARE_CONFIG_PARAMETER_SIGNATURE) { engineConfiguration->isFasterEngineSpinUpEnabled = true; - MEMCPY(config->veRpmBins, ve16RpmBins); - MEMCPY(config->veLoadBins, ve16LoadBins); -#if DEFAULT_FUEL_LOAD_COUNT == FUEL_LOAD_COUNT - MEMCPY(config->veTable, mapBased16VeTable); -#endif + + setVeTable(PASS_CONFIG_PARAMETER_SIGNATURE); setWholeFuelMap(6 PASS_CONFIG_PARAMETER_SUFFIX); diff --git a/firmware/config/engines/mazda_miata_base_maps.cpp b/firmware/config/engines/mazda_miata_base_maps.cpp index 8891a3d6cb..186a235fec 100644 --- a/firmware/config/engines/mazda_miata_base_maps.cpp +++ b/firmware/config/engines/mazda_miata_base_maps.cpp @@ -1,5 +1,5 @@ /* - * mazda_miata_base_maps.cpp + * @file mazda_miata_base_maps.cpp * * Created on: Dec 31, 2018 * @author Andrey Belomutskiy, (c) 2012-2020 @@ -7,8 +7,54 @@ #include "engine_configuration.h" -//const float ve16RpmBins[FUEL_RPM_COUNT] = { -//650.0,1100.0,1550.0,2000.0, -//2450.0,2900.0,3350.0,3800.0, -//4250.0,4700.0,5150.0,5650.0, -//6100.0,6550.0,7000.0,7450.0}; +EXTERN_CONFIG; + +// todo: use these defaults wider? make them global defaults maybe? +static const float hardCodedcrankingCycleBins[8] = {1.0, 16.0, 35.0, 54.0, 76.0, 102.0, 132.0, 169.0}; +static const float hardCodedcrankingCycleCoef[8] = {1.9800034, 1.800003, 1.5999985, 1.4000015, 1.2300034, 1.1200027, 1.050003, 1.0199966}; + +/* Generated by TS2C on Thu Jul 30 00:03:20 EDT 2020*/ +void miataNA_setCrankingCycleBins(DECLARE_CONFIG_PARAMETER_SIGNATURE) { + MEMCPY(config->crankingCycleBins, hardCodedcrankingCycleBins); + MEMCPY(config->crankingCycleCoef, hardCodedcrankingCycleCoef); +} + +// todo: use these defaults wider? make them global defaults maybe? +static const float hardCodedcrankingFuelBins[8] = {-20.0, -10.0, 3.6799927, 22.77002, 34.049805, 49.95996, 65.0, 90.0}; +static const float hardCodedcrankingFuelCoef[8] = {2.7999878, 2.2000122, 1.6900024, 1.2900009, 1.199997, 1.050003, 1.0, 1.0}; + +/* Generated by TS2C on Thu Jul 30 00:03:20 EDT 2020*/ +void miataNA_setCrankingFuelBins(DECLARE_CONFIG_PARAMETER_SIGNATURE) { + MEMCPY(config->crankingFuelBins, hardCodedcrankingFuelBins); + MEMCPY(config->crankingFuelCoef, hardCodedcrankingFuelCoef); +} + +static const float hardCodediacCoastingBins[16] = {-40.0, -30.0, -20.0, -10.0, 0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}; + +static const float hardCodediacCoasting[16] = {-40.0, -30.0, -20.0, -10.0, 0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}; + +/* Generated by TS2C on Fri Jul 31 14:02:18 EDT 2020*/ +void miataNA_setIacCoastingBins(DECLARE_CONFIG_PARAMETER_SIGNATURE) { + MEMCPY(engineConfiguration->iacCoastingBins, hardCodediacCoastingBins); + MEMCPY(engineConfiguration->iacCoasting, hardCodediacCoasting); +} + +static const float hardCodedcltIdleCorrBins[16] = {-40.0, -30.0, -20.0, -10.0, 0.0, 9.439941, 19.120117, 30.810059, 42.509766, 54.529785, 64.21973, 71.90039, 80.0, 90.0, 100.0, 110.0}; + +static const float hardCodedcltIdleCorr[16] = {-40.0, -30.0, -20.0, -10.0, 0.0, 9.439941, 19.120117, 30.810059, 42.509766, 54.529785, 64.21973, 71.90039, 80.0, 90.0, 100.0, 110.0}; + +/* Generated by TS2C on Fri Jul 31 14:02:18 EDT 2020*/ +void miataNA_setCltIdleCorrBins(DECLARE_CONFIG_PARAMETER_SIGNATURE) { + MEMCPY(config->cltIdleCorrBins, hardCodedcltIdleCorrBins); + MEMCPY(config->cltIdleCorr, hardCodedcltIdleCorr); +} + +static const float hardCodedcltIdleRpmBins[16] = {-40.0, -30.0, -20.0, 0.0, 10.0, 20.0, 30.0, 40.0, 60.0, 70.0, 80.0, 90.0, 100.0, 120.0, 130.0, 140.0}; + +static const float hardCodedcltIdleRpm[16] = {-40.0, -30.0, -20.0, 0.0, 10.0, 20.0, 30.0, 40.0, 60.0, 70.0, 80.0, 90.0, 100.0, 120.0, 130.0, 140.0}; + +/* Generated by TS2C on Fri Jul 31 14:02:18 EDT 2020*/ +void miataNA_setCltIdleRpmBins(DECLARE_CONFIG_PARAMETER_SIGNATURE) { + MEMCPY(engineConfiguration->cltIdleRpmBins, hardCodedcltIdleRpmBins); + MEMCPY(engineConfiguration->cltIdleRpm, hardCodedcltIdleRpm); +} diff --git a/firmware/config/engines/mazda_miata_base_maps.h b/firmware/config/engines/mazda_miata_base_maps.h new file mode 100644 index 0000000000..dbe228618d --- /dev/null +++ b/firmware/config/engines/mazda_miata_base_maps.h @@ -0,0 +1,16 @@ +/* + * @file mazda_miata_base_maps.h + * + * @date Aug 2, 2020 + * @author Andrey Belomutskiy, (c) 2012-2020 + */ + +#pragma once + +#include "global.h" + +void miataNA_setCrankingCycleBins(DECLARE_CONFIG_PARAMETER_SIGNATURE); +void miataNA_setCrankingFuelBins(DECLARE_CONFIG_PARAMETER_SIGNATURE); +void miataNA_setIacCoastingBins(DECLARE_CONFIG_PARAMETER_SIGNATURE); +void miataNA_setCltIdleCorrBins(DECLARE_CONFIG_PARAMETER_SIGNATURE); +void miataNA_setCltIdleRpmBins(DECLARE_CONFIG_PARAMETER_SIGNATURE); diff --git a/firmware/config/engines/mazda_miata_vvt.cpp b/firmware/config/engines/mazda_miata_vvt.cpp index 8210f3d874..75293c8d21 100644 --- a/firmware/config/engines/mazda_miata_vvt.cpp +++ b/firmware/config/engines/mazda_miata_vvt.cpp @@ -51,6 +51,7 @@ #include "fsio_impl.h" #include "ego.h" #include "thermistors.h" +#include "mazda_miata_base_maps.h" EXTERN_CONFIG; @@ -366,6 +367,14 @@ static void setMazdaMiataEngineNB2Defaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) { engineConfiguration->idleRpmPid.iFactor = 0.0001; engineConfiguration->idleRpmPid.dFactor = 5; engineConfiguration->idleRpmPid.periodMs = 10; + + miataNA_setCrankingCycleBins(PASS_CONFIG_PARAMETER_SIGNATURE); + miataNA_setCrankingFuelBins(PASS_CONFIG_PARAMETER_SIGNATURE); + + miataNA_setCltIdleCorrBins(PASS_CONFIG_PARAMETER_SIGNATURE); + miataNA_setCltIdleRpmBins(PASS_CONFIG_PARAMETER_SIGNATURE); + miataNA_setIacCoastingBins(PASS_CONFIG_PARAMETER_SIGNATURE); + } // end of setMazdaMiataEngineNB2Defaults // MAZDA_MIATA_2003 diff --git a/java_console/models/src/main/java/com/rusefi/tools/tune/TS2C.java b/java_console/models/src/main/java/com/rusefi/tools/tune/TS2C.java index 5e5fdca015..cba71d7e30 100644 --- a/java_console/models/src/main/java/com/rusefi/tools/tune/TS2C.java +++ b/java_console/models/src/main/java/com/rusefi/tools/tune/TS2C.java @@ -75,8 +75,10 @@ public class TS2C { BufferedReader r = readAndScroll(msqFileName, tableName); readTable(table, r); + w.write("static const float hardCoded" + tableName + "[" + size + "][" + size + "] = {\n"); + writeTable(w, (loadIndex, rpmIndex) -> table[loadIndex][rpmIndex]); - w.write("\r\n\r\n"); + w.write("};\n\n"); } w.write(FINGER_PRINT); @@ -85,7 +87,7 @@ public class TS2C { w.write("\tMEMCPY(config->" + rpmSectionName + ", hardCoded" + rpmSectionName + ");\n"); if (!tableName.equalsIgnoreCase("none")) { - + w.write("\tMEMCPY(config->" + tableName + ", hardCoded" + tableName + ");\n"); } diff --git a/java_console/models/src/main/java/com/rusefi/tools/tune/TS2CRunner.java b/java_console/models/src/main/java/com/rusefi/tools/tune/TS2CRunner.java index f14372f5a8..fbd6e89ad1 100644 --- a/java_console/models/src/main/java/com/rusefi/tools/tune/TS2CRunner.java +++ b/java_console/models/src/main/java/com/rusefi/tools/tune/TS2CRunner.java @@ -17,6 +17,8 @@ public class TS2CRunner { TS2C.main(new String[]{tuneFileName, "iacCoastingBins", "iacCoasting"}); + TS2C.main(new String[]{tuneFileName, "veLoadBins", "veRpmBins", "veTable"}); + // TS2C.main(new String[]{tuneFileName, "afrLoadBins", "afrRpmBins", "afrTable"}); // TS2C.main(new String[]{tuneFileName, "fuelLoadBins", "fuelRpmBins", "fuelTable"});