Merge branch 'master' of https://github.com/rusefi/rusefi into second_can

This commit is contained in:
kon 2020-08-02 09:32:41 -07:00
commit fc05b62ac6
20 changed files with 220 additions and 135 deletions

View File

@ -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,13 +101,18 @@ static void miataNAcommonEngineSettings(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
MEMCPY(config->ignitionTable, mapBased16IgnitionTable);
#endif
setCrankingCycleBins(PASS_CONFIG_PARAMETER_SIGNATURE);
setCrankingFuelBins(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->silentTriggerError = false;
setCltIdleCorrBins(PASS_CONFIG_PARAMETER_SIGNATURE);
setCltIdleRpmBins(PASS_CONFIG_PARAMETER_SIGNATURE);
setIacCoastingBins(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->manIdlePosition = 34;
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);
setMafDecodingBins(PASS_CONFIG_PARAMETER_SIGNATURE);
miataNA_setIgnitionTable(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->idle.solenoidFrequency = 160;
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
@ -180,11 +133,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);

View File

@ -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,85 @@
#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, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.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] = {1.4000015, 1.3199997, 1.2600021, 1.2099991, 1.1699982, 1.050003, 1.0299988, 1.0199966, 1.0299988, 1.0199966, 1.0100021, 1.0, 0.9900017, 0.9900017, 0.9900017, 0.9900017};
/* 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] = {1180.0, 1150.0, 1130.0, 1110.0, 1090.0, 1070.0, 1050.0, 1020.0, 990.0, 970.0, 950.0, 950.0, 950.0, 950.0, 950.0, 950.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);
}
static const float hardCodedignitionLoadBins[16] = {10.0, 24.0, 35.0, 55.0, 65.0, 75.0, 84.0, 99.0, 110.0, 125.0, 140.0, 160.0, 180.0, 200.0, 220.0, 250.0};
static const float hardCodedignitionRpmBins[16] = {500.0, 800.0, 1000.0, 1500.0, 1800.0, 2300.0, 2900.0, 3400.0, 3900.0, 4300.0, 4800.0, 5300.0, 5900.0, 6500.0, 7200.0, 8000.0};
static const float hardCodedignitionTable[16][16] = {
/* Generated by TS2C on Sun Aug 02 11:58:01 EDT 2020*/
{/* 0 10.000 *//* 0 500.0*/15.000, /* 1 800.0*/15.000, /* 2 1000.0*/20.300, /* 3 1500.0*/21.900, /* 4 1800.0*/32.900, /* 5 2300.0*/33.400, /* 6 2900.0*/34.700, /* 7 3400.0*/35.900, /* 8 3900.0*/37.300, /* 9 4300.0*/37.600, /* 10 4800.0*/38.000, /* 11 5300.0*/38.100, /* 12 5900.0*/38.800, /* 13 6500.0*/39.500, /* 14 7200.0*/40.300, /* 15 8000.0*/41.000, },
{/* 1 24.000 *//* 0 500.0*/15.000, /* 1 800.0*/15.000, /* 2 1000.0*/18.700, /* 3 1500.0*/23.600, /* 4 1800.0*/30.900, /* 5 2300.0*/34.800, /* 6 2900.0*/35.600, /* 7 3400.0*/36.400, /* 8 3900.0*/37.300, /* 9 4300.0*/37.600, /* 10 4800.0*/38.000, /* 11 5300.0*/38.100, /* 12 5900.0*/38.800, /* 13 6500.0*/39.500, /* 14 7200.0*/40.300, /* 15 8000.0*/41.000, },
{/* 2 35.000 *//* 0 500.0*/15.000, /* 1 800.0*/15.000, /* 2 1000.0*/18.700, /* 3 1500.0*/23.600, /* 4 1800.0*/30.900, /* 5 2300.0*/33.800, /* 6 2900.0*/34.400, /* 7 3400.0*/35.000, /* 8 3900.0*/35.600, /* 9 4300.0*/35.900, /* 10 4800.0*/36.300, /* 11 5300.0*/36.400, /* 12 5900.0*/37.100, /* 13 6500.0*/37.900, /* 14 7200.0*/38.600, /* 15 8000.0*/39.300, },
{/* 3 55.000 *//* 0 500.0*/15.000, /* 1 800.0*/15.000, /* 2 1000.0*/22.600, /* 3 1500.0*/24.800, /* 4 1800.0*/28.800, /* 5 2300.0*/31.900, /* 6 2900.0*/32.500, /* 7 3400.0*/33.100, /* 8 3900.0*/33.800, /* 9 4300.0*/34.200, /* 10 4800.0*/34.600, /* 11 5300.0*/34.700, /* 12 5900.0*/35.400, /* 13 6500.0*/36.100, /* 14 7200.0*/36.900, /* 15 8000.0*/37.600, },
{/* 4 65.000 *//* 0 500.0*/17.000, /* 1 800.0*/17.000, /* 2 1000.0*/22.800, /* 3 1500.0*/24.700, /* 4 1800.0*/28.100, /* 5 2300.0*/30.300, /* 6 2900.0*/32.200, /* 7 3400.0*/32.200, /* 8 3900.0*/32.200, /* 9 4300.0*/32.700, /* 10 4800.0*/33.100, /* 11 5300.0*/33.200, /* 12 5900.0*/33.900, /* 13 6500.0*/34.700, /* 14 7200.0*/35.400, /* 15 8000.0*/36.100, },
{/* 5 75.000 *//* 0 500.0*/18.500, /* 1 800.0*/18.700, /* 2 1000.0*/24.300, /* 3 1500.0*/26.100, /* 4 1800.0*/27.600, /* 5 2300.0*/28.700, /* 6 2900.0*/29.300, /* 7 3400.0*/29.200, /* 8 3900.0*/28.800, /* 9 4300.0*/29.700, /* 10 4800.0*/30.600, /* 11 5300.0*/31.100, /* 12 5900.0*/31.800, /* 13 6500.0*/32.500, /* 14 7200.0*/33.300, /* 15 8000.0*/34.000, },
{/* 6 84.000 *//* 0 500.0*/19.600, /* 1 800.0*/19.900, /* 2 1000.0*/24.500, /* 3 1500.0*/27.800, /* 4 1800.0*/27.700, /* 5 2300.0*/27.700, /* 6 2900.0*/28.200, /* 7 3400.0*/28.100, /* 8 3900.0*/27.700, /* 9 4300.0*/28.800, /* 10 4800.0*/29.900, /* 11 5300.0*/30.700, /* 12 5900.0*/31.400, /* 13 6500.0*/32.100, /* 14 7200.0*/32.900, /* 15 8000.0*/33.600, },
{/* 7 99.000 *//* 0 500.0*/19.000, /* 1 800.0*/19.600, /* 2 1000.0*/23.900, /* 3 1500.0*/26.700, /* 4 1800.0*/26.600, /* 5 2300.0*/26.500, /* 6 2900.0*/26.900, /* 7 3400.0*/26.800, /* 8 3900.0*/26.800, /* 9 4300.0*/27.900, /* 10 4800.0*/29.100, /* 11 5300.0*/29.800, /* 12 5900.0*/30.500, /* 13 6500.0*/31.300, /* 14 7200.0*/32.000, /* 15 8000.0*/32.700, },
{/* 8 110.000 *//* 0 500.0*/19.000, /* 1 800.0*/19.100, /* 2 1000.0*/23.100, /* 3 1500.0*/26.200, /* 4 1800.0*/26.600, /* 5 2300.0*/25.500, /* 6 2900.0*/26.100, /* 7 3400.0*/26.000, /* 8 3900.0*/25.400, /* 9 4300.0*/26.500, /* 10 4800.0*/27.600, /* 11 5300.0*/28.300, /* 12 5900.0*/29.100, /* 13 6500.0*/29.800, /* 14 7200.0*/30.500, /* 15 8000.0*/31.300, },
{/* 9 125.000 *//* 0 500.0*/17.200, /* 1 800.0*/18.500, /* 2 1000.0*/21.800, /* 3 1500.0*/25.400, /* 4 1800.0*/26.700, /* 5 2300.0*/27.300, /* 6 2900.0*/26.900, /* 7 3400.0*/25.700, /* 8 3900.0*/24.900, /* 9 4300.0*/25.300, /* 10 4800.0*/25.700, /* 11 5300.0*/26.100, /* 12 5900.0*/26.800, /* 13 6500.0*/27.900, /* 14 7200.0*/28.900, /* 15 8000.0*/29.600, },
{/* 10 140.000 *//* 0 500.0*/15.000, /* 1 800.0*/17.200, /* 2 1000.0*/20.800, /* 3 1500.0*/24.200, /* 4 1800.0*/26.900, /* 5 2300.0*/26.800, /* 6 2900.0*/25.600, /* 7 3400.0*/24.900, /* 8 3900.0*/24.100, /* 9 4300.0*/24.000, /* 10 4800.0*/24.000, /* 11 5300.0*/24.100, /* 12 5900.0*/24.800, /* 13 6500.0*/24.900, /* 14 7200.0*/25.900, /* 15 8000.0*/24.700, },
{/* 11 160.000 *//* 0 500.0*/13.000, /* 1 800.0*/15.200, /* 2 1000.0*/18.700, /* 3 1500.0*/22.000, /* 4 1800.0*/22.800, /* 5 2300.0*/22.200, /* 6 2900.0*/21.100, /* 7 3400.0*/19.800, /* 8 3900.0*/18.900, /* 9 4300.0*/18.800, /* 10 4800.0*/18.800, /* 11 5300.0*/18.900, /* 12 5900.0*/19.700, /* 13 6500.0*/20.200, /* 14 7200.0*/20.600, /* 15 8000.0*/21.400, },
{/* 12 180.000 *//* 0 500.0*/13.000, /* 1 800.0*/15.200, /* 2 1000.0*/17.300, /* 3 1500.0*/19.300, /* 4 1800.0*/21.200, /* 5 2300.0*/21.300, /* 6 2900.0*/20.400, /* 7 3400.0*/18.700, /* 8 3900.0*/16.300, /* 9 4300.0*/16.300, /* 10 4800.0*/16.900, /* 11 5300.0*/17.200, /* 12 5900.0*/17.200, /* 13 6500.0*/17.500, /* 14 7200.0*/17.700, /* 15 8000.0*/17.700, },
{/* 13 200.000 *//* 0 500.0*/14.100, /* 1 800.0*/15.100, /* 2 1000.0*/16.400, /* 3 1500.0*/18.000, /* 4 1800.0*/19.800, /* 5 2300.0*/20.300, /* 6 2900.0*/19.500, /* 7 3400.0*/17.500, /* 8 3900.0*/14.900, /* 9 4300.0*/15.100, /* 10 4800.0*/15.800, /* 11 5300.0*/16.200, /* 12 5900.0*/16.300, /* 13 6500.0*/16.600, /* 14 7200.0*/16.700, /* 15 8000.0*/16.800, },
{/* 14 220.000 *//* 0 500.0*/15.000, /* 1 800.0*/15.000, /* 2 1000.0*/15.700, /* 3 1500.0*/16.900, /* 4 1800.0*/18.600, /* 5 2300.0*/19.200, /* 6 2900.0*/18.300, /* 7 3400.0*/16.100, /* 8 3900.0*/14.100, /* 9 4300.0*/14.300, /* 10 4800.0*/15.000, /* 11 5300.0*/15.200, /* 12 5900.0*/15.400, /* 13 6500.0*/15.600, /* 14 7200.0*/15.600, /* 15 8000.0*/15.600, },
{/* 15 250.000 *//* 0 500.0*/15.000, /* 1 800.0*/15.000, /* 2 1000.0*/15.000, /* 3 1500.0*/15.600, /* 4 1800.0*/17.800, /* 5 2300.0*/18.000, /* 6 2900.0*/16.800, /* 7 3400.0*/14.700, /* 8 3900.0*/13.300, /* 9 4300.0*/13.600, /* 10 4800.0*/14.000, /* 11 5300.0*/13.800, /* 12 5900.0*/13.900, /* 13 6500.0*/13.700, /* 14 7200.0*/13.400, /* 15 8000.0*/13.400, }
};
/* Generated by TS2C on Sun Aug 02 11:58:01 EDT 2020*/
void miataNA_setIgnitionTable(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
MEMCPY(config->ignitionLoadBins, hardCodedignitionLoadBins);
MEMCPY(config->ignitionRpmBins, hardCodedignitionRpmBins);
MEMCPY(config->ignitionTable, hardCodedignitionTable);
}

View File

@ -0,0 +1,17 @@
/*
* @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);
void miataNA_setIgnitionTable(DECLARE_CONFIG_PARAMETER_SIGNATURE);

View File

@ -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

View File

@ -119,7 +119,7 @@ static efitimems_t previousWriteReportMs = 0;
static ts_channel_s tsChannel;
// this thread wants a bit extra stack
static THD_WORKING_AREA(tunerstudioThreadStack, 3 * UTILITY_THREAD_STACK_SIZE);
static THD_WORKING_AREA(tunerstudioThreadStack, CONNECTIVITY_THREAD_STACK);
static void resetTs(void) {
memset(&tsState, 0, sizeof(tsState));
@ -490,6 +490,8 @@ void runBinaryProtocolLoop(ts_channel_s *tsChannel) {
int wasReady = false;
while (true) {
validateStack("communication", STACK_USAGE_COMMUNICATION, 128);
int isReady = sr5IsReady(tsChannel);
if (!isReady) {
chThdSleepMilliseconds(10);

View File

@ -29,6 +29,8 @@ typedef struct {
extern tunerstudio_counters_s tsState;
#define CONNECTIVITY_THREAD_STACK (2 * UTILITY_THREAD_STACK_SIZE)
/**
* handle non CRC wrapped command
*/

View File

@ -252,7 +252,7 @@ bool isCommandLineConsoleReady(void) {
#if !defined(EFI_CONSOLE_NO_THREAD)
static THD_WORKING_AREA(consoleThreadStack, 3 * UTILITY_THREAD_STACK_SIZE);
static THD_WORKING_AREA(consoleThreadStack, CONNECTIVITY_THREAD_STACK);
static THD_FUNCTION(consoleThreadEntryPoint, arg) {
(void) arg;
chRegSetThreadName("console thread");

View File

@ -21,7 +21,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "global.h"
#include "globalaccess.h"
#include "os_access.h"
#include "eficonsole.h"
#include "console_io.h"
@ -118,19 +118,28 @@ static void sayHello(void) {
chThdSleepMilliseconds(5);
}
void validateStack(const char*msg, obd_code_e code, int desiredStackUnusedSize) {
#if CH_DBG_THREADS_PROFILING && CH_DBG_FILL_THREADS
static uintptr_t CountFreeStackSpace(const void* wabase)
{
int unusedStack = CountFreeStackSpace(chThdGetSelfX()->wabase);
if (unusedStack < desiredStackUnusedSize) {
warning(code, "Stack low on %s: %d", msg, unusedStack);
}
#endif
}
#if CH_DBG_THREADS_PROFILING && CH_DBG_FILL_THREADS
int CountFreeStackSpace(const void* wabase) {
const uint8_t* stackBase = reinterpret_cast<const uint8_t*>(wabase);
const uint8_t* stackUsage = stackBase;
// thread stacks are filled with 0x55
// thread stacks are filled with CH_DBG_STACK_FILL_VALUE
// find out where that ends - that's the last thing we needed on the stack
while(*stackUsage == 0x55) {
while (*stackUsage == CH_DBG_STACK_FILL_VALUE) {
stackUsage++;
}
return stackUsage - stackBase;
return (int)(stackUsage - stackBase);
}
#endif
@ -144,15 +153,15 @@ static void cmd_threads(void) {
scheduleMsg(&logger, "name\twabase\ttime\tfree stack");
while(tp) {
uintptr_t freeBytes = CountFreeStackSpace(tp->wabase);
scheduleMsg(&logger, "%s\t%08x\t%lu\t%lu", tp->name, tp->wabase, tp->time, freeBytes);
while (tp) {
int freeBytes = CountFreeStackSpace(tp->wabase);
scheduleMsg(&logger, "%s\t%08x\t%lu\t%d", tp->name, tp->wabase, tp->time, freeBytes);
tp = chRegNextThread(tp);
}
uintptr_t isrSpace = CountFreeStackSpace(reinterpret_cast<void*>(0x20000000));
scheduleMsg(&logger, "isr\t0\t0\t%lu", isrSpace);
int isrSpace = CountFreeStackSpace(reinterpret_cast<void*>(0x20000000));
scheduleMsg(&logger, "isr\t0\t0\t%d", isrSpace);
#else // CH_DBG_THREADS_PROFILING && CH_DBG_FILL_THREADS

View File

@ -2089,6 +2089,12 @@ typedef enum {
CUSTOM_ERR_6729 = 6729,
STACK_USAGE_COMMUNICATION = 6900,
STACK_USAGE_MIL = 6901,
STACK_USAGE_BENCH = 6902,
STACK_USAGE_STATUS = 6903,
STACK_USAGE_4 = 6904,
// 8000-8050 logging errors
CUSTOM_OBD_MMC_ERROR = 8000,

View File

@ -26,6 +26,7 @@
#if EFI_ENGINE_CONTROL
#if !EFI_UNIT_TEST
#include "os_access.h"
#include "flash_main.h"
#include "bench_test.h"
#include "io_pins.h"
@ -213,6 +214,8 @@ private:
UNUSED(nowNt);
setPeriod(50 /* ms */);
validateStack("Bench", STACK_USAGE_BENCH, 128);
// naive inter-thread communication - waiting for a flag
if (isBenchTestPending) {
isBenchTestPending = false;

View File

@ -1,2 +1,2 @@
#pragma once
#define VCS_DATE 20200801
#define VCS_DATE 20200802

View File

@ -32,6 +32,7 @@
#include "malfunction_central.h"
#include "malfunction_indicator.h"
#include "efi_gpio.h"
#include "os_access.h"
#include "periodic_thread_controller.h"
#define TEST_MIL_CODE FALSE
@ -87,6 +88,8 @@ private:
void PeriodicTask(efitick_t nowNt) override {
UNUSED(nowNt);
validateStack("MIL", STACK_USAGE_MIL, 128);
if (nowNt - engine->triggerCentral.triggerState.mostRecentSyncTime < MS2NT(500)) {
enginePins.checkEnginePin.setValue(1);
chThdSleepMilliseconds(500);

View File

@ -92,3 +92,11 @@
#define EXPECTED_REMAINING_STACK 128
#endif /* __cplusplus */
/*
* Stack debugging
* See also getMaxUsedStack()
*/
EXTERNC int getRemainingStack(thread_t *otp);
int CountFreeStackSpace(const void* wabase);
void validateStack(const char*msg, obd_code_e code, int stackUnusedSize);

View File

@ -50,12 +50,15 @@ typedef unsigned int time_t;
* project-wide default thread stack size
* See also PORT_INT_REQUIRED_STACK
* See getRemainingStack()
* See getMaxUsedStack()
* See getMaxUsedStack() and CountFreeStackSpace()
* See "threadsinfo" command cmd_threads
*/
#ifndef UTILITY_THREAD_STACK_SIZE
#define UTILITY_THREAD_STACK_SIZE 400
#endif /* UTILITY_THREAD_STACK_SIZE */
#define getCurrentRemainingStack() getRemainingStack(chThdGetSelfX())
#define EFI_ERROR_CODE 0xffffffff
#if EFI_USE_CCM && defined __GNUC__
@ -93,9 +96,6 @@ typedef unsigned int time_t;
#define CCM_OPTIONAL
#endif /* EFI_USE_CCM */
#define getCurrentRemainingStack() getRemainingStack(chThdGetSelfX())
// 168 ticks in microsecond in case of 168MHz 407
#define US_TO_NT_MULTIPLIER (CORE_CLOCK / 1000000)

View File

@ -1,5 +1,5 @@
/*
* os_access.h
* @file os_access.h
*
* OS access is not part of global.h in order to help separate synchronous code from asynchronous
*
@ -24,10 +24,4 @@ extern "C"
#include "io_pins.h"
/*
* Stack debugging
* See also getMaxUsedStack()
*/
EXTERNC int getRemainingStack(thread_t *otp);
#define HAS_OS_ACCESS

View File

@ -30,7 +30,7 @@
*
*/
#include "global.h"
#include "globalaccess.h"
#if ! EFI_UNIT_TEST
#include "os_access.h"

View File

@ -46,6 +46,7 @@ public class BinaryProtocolServer implements BinaryProtocolCommands {
private final static boolean MOCK_SD_CARD = true;
private static final int SD_STATUS_OFFSET = 246;
private static final int FAST_TRANSFER_PACKET_SIZE = 2048;
public AtomicInteger unknownCommands = new AtomicInteger();
@ -297,22 +298,20 @@ public class BinaryProtocolServer implements BinaryProtocolCommands {
int suffix = bb.getShort();
log.info("TS_SD: fetch data command blockNumber=" + blockNumber + ", requesting=" + suffix);
byte[] response = new byte[1 + 2 + 2048];
response[0] = TS_RESPONSE_OK;
response[1] = payload[3];
response[2] = payload[4];
// fake data
response[3] = payload[3];
response[4] = payload[4];
File f = new File(BinaryProtocolServer.TEST_FILE);
FileInputStream fis = new FileInputStream(f);
int size = (int) f.length();
int offset = blockNumber * 2048;
int len = Math.min(size - offset, 2048);
int offset = blockNumber * FAST_TRANSFER_PACKET_SIZE;
int len = Math.max(0, Math.min(size - offset, FAST_TRANSFER_PACKET_SIZE));
byte[] response = new byte[1 + 2 + len];
response[0] = TS_RESPONSE_OK;
response[1] = payload[3];
response[2] = payload[4];
if (len > 0) {
fis.skip(offset);

View File

@ -27,7 +27,7 @@ public class CurveData {
static CurveData processCurve(String msqFileName, String loadSectionName, IniFileModel model, BufferedWriter w) throws IOException {
ArrayIniField field = (ArrayIniField) model.allIniFields.get(loadSectionName);
int curveSize = field.getRows();
BufferedReader r = TS2C.readAndScroll(msqFileName, loadSectionName);
BufferedReader r = TS2C.readAndScroll(msqFileName, loadSectionName + "\"");
float[] curve = new float[curveSize];
readAxle(curve, r);

View File

@ -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");
}

View File

@ -16,6 +16,10 @@ public class TS2CRunner {
TS2C.main(new String[]{tuneFileName, "crankingFuelBins", "crankingFuelCoef"});
TS2C.main(new String[]{tuneFileName, "iacCoastingBins", "iacCoasting"});
TS2C.main(new String[]{tuneFileName, "cltFuelCorrBins", "cltFuelCorr"});
TS2C.main(new String[]{tuneFileName, "veLoadBins", "veRpmBins", "veTable"});
TS2C.main(new String[]{tuneFileName, "ignitionLoadBins", "ignitionRpmBins", "ignitionTable"});
// TS2C.main(new String[]{tuneFileName, "afrLoadBins", "afrRpmBins", "afrTable"});
// TS2C.main(new String[]{tuneFileName, "fuelLoadBins", "fuelRpmBins", "fuelTable"});