auto-sync

This commit is contained in:
rusEfi 2016-01-09 23:01:50 -05:00
parent 719aa333f0
commit 04eade6333
5 changed files with 964 additions and 35 deletions

View File

@ -1,5 +1,7 @@
package com.rusefi.autotune;
import com.rusefi.config.Fields;
import java.util.Collection;
/**
@ -7,6 +9,9 @@ import java.util.Collection;
* (c) Andrey Belomutskiy 2013-2016
*/
public class FuelAutoTune {
// todo: eliminate this
// Fields.FUEL_RPM_COUNT
// Fields.FUEL_LOAD_COUNT
private static final int SIZE = 16;
private static boolean isLogEnabled() {
@ -18,21 +23,25 @@ public class FuelAutoTune {
public static class stDataOnline {
public final double AFR;
private final int rpm;
private final double engineLoad;
int rpmIndex;
int engineLoadIndex;
public stDataOnline(double AFR, int rpm, double engineLoad) {
public stDataOnline(double AFR, int rpmIndex, int engineLoadIndex) {
this.AFR = AFR;
this.rpm = rpm;
this.engineLoad = engineLoad;
this.rpmIndex = rpmIndex;
this.engineLoadIndex = engineLoadIndex;
}
public static stDataOnline valueOf(double AFR, int rpm, double engineLoad) {
return new stDataOnline(AFR, (int) (rpm / 7000.0 * SIZE), (int) (engineLoad / 120.0 * SIZE));
}
int getRpmIndex() {
return (int) (rpm / 7000.0 * SIZE);
return rpmIndex;
}
private int getEngineLoadIndex() {
return (int) (engineLoad / 120.0 * SIZE);
return (int) engineLoadIndex;
}
public int PRESS_RT_32() {
@ -45,7 +54,6 @@ public class FuelAutoTune {
}
public static class Result {
private final double[][] kgbcRES;
public Result(double[][] kgbcRES) {
@ -58,11 +66,11 @@ public class FuelAutoTune {
}
// void MainWindow::calckGBC(double STEP)
public static Result process(boolean smooth, Collection<stDataOnline> dataECU, double STEP) {
public static Result process(boolean smooth, Collection<stDataOnline> dataECU, double STEP, double targetAFR) {
double kgbcSQ[][] = new double[SIZE][SIZE];
double kgbcSQsum = 0;
double kgbcSQsumLast = 0;
double minSQ, e, g;
double kgbcSQsumLast;
double minSQ;
double step;
double minSQtotal = 1e+15;
double kgbcSQsumLastTotal = 1e+16;
@ -72,18 +80,18 @@ public class FuelAutoTune {
// let's could how many data points we have for each cell
int bkGBC[][] = new int[SIZE][SIZE];
int bkGBC[][] = new int[Fields.FUEL_LOAD_COUNT][Fields.FUEL_RPM_COUNT];
for (stDataOnline data : dataECU) {
bkGBC[data.PRESS_RT_32()][data.RPM_RT_32()]++;
}
// todo: add a comment what is this?
double kgbcRES[][] = new double[SIZE][SIZE];
double kgbcINIT[][] = new double[SIZE][SIZE];
double kgbcRES[][] = new double[Fields.FUEL_LOAD_COUNT][Fields.FUEL_RPM_COUNT];
double kgbcINIT[][] = new double[Fields.FUEL_LOAD_COUNT][Fields.FUEL_RPM_COUNT];
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
kgbcINIT[i][j] = 1;
kgbcRES[i][j] = 1;
for (int engineLoadIndex = 0; engineLoadIndex < Fields.FUEL_LOAD_COUNT; engineLoadIndex++) {
for (int rpmIndex = 0; rpmIndex < Fields.FUEL_RPM_COUNT; rpmIndex++) {
kgbcINIT[engineLoadIndex][rpmIndex] = 1;
kgbcRES[engineLoadIndex][rpmIndex] = 1;
}
}
// double addGbcTwatRES[] = new double[TEMP_CORR];
@ -136,7 +144,7 @@ public class FuelAutoTune {
}
kgbcSQsumLast = kgbcSQsum;
countDeviation(dataECU, kgbcSQ, kgbcRES, kgbcINIT, r, c);
countDeviation(dataECU, kgbcSQ, kgbcRES, kgbcINIT, targetAFR);
kgbcSQsum = sumArray(kgbcSQ);
@ -182,9 +190,8 @@ public class FuelAutoTune {
}
}
private static void countDeviation(Collection<stDataOnline> dataECU, double[][] kgbcSQ, double[][] kgbcRES, double[][] kgbcINIT, int r, int c) {
private static void countDeviation(Collection<stDataOnline> dataECU, double[][] kgbcSQ, double[][] kgbcRES, double[][] kgbcINIT, double targetAFR) {
for (stDataOnline dataPoint : dataECU) {
double targetAFR = 13.0; // todo: target AFR? is this target AFR or not?
double corrInit = 1; // addGbcTwatINIT_190[dataPoint.twat + 40];
double corrRes = 1; //addGbcTwatRES_190[dataPoint.twat + 40];
double tpsCorrInit = 1; //ktgbcINIT[dataPoint.THR_RT_16][dataPoint.RPM_RT_32()];

View File

@ -15,31 +15,31 @@ public class FuelAutoTuneTest {
@Test
public void testAutoTune() {
List<FuelAutoTune.stDataOnline> dataPoints = new ArrayList<>();
dataPoints.add(new FuelAutoTune.stDataOnline(13, 1200, 80));
dataPoints.add(FuelAutoTune.stDataOnline.valueOf(13, 1200, 80));
{
FuelAutoTune.Result r = FuelAutoTune.process(false, dataPoints, 0.1);
FuelAutoTune.Result r = FuelAutoTune.process(false, dataPoints, 0.1, 13);
printNotDefault(r.getKgbcRES(), 1);
}
dataPoints.add(new FuelAutoTune.stDataOnline(13, 1200, 80));
dataPoints.add(new FuelAutoTune.stDataOnline(14, 1300, 60));
dataPoints.add(new FuelAutoTune.stDataOnline(15, 1400, 70));
dataPoints.add(new FuelAutoTune.stDataOnline(16, 1500, 90));
dataPoints.add(FuelAutoTune.stDataOnline.valueOf(13, 1200, 80));
dataPoints.add(FuelAutoTune.stDataOnline.valueOf(14, 1300, 60));
dataPoints.add(FuelAutoTune.stDataOnline.valueOf(15, 1400, 70));
dataPoints.add(FuelAutoTune.stDataOnline.valueOf(16, 1500, 90));
for (int i = 0; i < 2000; i++)
dataPoints.add(new FuelAutoTune.stDataOnline(16, 1500 + i, 90));
dataPoints.add(FuelAutoTune.stDataOnline.valueOf(16, 1500 + i, 90));
{
FuelAutoTune.Result r = FuelAutoTune.process(false, dataPoints, 0.01);
FuelAutoTune.Result r = FuelAutoTune.process(false, dataPoints, 0.01, 13);
printNotDefault(r.getKgbcRES(), 1);
}
for (int i = 0; i < 2000; i++)
dataPoints.add(new FuelAutoTune.stDataOnline(15, 1500 + i, 90));
dataPoints.add(FuelAutoTune.stDataOnline.valueOf(15, 1500 + i, 90));
{
FuelAutoTune.Result r = FuelAutoTune.process(false, dataPoints, 0.01);
FuelAutoTune.Result r = FuelAutoTune.process(false, dataPoints, 0.01, 13);
printNotDefault(r.getKgbcRES(), 1);
}

View File

@ -1,7 +1,804 @@
package com.rusefi.config;
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Jan 07 13:56:04 EST 2016
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Jan 09 22:06:56 EST 2016
public class Fields {
public static final int LE_COMMAND_LENGTH = 200;
public static final int TS_FILE_VERSION = 20151201;
public static final int MAP_ANGLE_SIZE = 8;
public static final int MAP_WINDOW_SIZE = 8;
public static final int CLT_CURVE_SIZE = 16;
public static final int ENGINE_NOISE_CURVE_SIZE = 8;
public static final int IAT_CURVE_SIZE = 16;
public static final int VBAT_INJECTOR_CURVE_SIZE = 8;
public static final int DWELL_CURVE_SIZE = 8;
public static final int CRANKING_CURVE_SIZE = 8;
public static final int IGN_LOAD_COUNT = 16;
public static final int IGN_RPM_COUNT = 16;
public static final int INJECTION_PIN_COUNT = 12;
public static final int IGNITION_PIN_COUNT = 12;
public static final int EGT_CHANNEL_COUNT = 8;
public static final int JOYSTICK_PIN_COUNT = 5;
public static final int DIGIPOT_COUNT = 4;
public static final int HW_MAX_ADC_INDEX = 16;
public static final int TRIGGER_SIMULATOR_PIN_COUNT = 3;
public static final int LOGIC_ANALYZER_CHANNEL_COUNT = 4;
public static final int LE_COMMAND_COUNT = 16;
public static final int FUEL_RPM_COUNT = 16;
public static final int FUEL_LOAD_COUNT = 16;
public static final int BARO_CORR_SIZE = 4;
public static final int MAF_DECODING_COUNT = 256;
public static final int engineConfiguration_offset = 0;
public static final int engineConfiguration_offset_hex = 0;
public static final int engineType_offset = 0;
public static final int engineType_offset_hex = 0;
public static final int unusedOffset4_offset = 4;
public static final int unusedOffset4_offset_hex = 4;
public static final int injector_offset = 8;
public static final int injector_offset_hex = 8;
public static final int injector_flow_offset = 8;
public static final int injector_flow_offset_hex = 8;
public static final int injector_lag_offset = 12;
public static final int injector_battLagCorrBins_offset = 16;
public static final int injector_battLagCorrBins_offset_hex = 10;
public static final int injector_battLagCorr_offset = 48;
public static final int injector_battLagCorr_offset_hex = 30;
public static final int directSelfStimulation_offset = 80;
public static final int directSelfStimulation_offset_hex = 50;
public static final int tpsMin_offset = 84;
public static final int tpsMin_offset_hex = 54;
public static final int tpsMax_offset = 86;
public static final int tpsMax_offset_hex = 56;
public static final int tpsErrorDetectionTooLow_offset = 88;
public static final int tpsErrorDetectionTooLow_offset_hex = 58;
public static final int tpsErrorDetectionTooHigh_offset = 90;
public static final int cranking_offset = 92;
public static final int cranking_baseFuel_offset = 92;
public static final int cranking_rpm_offset = 96;
public static final int cranking_rpm_offset_hex = 60;
public static final int cranking_alignmentFill_offset = 98;
public static final int cranking_alignmentFill_offset_hex = 62;
public static final int primingSquirtDurationMs_offset = 100;
public static final int primingSquirtDurationMs_offset_hex = 64;
public static final int ignitionDwellForCrankingMs_offset = 104;
public static final int ignitionDwellForCrankingMs_offset_hex = 68;
public static final int crankingChargeAngle_offset = 108;
public static final int map_offset = 112;
public static final int map_offset_hex = 70;
public static final int map_samplingAngleBins_offset = 112;
public static final int map_samplingAngleBins_offset_hex = 70;
public static final int map_samplingAngle_offset = 144;
public static final int map_samplingAngle_offset_hex = 90;
public static final int map_samplingWindowBins_offset = 176;
public static final int map_samplingWindow_offset = 208;
public static final int map_sensor_offset = 240;
public static final int map_sensor_valueAt0_offset = 240;
public static final int map_sensor_valueAt5_offset = 244;
public static final int map_sensor_type_offset = 248;
public static final int map_sensor_hwChannel_offset = 252;
public static final int clt_offset = 256;
public static final int clt_offset_hex = 100;
public static final int clt_config_offset = 256;
public static final int clt_config_offset_hex = 100;
public static final int clt_tempC_1_offset = 256;
public static final int clt_tempC_1_offset_hex = 100;
public static final int clt_tempC_2_offset = 260;
public static final int clt_tempC_2_offset_hex = 104;
public static final int clt_tempC_3_offset = 264;
public static final int clt_tempC_3_offset_hex = 108;
public static final int clt_resistance_1_offset = 268;
public static final int clt_resistance_2_offset = 272;
public static final int clt_resistance_2_offset_hex = 110;
public static final int clt_resistance_3_offset = 276;
public static final int clt_resistance_3_offset_hex = 114;
public static final int clt_bias_resistor_offset = 280;
public static final int clt_bias_resistor_offset_hex = 118;
public static final int clt_adcChannel_offset = 284;
public static final int iat_offset = 288;
public static final int iat_offset_hex = 120;
public static final int iat_config_offset = 288;
public static final int iat_config_offset_hex = 120;
public static final int iat_tempC_1_offset = 288;
public static final int iat_tempC_1_offset_hex = 120;
public static final int iat_tempC_2_offset = 292;
public static final int iat_tempC_2_offset_hex = 124;
public static final int iat_tempC_3_offset = 296;
public static final int iat_tempC_3_offset_hex = 128;
public static final int iat_resistance_1_offset = 300;
public static final int iat_resistance_2_offset = 304;
public static final int iat_resistance_2_offset_hex = 130;
public static final int iat_resistance_3_offset = 308;
public static final int iat_resistance_3_offset_hex = 134;
public static final int iat_bias_resistor_offset = 312;
public static final int iat_bias_resistor_offset_hex = 138;
public static final int iat_adcChannel_offset = 316;
public static final int step1rpm_offset = 320;
public static final int step1rpm_offset_hex = 140;
public static final int step1timing_offset = 324;
public static final int step1timing_offset_hex = 144;
public static final int hip9011PrescalerAndSDO_offset = 328;
public static final int hip9011PrescalerAndSDO_offset_hex = 148;
public static final int knockBandCustom_offset = 332;
public static final int sparkDwellBins_offset = 336;
public static final int sparkDwellBins_offset_hex = 150;
public static final int sparkDwell_offset = 368;
public static final int sparkDwell_offset_hex = 170;
public static final int specs_offset = 400;
public static final int specs_offset_hex = 190;
public static final int displacement_offset = 400;
public static final int displacement_offset_hex = 190;
public static final int cylindersCount_offset = 404;
public static final int cylindersCount_offset_hex = 194;
public static final int firingOrder_offset = 408;
public static final int firingOrder_offset_hex = 198;
public static final int cylinderBore_offset = 412;
public static final int engineCycleDuration_offset = 416;
public static final int rpmHardLimit_offset = 420;
public static final int algorithm_offset = 424;
public static final int crankingInjectionMode_offset = 428;
public static final int injectionMode_offset = 432;
public static final int injectionOffset_offset = 436;
public static final int crankingTimingAngle_offset = 440;
public static final int ignitionMode_offset = 444;
public static final int ignitionOffset_offset = 448;
public static final int timingMode_offset = 452;
public static final int fixedModeTiming_offset = 456;
public static final int globalTriggerAngleOffset_offset = 460;
public static final int analogInputDividerCoefficient_offset = 464;
public static final int vbattDividerCoeff_offset = 468;
public static final int vbattAdcChannel_offset = 472;
public static final int fanOnTemperature_offset = 476;
public static final int fanOffTemperature_offset = 480;
public static final int fuelLevelSensor_offset = 484;
public static final int vehicleSpeedCoef_offset = 488;
public static final int canNbcType_offset = 492;
public static final int canSleepPeriod_offset = 496;
public static final int operationMode_offset = 500;
public static final int displayMode_offset = 504;
public static final int logFormat_offset = 508;
public static final int firmwareVersion_offset = 512;
public static final int firmwareVersion_offset_hex = 200;
public static final int HD44780width_offset = 516;
public static final int HD44780width_offset_hex = 204;
public static final int HD44780height_offset = 520;
public static final int HD44780height_offset_hex = 208;
public static final int tpsAdcChannel_offset = 524;
public static final int overrideCrankingIgnition_offset = 528;
public static final int overrideCrankingIgnition_offset_hex = 210;
public static final int sensorChartFrequency_offset = 532;
public static final int sensorChartFrequency_offset_hex = 214;
public static final int trigger_offset = 536;
public static final int trigger_offset_hex = 218;
public static final int trigger_type_offset = 536;
public static final int trigger_type_offset_hex = 218;
public static final int trigger_customIsSynchronizationNeeded_offset = 540;
public static final int trigger_customNeedSecondTriggerInput_offset = 540;
public static final int trigger_useOnlyFirstChannel_offset = 540;
public static final int trigger_customTotalToothCount_offset = 544;
public static final int trigger_customTotalToothCount_offset_hex = 220;
public static final int trigger_customSkippedToothCount_offset = 548;
public static final int trigger_customSkippedToothCount_offset_hex = 224;
public static final int trigger_customSyncRatioFrom_offset = 552;
public static final int trigger_customSyncRatioFrom_offset_hex = 228;
public static final int trigger_customSyncRatioTo_offset = 556;
public static final int trigger_customUseRiseEdge_offset = 560;
public static final int trigger_customUseRiseEdge_offset_hex = 230;
public static final int hip9011SpiDevice_offset = 564;
public static final int hip9011SpiDevice_offset_hex = 234;
public static final int globalFuelCorrection_offset = 568;
public static final int globalFuelCorrection_offset_hex = 238;
public static final int pedalPositionMin_offset = 572;
public static final int pedalPositionMax_offset = 574;
public static final int maxKnockSubDeg_offset = 576;
public static final int maxKnockSubDeg_offset_hex = 240;
public static final int mafAdcChannel_offset = 580;
public static final int mafAdcChannel_offset_hex = 244;
public static final int afr_offset = 584;
public static final int afr_offset_hex = 248;
public static final int afr_hwChannel_offset = 584;
public static final int afr_hwChannel_offset_hex = 248;
public static final int afr_v1_offset = 588;
public static final int afr_value1_offset = 592;
public static final int afr_value1_offset_hex = 250;
public static final int afr_v2_offset = 596;
public static final int afr_v2_offset_hex = 254;
public static final int afr_value2_offset = 600;
public static final int afr_value2_offset_hex = 258;
public static final int pedalPositionChannel_offset = 604;
public static final int baroSensor_offset = 608;
public static final int baroSensor_offset_hex = 260;
public static final int baroSensor_valueAt0_offset = 608;
public static final int baroSensor_valueAt0_offset_hex = 260;
public static final int baroSensor_valueAt5_offset = 612;
public static final int baroSensor_valueAt5_offset_hex = 264;
public static final int baroSensor_type_offset = 616;
public static final int baroSensor_type_offset_hex = 268;
public static final int baroSensor_hwChannel_offset = 620;
public static final int bc_offset = 624;
public static final int bc_offset_hex = 270;
public static final int idle_offset = 624;
public static final int idle_offset_hex = 270;
public static final int idle_solenoidPin_offset = 624;
public static final int idle_solenoidPin_offset_hex = 270;
public static final int idle_solenoidPinMode_offset = 628;
public static final int idle_solenoidPinMode_offset_hex = 274;
public static final int idle_solenoidFrequency_offset = 632;
public static final int idle_solenoidFrequency_offset_hex = 278;
public static final int idle_stepperDirectionPin_offset = 636;
public static final int idle_stepperStepPin_offset = 640;
public static final int idle_stepperStepPin_offset_hex = 280;
public static final int manIdlePosition_offset = 644;
public static final int manIdlePosition_offset_hex = 284;
public static final int fuelPumpPin_offset = 648;
public static final int fuelPumpPin_offset_hex = 288;
public static final int fuelPumpPinMode_offset = 652;
public static final int injectionPins1_offset = 656;
public static final int injectionPins1_offset_hex = 290;
public static final int injectionPins2_offset = 660;
public static final int injectionPins2_offset_hex = 294;
public static final int injectionPins3_offset = 664;
public static final int injectionPins3_offset_hex = 298;
public static final int injectionPins4_offset = 668;
public static final int injectionPins5_offset = 672;
public static final int injectionPins6_offset = 676;
public static final int injectionPins7_offset = 680;
public static final int injectionPins8_offset = 684;
public static final int injectionPins9_offset = 688;
public static final int injectionPins10_offset = 692;
public static final int injectionPins11_offset = 696;
public static final int injectionPins12_offset = 700;
public static final int injectionPinMode_offset = 704;
public static final int ignitionPins1_offset = 708;
public static final int ignitionPins2_offset = 712;
public static final int ignitionPins3_offset = 716;
public static final int ignitionPins4_offset = 720;
public static final int ignitionPins5_offset = 724;
public static final int ignitionPins6_offset = 728;
public static final int ignitionPins7_offset = 732;
public static final int ignitionPins8_offset = 736;
public static final int ignitionPins9_offset = 740;
public static final int ignitionPins10_offset = 744;
public static final int ignitionPins11_offset = 748;
public static final int ignitionPins12_offset = 752;
public static final int ignitionPinMode_offset = 756;
public static final int malfunctionIndicatorPin_offset = 760;
public static final int malfunctionIndicatorPinMode_offset = 764;
public static final int fanPin_offset = 768;
public static final int fanPin_offset_hex = 300;
public static final int fanPinMode_offset = 772;
public static final int fanPinMode_offset_hex = 304;
public static final int mapFrequency0Kpa_offset = 776;
public static final int mapFrequency0Kpa_offset_hex = 308;
public static final int mapFrequency100Kpa_offset = 780;
public static final int clutchDownPin_offset = 784;
public static final int clutchDownPin_offset_hex = 310;
public static final int clutchDownPinMode_offset = 788;
public static final int clutchDownPinMode_offset_hex = 314;
public static final int alternatorControlPin_offset = 792;
public static final int alternatorControlPin_offset_hex = 318;
public static final int alternatorControlPinMode_offset = 796;
public static final int HD44780_rs_offset = 800;
public static final int HD44780_rs_offset_hex = 320;
public static final int HD44780_e_offset = 804;
public static final int HD44780_e_offset_hex = 324;
public static final int HD44780_db4_offset = 808;
public static final int HD44780_db4_offset_hex = 328;
public static final int HD44780_db5_offset = 812;
public static final int HD44780_db6_offset = 816;
public static final int HD44780_db6_offset_hex = 330;
public static final int HD44780_db7_offset = 820;
public static final int HD44780_db7_offset_hex = 334;
public static final int gps_rx_pin_offset = 824;
public static final int gps_rx_pin_offset_hex = 338;
public static final int gps_tx_pin_offset = 828;
public static final int triggerSimulatorFrequency_offset = 832;
public static final int triggerSimulatorFrequency_offset_hex = 340;
public static final int digitalPotentiometerSpiDevice_offset = 836;
public static final int digitalPotentiometerSpiDevice_offset_hex = 344;
public static final int digitalPotentiometerChipSelect1_offset = 840;
public static final int digitalPotentiometerChipSelect1_offset_hex = 348;
public static final int digitalPotentiometerChipSelect2_offset = 844;
public static final int digitalPotentiometerChipSelect3_offset = 848;
public static final int digitalPotentiometerChipSelect3_offset_hex = 350;
public static final int digitalPotentiometerChipSelect4_offset = 852;
public static final int digitalPotentiometerChipSelect4_offset_hex = 354;
public static final int etbDirectionPin1_offset = 856;
public static final int etbDirectionPin1_offset_hex = 358;
public static final int etbDirectionPin2_offset = 860;
public static final int etbControlPin1_offset = 864;
public static final int etbControlPin1_offset_hex = 360;
public static final int etbControlPin2_offset = 868;
public static final int etbControlPin2_offset_hex = 364;
public static final int electronicThrottlePin1Mode_offset = 872;
public static final int electronicThrottlePin1Mode_offset_hex = 368;
public static final int unused2_offset = 876;
public static final int wboHeaterPin_offset = 884;
public static final int wboHeaterPin_offset_hex = 374;
public static final int wboPumpPin_offset = 888;
public static final int wboPumpPin_offset_hex = 378;
public static final int fuelLevelEmptyTankVoltage_offset = 892;
public static final int fuelLevelFullTankVoltage_offset = 896;
public static final int fuelLevelFullTankVoltage_offset_hex = 380;
public static final int afr_type_offset = 900;
public static final int afr_type_offset_hex = 384;
public static final int etbDT_offset = 904;
public static final int etbDT_offset_hex = 388;
public static final int hip9011CsPinMode_offset = 908;
public static final int tachOutputPin_offset = 912;
public static final int tachOutputPin_offset_hex = 390;
public static final int tachOutputPinMode_offset = 916;
public static final int tachOutputPinMode_offset_hex = 394;
public static final int triggerInputPins1_offset = 920;
public static final int triggerInputPins1_offset_hex = 398;
public static final int triggerInputPins2_offset = 924;
public static final int triggerInputPins3_offset = 928;
public static final int mainRelayPin_offset = 932;
public static final int idleThreadPeriod_offset = 936;
public static final int consoleLoopPeriod_offset = 940;
public static final int lcdThreadPeriod_offset = 944;
public static final int sdCardCsPin_offset = 948;
public static final int generalPeriodicThreadPeriod_offset = 952;
public static final int tunerStudioSerialSpeed_offset = 956;
public static final int boardTestModeJumperPin_offset = 960;
public static final int canDeviceMode_offset = 964;
public static final int canTxPin_offset = 968;
public static final int canRxPin_offset = 972;
public static final int triggerSimulatorPins1_offset = 976;
public static final int triggerSimulatorPins2_offset = 980;
public static final int triggerSimulatorPins3_offset = 984;
public static final int triggerSimulatorPinModes1_offset = 988;
public static final int triggerSimulatorPinModes2_offset = 992;
public static final int triggerSimulatorPinModes3_offset = 996;
public static final int o2heaterPin_offset = 1000;
public static final int o2heaterPinModeTodO_offset = 1004;
public static final int is_enabled_spi_1_offset = 1008;
public static final int is_enabled_spi_2_offset = 1008;
public static final int is_enabled_spi_3_offset = 1008;
public static final int isSdCardEnabled_offset = 1008;
public static final int isFastAdcEnabled_offset = 1008;
public static final int isEngineControlEnabled_offset = 1008;
public static final int isHip9011Enabled_offset = 1008;
public static final int isVerboseAlternator_offset = 1008;
public static final int useSerialPort_offset = 1008;
public static final int useStepperIdle_offset = 1008;
public static final int enabledStep1Limiter_offset = 1008;
public static final int useTpicAdvancedMode_offset = 1008;
public static final int useLcdScreen_offset = 1008;
public static final int logicAnalyzerPins1_offset = 1012;
public static final int logicAnalyzerPins2_offset = 1016;
public static final int logicAnalyzerPins3_offset = 1020;
public static final int logicAnalyzerPins4_offset = 1024;
public static final int logicAnalyzerPins4_offset_hex = 400;
public static final int logicAnalyzerMode_offset = 1028;
public static final int logicAnalyzerMode_offset_hex = 404;
public static final int unrealisticRpmThreashold_offset = 1032;
public static final int unrealisticRpmThreashold_offset_hex = 408;
public static final int mainRelayPinMode_offset = 1036;
public static final int max31855_cs1_offset = 1040;
public static final int max31855_cs1_offset_hex = 410;
public static final int max31855_cs2_offset = 1044;
public static final int max31855_cs2_offset_hex = 414;
public static final int max31855_cs3_offset = 1048;
public static final int max31855_cs3_offset_hex = 418;
public static final int max31855_cs4_offset = 1052;
public static final int max31855_cs5_offset = 1056;
public static final int max31855_cs5_offset_hex = 420;
public static final int max31855_cs6_offset = 1060;
public static final int max31855_cs6_offset_hex = 424;
public static final int max31855_cs7_offset = 1064;
public static final int max31855_cs7_offset_hex = 428;
public static final int max31855_cs8_offset = 1068;
public static final int max31855spiDevice_offset = 1072;
public static final int max31855spiDevice_offset_hex = 430;
public static final int fsioPins1_offset = 1076;
public static final int fsioPins1_offset_hex = 434;
public static final int fsioPins2_offset = 1080;
public static final int fsioPins2_offset_hex = 438;
public static final int fsioPins3_offset = 1084;
public static final int fsioPins4_offset = 1088;
public static final int fsioPins4_offset_hex = 440;
public static final int fsioPins5_offset = 1092;
public static final int fsioPins5_offset_hex = 444;
public static final int fsioPins6_offset = 1096;
public static final int fsioPins6_offset_hex = 448;
public static final int fsioPins7_offset = 1100;
public static final int fsioPins8_offset = 1104;
public static final int fsioPins8_offset_hex = 450;
public static final int fsioPins9_offset = 1108;
public static final int fsioPins9_offset_hex = 454;
public static final int fsioPins10_offset = 1112;
public static final int fsioPins10_offset_hex = 458;
public static final int fsioPins11_offset = 1116;
public static final int fsioPins12_offset = 1120;
public static final int fsioPins12_offset_hex = 460;
public static final int fsioPins13_offset = 1124;
public static final int fsioPins13_offset_hex = 464;
public static final int fsioPins14_offset = 1128;
public static final int fsioPins14_offset_hex = 468;
public static final int fsioPins15_offset = 1132;
public static final int fsioPins16_offset = 1136;
public static final int fsioPins16_offset_hex = 470;
public static final int gpioPinModes1_offset = 1140;
public static final int gpioPinModes1_offset_hex = 474;
public static final int gpioPinModes2_offset = 1144;
public static final int gpioPinModes2_offset_hex = 478;
public static final int gpioPinModes3_offset = 1148;
public static final int gpioPinModes4_offset = 1152;
public static final int gpioPinModes4_offset_hex = 480;
public static final int gpioPinModes5_offset = 1156;
public static final int gpioPinModes5_offset_hex = 484;
public static final int gpioPinModes6_offset = 1160;
public static final int gpioPinModes6_offset_hex = 488;
public static final int gpioPinModes7_offset = 1164;
public static final int gpioPinModes8_offset = 1168;
public static final int gpioPinModes8_offset_hex = 490;
public static final int gpioPinModes9_offset = 1172;
public static final int gpioPinModes9_offset_hex = 494;
public static final int gpioPinModes10_offset = 1176;
public static final int gpioPinModes10_offset_hex = 498;
public static final int gpioPinModes11_offset = 1180;
public static final int gpioPinModes12_offset = 1184;
public static final int gpioPinModes13_offset = 1188;
public static final int gpioPinModes14_offset = 1192;
public static final int gpioPinModes15_offset = 1196;
public static final int gpioPinModes16_offset = 1200;
public static final int joystickPins1_offset = 1204;
public static final int joystickPins2_offset = 1208;
public static final int joystickPins3_offset = 1212;
public static final int joystickPins4_offset = 1216;
public static final int joystickPins5_offset = 1220;
public static final int triggerErrorPin_offset = 1224;
public static final int triggerErrorPinMode_offset = 1228;
public static final int acRelayPin_offset = 1232;
public static final int acRelayPinMode_offset = 1236;
public static final int fsioFrequency1_offset = 1240;
public static final int fsioFrequency2_offset = 1242;
public static final int fsioFrequency3_offset = 1244;
public static final int fsioFrequency4_offset = 1246;
public static final int fsioFrequency5_offset = 1248;
public static final int fsioFrequency6_offset = 1250;
public static final int fsioFrequency7_offset = 1252;
public static final int fsioFrequency8_offset = 1254;
public static final int fsioFrequency9_offset = 1256;
public static final int fsioFrequency10_offset = 1258;
public static final int fsioFrequency11_offset = 1260;
public static final int fsioFrequency12_offset = 1262;
public static final int fsioFrequency13_offset = 1264;
public static final int fsioFrequency14_offset = 1266;
public static final int fsioFrequency15_offset = 1268;
public static final int fsioFrequency16_offset = 1270;
public static final int hip9011CsPin_offset = 1272;
public static final int hip9011IntHoldPin_offset = 1276;
public static final int hip9011IntHoldPinMode_offset = 1280;
public static final int hip9011IntHoldPinMode_offset_hex = 500;
public static final int fsio_setting1_offset = 1284;
public static final int fsio_setting1_offset_hex = 504;
public static final int fsio_setting2_offset = 1288;
public static final int fsio_setting2_offset_hex = 508;
public static final int fsio_setting3_offset = 1292;
public static final int fsio_setting4_offset = 1296;
public static final int fsio_setting4_offset_hex = 510;
public static final int fsio_setting5_offset = 1300;
public static final int fsio_setting5_offset_hex = 514;
public static final int fsio_setting6_offset = 1304;
public static final int fsio_setting6_offset_hex = 518;
public static final int fsio_setting7_offset = 1308;
public static final int fsio_setting8_offset = 1312;
public static final int fsio_setting8_offset_hex = 520;
public static final int fsio_setting9_offset = 1316;
public static final int fsio_setting9_offset_hex = 524;
public static final int fsio_setting10_offset = 1320;
public static final int fsio_setting10_offset_hex = 528;
public static final int fsio_setting11_offset = 1324;
public static final int fsio_setting12_offset = 1328;
public static final int fsio_setting12_offset_hex = 530;
public static final int fsio_setting13_offset = 1332;
public static final int fsio_setting13_offset_hex = 534;
public static final int fsio_setting14_offset = 1336;
public static final int fsio_setting14_offset_hex = 538;
public static final int fsio_setting15_offset = 1340;
public static final int fsio_setting16_offset = 1344;
public static final int fsio_setting16_offset_hex = 540;
public static final int spi1mosiPin_offset = 1348;
public static final int spi1mosiPin_offset_hex = 544;
public static final int spi1misoPin_offset = 1352;
public static final int spi1misoPin_offset_hex = 548;
public static final int spi1sckPin_offset = 1356;
public static final int spi2mosiPin_offset = 1360;
public static final int spi2mosiPin_offset_hex = 550;
public static final int spi2misoPin_offset = 1364;
public static final int spi2misoPin_offset_hex = 554;
public static final int spi2sckPin_offset = 1368;
public static final int spi2sckPin_offset_hex = 558;
public static final int spi3mosiPin_offset = 1372;
public static final int spi3misoPin_offset = 1376;
public static final int spi3misoPin_offset_hex = 560;
public static final int spi3sckPin_offset = 1380;
public static final int spi3sckPin_offset_hex = 564;
public static final int hip9011Gain_offset = 1384;
public static final int hip9011Gain_offset_hex = 568;
public static final int joystickCenterPin_offset = 1388;
public static final int joystickAPin_offset = 1392;
public static final int joystickAPin_offset_hex = 570;
public static final int joystickBPin_offset = 1396;
public static final int joystickBPin_offset_hex = 574;
public static final int joystickCPin_offset = 1400;
public static final int joystickCPin_offset_hex = 578;
public static final int joystickDPin_offset = 1404;
public static final int sensorChartMode_offset = 1408;
public static final int sensorChartMode_offset_hex = 580;
public static final int mafSensorType_offset = 1412;
public static final int mafSensorType_offset_hex = 584;
public static final int vehicleSpeedSensorInputPin_offset = 1416;
public static final int vehicleSpeedSensorInputPin_offset_hex = 588;
public static final int clutchUpPin_offset = 1420;
public static final int clutchUpPinMode_offset = 1424;
public static final int clutchUpPinMode_offset_hex = 590;
public static final int fsioDigitalInputs1_offset = 1428;
public static final int fsioDigitalInputs1_offset_hex = 594;
public static final int fsioDigitalInputs2_offset = 1432;
public static final int fsioDigitalInputs2_offset_hex = 598;
public static final int fsioDigitalInputs3_offset = 1436;
public static final int fsioDigitalInputs4_offset = 1440;
public static final int fsioDigitalInputs5_offset = 1444;
public static final int fsioDigitalInputs6_offset = 1448;
public static final int fsioDigitalInputs7_offset = 1452;
public static final int fsioDigitalInputs8_offset = 1456;
public static final int fsioDigitalInputs9_offset = 1460;
public static final int fsioDigitalInputs10_offset = 1464;
public static final int fsioDigitalInputs11_offset = 1468;
public static final int fsioDigitalInputs12_offset = 1472;
public static final int fsioDigitalInputs13_offset = 1476;
public static final int fsioDigitalInputs14_offset = 1480;
public static final int fsioDigitalInputs15_offset = 1484;
public static final int fsioDigitalInputs16_offset = 1488;
public static final int frequencyReportingMapInputPin_offset = 1492;
public static final int hasMapSensor_offset = 1496;
public static final int hasIatSensor_offset = 1496;
public static final int hasBaroSensor_offset = 1496;
public static final int hasAfrSensor_offset = 1496;
public static final int useConstantDwellDuringCranking_offset = 1496;
public static final int isEngineChartEnabled_offset = 1496;
public static final int isCanEnabled_offset = 1496;
public static final int hasCltSensor_offset = 1496;
public static final int canReadEnabled_offset = 1496;
public static final int canWriteEnabled_offset = 1496;
public static final int hasVehicleSpeedSensor_offset = 1496;
public static final int isJoystickEnabled_offset = 1496;
public static final int isGpsEnabled_offset = 1496;
public static final int isAlternatorControlEnabled_offset = 1496;
public static final int hasMafSensor_offset = 1496;
public static final int hasTpsSensor_offset = 1496;
public static final int cutFuelOnHardLimit_offset = 1496;
public static final int cutSparkOnHardLimit_offset = 1496;
public static final int step1fuelCutEnable_offset = 1496;
public static final int step1SparkCutEnable_offset = 1496;
public static final int hasFrequencyReportingMapSensor_offset = 1496;
public static final int hipOutputChannel_offset = 1500;
public static final int idleMode_offset = 1504;
public static final int isInjectionEnabled_offset = 1508;
public static final int isIgnitionEnabled_offset = 1508;
public static final int isCylinderCleanupEnabled_offset = 1508;
public static final int secondTriggerChannelEnabled_offset = 1508;
public static final int needSecondTriggerInputDeprecated_offset = 1508;
public static final int isMapAveragingEnabled_offset = 1508;
public static final int isMilEnabled_offset = 1508;
public static final int isFuelPumpEnabled_offset = 1508;
public static final int isTunerStudioEnabled_offset = 1508;
public static final int isWaveAnalyzerEnabled_offset = 1508;
public static final int isIdleThreadEnabled_offset = 1508;
public static final int isPrintTriggerSynchDetails_offset = 1508;
public static final int isManualSpinningMode_offset = 1508;
public static final int twoWireBatchInjection_offset = 1508;
public static final int useOnlyFrontForTrigger_offset = 1508;
public static final int twoWireBatchIgnition_offset = 1508;
public static final int engineChartSize_offset = 1512;
public static final int targetIdleRpm_offset = 1516;
public static final int acSwitchAdc_offset = 1520;
public static final int ignMathCalculateAtIndex_offset = 1524;
public static final int acCutoffLowRpm_offset = 1528;
public static final int acCutoffHighRpm_offset = 1530;
public static final int acIdleRpmBump_offset = 1532;
public static final int unusedShort_offset = 1534;
public static final int vRefAdcChannel_offset = 1536;
public static final int vRefAdcChannel_offset_hex = 600;
public static final int knockDetectionWindowStart_offset = 1540;
public static final int knockDetectionWindowStart_offset_hex = 604;
public static final int knockDetectionWindowEnd_offset = 1544;
public static final int knockDetectionWindowEnd_offset_hex = 608;
public static final int idleStepperReactionTime_offset = 1548;
public static final int knockVThreshold_offset = 1552;
public static final int knockVThreshold_offset_hex = 610;
public static final int fsioInputModes1_offset = 1556;
public static final int fsioInputModes1_offset_hex = 614;
public static final int fsioInputModes2_offset = 1560;
public static final int fsioInputModes2_offset_hex = 618;
public static final int fsioInputModes3_offset = 1564;
public static final int fsioInputModes4_offset = 1568;
public static final int fsioInputModes4_offset_hex = 620;
public static final int fsioInputModes5_offset = 1572;
public static final int fsioInputModes5_offset_hex = 624;
public static final int fsioInputModes6_offset = 1576;
public static final int fsioInputModes6_offset_hex = 628;
public static final int fsioInputModes7_offset = 1580;
public static final int fsioInputModes8_offset = 1584;
public static final int fsioInputModes8_offset_hex = 630;
public static final int fsioInputModes9_offset = 1588;
public static final int fsioInputModes9_offset_hex = 634;
public static final int fsioInputModes10_offset = 1592;
public static final int fsioInputModes10_offset_hex = 638;
public static final int fsioInputModes11_offset = 1596;
public static final int fsioInputModes12_offset = 1600;
public static final int fsioInputModes12_offset_hex = 640;
public static final int fsioInputModes13_offset = 1604;
public static final int fsioInputModes13_offset_hex = 644;
public static final int fsioInputModes14_offset = 1608;
public static final int fsioInputModes14_offset_hex = 648;
public static final int fsioInputModes15_offset = 1612;
public static final int fsioInputModes16_offset = 1616;
public static final int fsioInputModes16_offset_hex = 650;
public static final int externalKnockSenseAdc_offset = 1620;
public static final int externalKnockSenseAdc_offset_hex = 654;
public static final int unsed2342342_offset = 1624;
public static final int unsed2342342_offset_hex = 658;
public static final int idleStepperTotalSteps_offset = 1636;
public static final int idleStepperTotalSteps_offset_hex = 664;
public static final int stepperEnablePin_offset = 1640;
public static final int stepperEnablePin_offset_hex = 668;
public static final int noAccelAfterHardLimitPeriodSecs_offset = 1644;
public static final int mapAveragingSchedulingAtIndex_offset = 1648;
public static final int mapAveragingSchedulingAtIndex_offset_hex = 670;
public static final int baroCorrPressureBins_offset = 1652;
public static final int baroCorrPressureBins_offset_hex = 674;
public static final int baroCorrRpmBins_offset = 1668;
public static final int baroCorrRpmBins_offset_hex = 684;
public static final int baroCorrTable_offset = 1684;
public static final int baroCorrTable_offset_hex = 694;
public static final int spi2SckMode_offset = 1748;
public static final int spi2MosiMode_offset = 1752;
public static final int spi2MisoMode_offset = 1756;
public static final int crankingTpsCoef_offset = 1760;
public static final int crankingTpsBins_offset = 1792;
public static final int crankingTpsBins_offset_hex = 700;
public static final int tachPulseDuractionMs_offset = 1824;
public static final int tachPulseDuractionMs_offset_hex = 720;
public static final int tachPulseTriggerIndex_offset = 1828;
public static final int tachPulseTriggerIndex_offset_hex = 724;
public static final int suckedOffCoef_offset = 1832;
public static final int suckedOffCoef_offset_hex = 728;
public static final int unused71_offset = 1836;
public static final int addedToWallCoef_offset = 1864;
public static final int addedToWallCoef_offset_hex = 748;
public static final int unused72_offset = 1868;
public static final int mapErrorDetectionTooLow_offset = 1896;
public static final int mapErrorDetectionTooLow_offset_hex = 768;
public static final int mapErrorDetectionTooHigh_offset = 1900;
public static final int step1RpmWindow_offset = 1904;
public static final int step1RpmWindow_offset_hex = 770;
public static final int idlePid_offset = 1908;
public static final int idlePid_offset_hex = 774;
public static final int idlePid_pFactor_offset = 1908;
public static final int idlePid_pFactor_offset_hex = 774;
public static final int idlePid_iFactor_offset = 1912;
public static final int idlePid_iFactor_offset_hex = 778;
public static final int idlePid_dFactor_offset = 1916;
public static final int idleDT_offset = 1920;
public static final int idleDT_offset_hex = 780;
public static final int idleControl_offset = 1924;
public static final int idleControl_offset_hex = 784;
public static final int communicationPin_offset = 1928;
public static final int communicationPin_offset_hex = 788;
public static final int runningPin_offset = 1932;
public static final int binarySerialTxPin_offset = 1936;
public static final int binarySerialTxPin_offset_hex = 790;
public static final int binarySerialRxPin_offset = 1940;
public static final int binarySerialRxPin_offset_hex = 794;
public static final int consoleSerialTxPin_offset = 1944;
public static final int consoleSerialTxPin_offset_hex = 798;
public static final int consoleSerialRxPin_offset = 1948;
public static final int knockNoise_offset = 1952;
public static final int knockNoiseRpmBins_offset = 1984;
public static final int etb_offset = 2016;
public static final int etb_pFactor_offset = 2016;
public static final int etb_iFactor_offset = 2020;
public static final int etb_dFactor_offset = 2024;
public static final int cltIdleRpmBins_offset = 2028;
public static final int cltIdleRpm_offset = 2092;
public static final int targetVBatt_offset = 2156;
public static final int alternatorOffAboveTps_offset = 2160;
public static final int alternatorOffAboveTps_offset_hex = 870;
public static final int alternatorDT_offset = 2164;
public static final int alternatorDT_offset_hex = 874;
public static final int alternatorOffset_offset = 2168;
public static final int alternatorOffset_offset_hex = 878;
public static final int alternatorControl_offset = 2172;
public static final int alternatorControl_pFactor_offset = 2172;
public static final int alternatorControl_iFactor_offset = 2176;
public static final int alternatorControl_iFactor_offset_hex = 880;
public static final int alternatorControl_dFactor_offset = 2180;
public static final int alternatorControl_dFactor_offset_hex = 884;
public static final int tpsAccelLength_offset = 2184;
public static final int tpsAccelLength_offset_hex = 888;
public static final int tpsAccelEnrichmentThreshold_offset = 2188;
public static final int tpsAccelEnrichmentMultiplier_offset = 2192;
public static final int tpsAccelEnrichmentMultiplier_offset_hex = 890;
public static final int engineLoadAccelLength_offset = 2196;
public static final int engineLoadAccelLength_offset_hex = 894;
public static final int engineLoadDecelEnleanmentThreshold_offset = 2200;
public static final int engineLoadDecelEnleanmentThreshold_offset_hex = 898;
public static final int engineLoadDecelEnleanmentMultiplier_offset = 2204;
public static final int engineLoadAccelEnrichmentThreshold_offset = 2208;
public static final int engineLoadAccelEnrichmentMultiplier_offset = 2212;
public static final int fatalErrorPin_offset = 2216;
public static final int warninigPin_offset = 2220;
public static final int configResetPin_offset = 2224;
public static final int uartConsoleSerialSpeed_offset = 2228;
public static final int tpsDecelEnleanmentThreshold_offset = 2232;
public static final int tpsDecelEnleanmentMultiplier_offset = 2236;
public static final int unused_offset = 2240;
public static final int le_formulas1_offset = 3016;
public static final int le_formulas2_offset = 3216;
public static final int le_formulas3_offset = 3416;
public static final int le_formulas4_offset = 3616;
public static final int le_formulas5_offset = 3816;
public static final int le_formulas6_offset = 4016;
public static final int le_formulas7_offset = 4216;
public static final int le_formulas7_offset_hex = 1078;
public static final int le_formulas8_offset = 4416;
public static final int le_formulas8_offset_hex = 1140;
public static final int le_formulas9_offset = 4616;
public static final int le_formulas9_offset_hex = 1208;
public static final int le_formulas10_offset = 4816;
public static final int le_formulas11_offset = 5016;
public static final int le_formulas11_offset_hex = 1398;
public static final int le_formulas12_offset = 5216;
public static final int le_formulas12_offset_hex = 1460;
public static final int le_formulas13_offset = 5416;
public static final int le_formulas13_offset_hex = 1528;
public static final int le_formulas14_offset = 5616;
public static final int le_formulas15_offset = 5816;
public static final int le_formulas16_offset = 6016;
public static final int le_formulas16_offset_hex = 1780;
public static final int timingMultiplier_offset = 6216;
public static final int timingMultiplier_offset_hex = 1848;
public static final int timingAdditive_offset = 6416;
public static final int timingAdditive_offset_hex = 1910;
public static final int cltFuelCorrBins_offset = 6616;
public static final int cltFuelCorr_offset = 6680;
public static final int iatFuelCorrBins_offset = 6744;
public static final int iatFuelCorr_offset = 6808;
public static final int crankingFuelCoef_offset = 6872;
public static final int crankingFuelBins_offset = 6904;
public static final int crankingCycleCoef_offset = 6936;
public static final int crankingCycleBins_offset = 6968;
public static final int cltIdleCorrBins_offset = 7000;
public static final int cltIdleCorr_offset = 7064;
public static final int mafDecoding_offset = 7128;
public static final int mafDecodingBins_offset = 8152;
public static final int ignitionIatCorrTable_offset = 9176;
public static final int ignitionIatCorrLoadBins_offset = 10200;
public static final int ignitionIatCorrRpmBins_offset = 10264;
public static final int ignitionIatCorrRpmBins_offset_hex = 2818;
public static final int injectionPhase_offset = 10328;
public static final int injectionPhase_offset_hex = 2858;
public static final int injPhaseLoadBins_offset = 11352;
public static final int injPhaseRpmBins_offset = 11416;
public static final int fuelTable_offset = 11480;
public static final int fuelLoadBins_offset = 12504;
public static final int fuelRpmBins_offset = 12568;
public static final int fuelRpmBins_offset_hex = 3118;
public static final int ignitionTable_offset = 12632;
public static final int ignitionTable_offset_hex = 3158;
public static final int ignitionLoadBins_offset = 13656;
public static final int ignitionLoadBins_offset_hex = 3558;
public static final int ignitionRpmBins_offset = 13720;
public static final int ignitionRpmBins_offset_hex = 3598;
public static final int veTable_offset = 13784;
public static final int veLoadBins_offset = 14808;
public static final int veRpmBins_offset = 14872;
public static final int afrTable_offset = 14936;
public static final int afrLoadBins_offset = 15960;
public static final int afrRpmBins_offset = 16024;
public static final int TOTAL_CONFIG_SIZE = 16088;
public static final Field ENGINETYPE = new Field("ENGINETYPE", 0, FieldType.INT);
public static final Field UNUSEDOFFSET4 = new Field("UNUSEDOFFSET4", 4, FieldType.INT);
public static final Field INJECTOR_FLOW = new Field("INJECTOR_FLOW", 8, FieldType.FLOAT);

View File

@ -1,20 +1,140 @@
package com.rusefi.ui;
import com.rusefi.BinarySearch;
import com.rusefi.FileLog;
import com.rusefi.autotune.FuelAutoTune;
import com.rusefi.binaryprotocol.BinaryProtocol;
import com.rusefi.config.Fields;
import com.rusefi.core.Sensor;
import com.rusefi.core.SensorCentral;
import com.rusefi.ui.config.BaseConfigField;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* (c) Andrey Belomutskiy 2013-2016
* 1/9/2016
* @see FuelAutoTune
*/
public class FuelTunePane {
private final JPanel content = new JPanel(new BorderLayout());
private final List<FuelDataPoint> incomingDataPoints = new ArrayList<>();
private final double veLoadBins[] = new double[Fields.FUEL_LOAD_COUNT];
private final double veRpmBins[] = new double[Fields.FUEL_RPM_COUNT];
public FuelTunePane() {
final JLabel incomingBufferSize = new JLabel();
JButton runLogic = new JButton("one iteration");
runLogic.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
doJob();
}
});
JPanel topPanel = new JPanel(new FlowLayout());
topPanel.add(incomingBufferSize);
topPanel.add(runLogic);
Timer timer = new Timer(300, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int size;
synchronized (incomingDataPoints) {
size = incomingDataPoints.size();
}
incomingBufferSize.setText(size + " records in buffer");
}
});
timer.start();
content.add(topPanel, BorderLayout.NORTH);
// UiUtils.trueLayout(content.getParent());
}
private void doJob() {
double veTable[][] = new double[Fields.FUEL_LOAD_COUNT][Fields.FUEL_RPM_COUNT];
loadMap(veTable, Fields.VETABLE.getOffset());
List<FuelAutoTune.stDataOnline> data = new ArrayList<>();
synchronized (incomingDataPoints) {
for (FuelDataPoint point : incomingDataPoints)
data.add(point.asDataOnline());
}
FuelAutoTune.process(false, data, 0.1, 14.7);
}
public void showContent() {
final SensorCentral sc = SensorCentral.getInstance();
sc.addListener(Sensor.RPM, new SensorCentral.SensorListener() {
@Override
public void onSensorUpdate(double value) {
int rpm = (int) value;
double engineLoad = sc.getValue(Sensor.MAP);
double afr = sc.getValue(Sensor.AFR);
// todo: add UI for pre-conditions
double deltaTps = sc.getValue(Sensor.TPS_DELTA);
double clt = sc.getValue(Sensor.CLT);
// if (clt < 80)
// return;
FuelDataPoint newPoint = new FuelDataPoint(rpm, engineLoad, afr);
synchronized (incomingDataPoints) {
incomingDataPoints.add(newPoint);
}
}
});
loadArray(veLoadBins, Fields.VETABLE.getOffset() + Fields.FUEL_RPM_COUNT * Fields.FUEL_LOAD_COUNT * 4);
loadArray(veRpmBins, Fields.VETABLE.getOffset() + Fields.FUEL_RPM_COUNT * Fields.FUEL_LOAD_COUNT * 4 + Fields.FUEL_LOAD_COUNT * 4);
}
private void loadMap(double[][] map, int offset) {
for (int engineLoadIndex = 0;engineLoadIndex < map.length; engineLoadIndex++) {
loadArray(map[engineLoadIndex], offset + engineLoadIndex * 4 * Fields.FUEL_RPM_COUNT);
}
}
private void loadArray(double[] array, int offset) {
BinaryProtocol bp = BinaryProtocol.instance;
if (bp == null) {
FileLog.MAIN.logLine("bp not ready");
return;
}
for (int i = 0; i < array.length; i++)
array[i] = BaseConfigField.getByteBuffer(bp.getController(), offset + 4 * i).getFloat();
System.out.println("Loaded " + Arrays.toString(array));
}
public Component getContent() {
return content;
}
private class FuelDataPoint {
private final int rpm;
private final double engineLoad;
private final double afr;
private final int rpmIndex;
private final int engineLoadIndex;
public FuelDataPoint(int rpm, double engineLoad, double afr) {
this.rpm = rpm;
this.engineLoad = engineLoad;
this.afr = afr;
rpmIndex = BinarySearch.binarySearch(rpm, veRpmBins);
engineLoadIndex = BinarySearch.binarySearch(engineLoad, veLoadBins);
}
public FuelAutoTune.stDataOnline asDataOnline() {
return new FuelAutoTune.stDataOnline(afr, rpmIndex, engineLoadIndex);
}
}
}

View File

@ -13,7 +13,7 @@ import java.awt.*;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
abstract class BaseConfigField {
public abstract class BaseConfigField {
protected final JLabel status = new JLabel("P");
protected final JPanel panel = new JPanel(new BorderLayout());
protected final Field field;
@ -98,7 +98,12 @@ abstract class BaseConfigField {
@NotNull
public static ByteBuffer getByteBuffer(ConfigurationImage ci, Field field) {
byte data[] = ci.getRange(field.getOffset(), 4);
return getByteBuffer(ci, field.getOffset());
}
@NotNull
public static ByteBuffer getByteBuffer(ConfigurationImage ci, int offset) {
byte data[] = ci.getRange(offset, 4);
ByteBuffer wrapped = ByteBuffer.wrap(data);
wrapped.order(ByteOrder.LITTLE_ENDIAN);
return wrapped;