Annotations in C++ code to produce formulas in rusEfi console #807
reducing hard-coded constants in generator and etc
This commit is contained in:
parent
92bad7286f
commit
f327b961f7
|
@ -15,7 +15,9 @@ java -Drusefi.generator.lazyfile.enabled=true ^
|
|||
-ts_destination tunerstudio ^
|
||||
-c_defines controllers\algo\rusefi_generated.h ^
|
||||
-c_destination controllers\algo\engine_configuration_generated_structures.h ^
|
||||
-java_destination ../java_console -skip build/config.gen
|
||||
-java_destination ../java_console/models/src/com/rusefi/config/Fields.java ^
|
||||
-romraider_destination ../java_console/rusefi.xml ^
|
||||
-skip build/config.gen
|
||||
IF NOT ERRORLEVEL 0 echo ERROR generating
|
||||
IF NOT ERRORLEVEL 0 EXIT /B 1
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
out/
|
||||
logs/
|
||||
rusefi_console_properties.xml
|
||||
output.c
|
||||
currenttune.msq
|
||||
|
|
|
@ -2,9 +2,6 @@ package com.rusefi.config;
|
|||
|
||||
import com.rusefi.core.Pair;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.rusefi.config.FieldType.*;
|
||||
|
||||
/**
|
||||
|
@ -17,8 +14,6 @@ public class Field {
|
|||
private static final String FLOAT_VALUE_PREFIX = FLOAT_TYPE_STRING + Fields.CONSOLE_DATA_PROTOCOL_TAG;
|
||||
public static final int NO_BIT_OFFSET = -1;
|
||||
|
||||
public final static Map<String, Field> VALUES = new HashMap<>();
|
||||
|
||||
private final String name;
|
||||
private final int offset;
|
||||
private final FieldType type;
|
||||
|
@ -129,25 +124,18 @@ public class Field {
|
|||
'}';
|
||||
}
|
||||
|
||||
private static void register(Field field) {
|
||||
VALUES.put(field.name, field);
|
||||
}
|
||||
|
||||
public static Field create(String name, int offset, FieldType type, int bitOffset) {
|
||||
Field field = new Field(name, offset, type, bitOffset);
|
||||
register(field);
|
||||
return field;
|
||||
}
|
||||
|
||||
public static Field create(String name, int offset, FieldType type, String... options) {
|
||||
Field field = new Field(name, offset, type, options);
|
||||
register(field);
|
||||
return field;
|
||||
}
|
||||
|
||||
public static Field create(String name, int offset, FieldType type) {
|
||||
Field field = new Field(name, offset, type);
|
||||
register(field);
|
||||
return field;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package com.rusefi.config;
|
||||
|
||||
// this file was generated automatically by ConfigDefinition.jar based on integration\rusefi_config.txt Tue Jun 11 21:30:38 EDT 2019
|
||||
// this file was generated automatically by ConfigDefinition.jar based on integration\rusefi_config.txt Fri Jun 14 00:38:21 EDT 2019
|
||||
public class Fields {
|
||||
public static final int accelerometerSpiDevice_offset = 2736;
|
||||
public static final int acCutoffHighRpm_offset = 1498;
|
||||
|
@ -2029,4 +2029,773 @@ public class Fields {
|
|||
public static final Field FSIOTABLE2 = Field.create("FSIOTABLE2", 19616, FieldType.INT);
|
||||
public static final Field FSIOTABLE3 = Field.create("FSIOTABLE3", 19744, FieldType.INT);
|
||||
public static final Field FSIOTABLE4 = Field.create("FSIOTABLE4", 19872, FieldType.INT);
|
||||
public static final Field[] VALUES = {
|
||||
ENGINETYPE,
|
||||
ENGINESNIFFERRPMTHRESHOLD,
|
||||
INJECTOR_FLOW,
|
||||
DIRECTSELFSTIMULATION,
|
||||
ACTIVATEAUXPID1,
|
||||
ISVERBOSEAUXPID1,
|
||||
ACTIVATEAUXPID2,
|
||||
ISVERBOSEAUXPID2,
|
||||
ACTIVATEAUXPID3,
|
||||
ISVERBOSEAUXPID3,
|
||||
ACTIVATEAUXPID4,
|
||||
ISVERBOSEAUXPID4,
|
||||
USEBIQUADANALOGFILTERING,
|
||||
CJ125ISUADIVIDED,
|
||||
CJ125ISLSU49,
|
||||
ETB1_USE_TWO_WIRES,
|
||||
ETB2_USE_TWO_WIRES,
|
||||
SHOWSDCARDWARNING,
|
||||
ISSUE_294_15,
|
||||
ISSUE_294_16,
|
||||
ISSUE_294_17,
|
||||
ISSUE_294_18,
|
||||
ISSUE_294_19,
|
||||
ISSUE_294_21,
|
||||
ISSUE_294_22,
|
||||
ISSUE_294_23,
|
||||
ISSUE_294_24,
|
||||
ISSUE_294_25,
|
||||
ISSUE_294_26,
|
||||
ISSUE_294_27,
|
||||
ISSUE_294_28,
|
||||
ISSUE_294_29,
|
||||
ISSUE_294_30,
|
||||
ISSUE_294_31,
|
||||
TPSMIN,
|
||||
TPSMAX,
|
||||
TPSERRORDETECTIONTOOLOW,
|
||||
TPSERRORDETECTIONTOOHIGH,
|
||||
CRANKING_BASEFUEL,
|
||||
CRANKING_RPM,
|
||||
PRIMINGSQUIRTDURATIONMS,
|
||||
IGNITIONDWELLFORCRANKINGMS,
|
||||
CRANKINGCHARGEANGLE,
|
||||
MAP_SENSOR_LOWVALUE,
|
||||
MAP_SENSOR_HIGHVALUE,
|
||||
MAP_SENSOR_TYPE,
|
||||
MAP_SENSOR_HWCHANNEL,
|
||||
CLT_TEMPC_1,
|
||||
CLT_TEMPC_2,
|
||||
CLT_TEMPC_3,
|
||||
CLT_RESISTANCE_1,
|
||||
CLT_RESISTANCE_2,
|
||||
CLT_RESISTANCE_3,
|
||||
CLT_BIAS_RESISTOR,
|
||||
CLT_ADCCHANNEL,
|
||||
IAT_TEMPC_1,
|
||||
IAT_TEMPC_2,
|
||||
IAT_TEMPC_3,
|
||||
IAT_RESISTANCE_1,
|
||||
IAT_RESISTANCE_2,
|
||||
IAT_RESISTANCE_3,
|
||||
IAT_BIAS_RESISTOR,
|
||||
IAT_ADCCHANNEL,
|
||||
STEP1RPM,
|
||||
STEP1TIMING,
|
||||
HIP9011PRESCALERANDSDO,
|
||||
KNOCKBANDCUSTOM,
|
||||
DISPLACEMENT,
|
||||
CYLINDERSCOUNT,
|
||||
FIRINGORDER,
|
||||
CYLINDERBORE,
|
||||
SENSORSNIFFERRPMTHRESHOLD,
|
||||
RPMHARDLIMIT,
|
||||
FUELALGORITHM,
|
||||
CRANKINGINJECTIONMODE,
|
||||
INJECTIONMODE,
|
||||
EXTRAINJECTIONOFFSET,
|
||||
CRANKINGTIMINGANGLE,
|
||||
IGNITIONMODE,
|
||||
IGNITIONOFFSET,
|
||||
TIMINGMODE,
|
||||
FIXEDMODETIMING,
|
||||
GLOBALTRIGGERANGLEOFFSET,
|
||||
ANALOGINPUTDIVIDERCOEFFICIENT,
|
||||
VBATTDIVIDERCOEFF,
|
||||
FANONTEMPERATURE,
|
||||
FANOFFTEMPERATURE,
|
||||
VEHICLESPEEDCOEF,
|
||||
CANNBCTYPE,
|
||||
CANSLEEPPERIODMS,
|
||||
OPERATIONMODE,
|
||||
DISPLAYMODE,
|
||||
LOGFORMAT,
|
||||
BYFIRMWAREVERSION,
|
||||
HD44780WIDTH,
|
||||
HD44780HEIGHT,
|
||||
TPS1_1ADCCHANNEL,
|
||||
VBATTADCCHANNEL,
|
||||
FUELLEVELSENSOR,
|
||||
TPS2_1ADCCHANNEL,
|
||||
OVERRIDECRANKINGIGNITION,
|
||||
SENSORCHARTFREQUENCY,
|
||||
TRIGGER_TYPE,
|
||||
TRIGGER_UNUSEDCUSTOMISSYNCHRONIZATIONNEEDED,
|
||||
TRIGGER_UNUSEDCUSTOMNEEDSECONDTRIGGERINPUT,
|
||||
TRIGGER_USEONLYFIRSTCHANNEL,
|
||||
TRIGGER_CUSTOMTOTALTOOTHCOUNT,
|
||||
TRIGGER_CUSTOMSKIPPEDTOOTHCOUNT,
|
||||
HIP9011SPIDEVICE,
|
||||
HIGH_FUEL_PRESSURE_SENSOR_1,
|
||||
HIGH_FUEL_PRESSURE_SENSOR_2,
|
||||
UNUSEDSPIPADDING1,
|
||||
GLOBALFUELCORRECTION,
|
||||
ADCVCC,
|
||||
MAXKNOCKSUBDEG,
|
||||
MAFADCCHANNEL,
|
||||
AFR_HWCHANNEL,
|
||||
AFR_V1,
|
||||
AFR_VALUE1,
|
||||
AFR_V2,
|
||||
AFR_VALUE2,
|
||||
THROTTLEPEDALPOSITIONADCCHANNEL,
|
||||
TLE6240_CS,
|
||||
TLE6240_CSPINMODE,
|
||||
UNUSEDT,
|
||||
BAROSENSOR_LOWVALUE,
|
||||
BAROSENSOR_HIGHVALUE,
|
||||
BAROSENSOR_TYPE,
|
||||
BAROSENSOR_HWCHANNEL,
|
||||
IDLE_SOLENOIDFREQUENCY,
|
||||
IDLE_SOLENOIDPIN,
|
||||
IDLE_STEPPERDIRECTIONPIN,
|
||||
IDLE_STEPPERSTEPPIN,
|
||||
IDLE_SOLENOIDPINMODE,
|
||||
MANIDLEPOSITION,
|
||||
MAPFREQUENCY0KPA,
|
||||
MAPFREQUENCY100KPA,
|
||||
TRIGGERSIMULATORFREQUENCY,
|
||||
INJECTIONPINS1,
|
||||
INJECTIONPINS2,
|
||||
INJECTIONPINS3,
|
||||
INJECTIONPINS4,
|
||||
INJECTIONPINS5,
|
||||
INJECTIONPINS6,
|
||||
INJECTIONPINS7,
|
||||
INJECTIONPINS8,
|
||||
INJECTIONPINS9,
|
||||
INJECTIONPINS10,
|
||||
INJECTIONPINS11,
|
||||
INJECTIONPINS12,
|
||||
IGNITIONPINS1,
|
||||
IGNITIONPINS2,
|
||||
IGNITIONPINS3,
|
||||
IGNITIONPINS4,
|
||||
IGNITIONPINS5,
|
||||
IGNITIONPINS6,
|
||||
IGNITIONPINS7,
|
||||
IGNITIONPINS8,
|
||||
IGNITIONPINS9,
|
||||
IGNITIONPINS10,
|
||||
IGNITIONPINS11,
|
||||
IGNITIONPINS12,
|
||||
INJECTIONPINMODE,
|
||||
IGNITIONPINMODE,
|
||||
HD44780_RS,
|
||||
HD44780_E,
|
||||
HD44780_DB4,
|
||||
HD44780_DB5,
|
||||
HD44780_DB6,
|
||||
HD44780_DB7,
|
||||
GPS_RX_PIN,
|
||||
GPS_TX_PIN,
|
||||
FUELPUMPPIN,
|
||||
FUELPUMPPINMODE,
|
||||
MALFUNCTIONINDICATORPIN,
|
||||
MALFUNCTIONINDICATORPINMODE,
|
||||
FANPINMODE,
|
||||
FANPIN,
|
||||
CLUTCHDOWNPIN,
|
||||
ALTERNATORCONTROLPIN,
|
||||
ALTERNATORCONTROLPINMODE,
|
||||
CLUTCHDOWNPINMODE,
|
||||
DIGITALPOTENTIOMETERCHIPSELECT1,
|
||||
DIGITALPOTENTIOMETERCHIPSELECT2,
|
||||
DIGITALPOTENTIOMETERCHIPSELECT3,
|
||||
DIGITALPOTENTIOMETERCHIPSELECT4,
|
||||
ELECTRONICTHROTTLEPIN1MODE,
|
||||
WBOHEATERPIN,
|
||||
CJ125CSPIN,
|
||||
UNUSEDETBM,
|
||||
UNUSEDSPIPADDING9,
|
||||
DIGITALPOTENTIOMETERSPIDEVICE,
|
||||
MC33972_CS,
|
||||
MC33972_CSPINMODE,
|
||||
ETB1_DIRECTIONPIN1,
|
||||
ETB1_DIRECTIONPIN2,
|
||||
ETB1_CONTROLPIN1,
|
||||
ETB1_CONTROLPIN2,
|
||||
FUELLEVELEMPTYTANKVOLTAGE,
|
||||
FUELLEVELFULLTANKVOLTAGE,
|
||||
AFR_TYPE,
|
||||
FUELCLOSEDLOOPAFRLOWTHRESHOLD,
|
||||
TRIGGERINPUTPINS1,
|
||||
TRIGGERINPUTPINS2,
|
||||
TRIGGERINPUTPINS3,
|
||||
HIP9011CSPINMODE,
|
||||
TACHOUTPUTPIN,
|
||||
TACHOUTPUTPINMODE,
|
||||
MAINRELAYPIN,
|
||||
SDCARDCSPIN,
|
||||
CANTXPIN,
|
||||
CANRXPIN,
|
||||
BOARDTESTMODEJUMPERPIN,
|
||||
UNUSEDMA2,
|
||||
IDLETHREADPERIODMS,
|
||||
CONSOLELOOPPERIODMS,
|
||||
LCDTHREADPERIODMS,
|
||||
GENERALPERIODICTHREADPERIODMS,
|
||||
TUNERSTUDIOSERIALSPEED,
|
||||
CANDEVICEMODE,
|
||||
TRIGGERSIMULATORPINS1,
|
||||
TRIGGERSIMULATORPINS2,
|
||||
TRIGGERSIMULATORPINS3,
|
||||
TRIGGERSIMULATORPINMODES1,
|
||||
TRIGGERSIMULATORPINMODES2,
|
||||
TRIGGERSIMULATORPINMODES3,
|
||||
O2HEATERPIN,
|
||||
O2HEATERPINMODETODO,
|
||||
IS_ENABLED_SPI_1,
|
||||
IS_ENABLED_SPI_2,
|
||||
IS_ENABLED_SPI_3,
|
||||
ISSDCARDENABLED,
|
||||
ISFASTADCENABLED,
|
||||
ISENGINECONTROLENABLED,
|
||||
ISHIP9011ENABLED,
|
||||
ISVERBOSEALTERNATOR,
|
||||
USESERIALPORT,
|
||||
USESTEPPERIDLE,
|
||||
ENABLEDSTEP1LIMITER,
|
||||
USETPICADVANCEDMODE,
|
||||
USELCDSCREEN,
|
||||
UNUSEDANOTHERONE,
|
||||
USEWARMUPPIDAFR,
|
||||
ONOFFALTERNATORLOGIC,
|
||||
ISCJ125ENABLED,
|
||||
VVTCAMSENSORUSERISE,
|
||||
MEASUREMAPONLYINONECYLINDER,
|
||||
STEPPERFORCEPARKINGEVERYRESTART,
|
||||
ISFASTERENGINESPINUPENABLED,
|
||||
COASTINGFUELCUTENABLED,
|
||||
USEIACTABLEFORCOASTING,
|
||||
USENOISELESSTRIGGERDECODER,
|
||||
USEIDLETIMINGPIDCONTROL,
|
||||
USETPSBASEDVETABLE,
|
||||
IS_ENABLED_SPI_4,
|
||||
PAUSEETBCONTROL,
|
||||
ALIGNENGINESNIFFERATTDC,
|
||||
USEETBFORIDLECONTROL,
|
||||
IDLEINCREMENTALPIDCIC,
|
||||
UNUSED_BOARD_984_31,
|
||||
LOGICANALYZERPINS1,
|
||||
LOGICANALYZERPINS2,
|
||||
LOGICANALYZERPINS3,
|
||||
LOGICANALYZERPINS4,
|
||||
MAINRELAYPINMODE,
|
||||
HIP9011CSPIN,
|
||||
HIP9011INTHOLDPIN,
|
||||
HIP9011INTHOLDPINMODE,
|
||||
UNREALISTICRPMTHREASHOLD,
|
||||
GPIOPINMODES1,
|
||||
GPIOPINMODES2,
|
||||
GPIOPINMODES3,
|
||||
GPIOPINMODES4,
|
||||
GPIOPINMODES5,
|
||||
GPIOPINMODES6,
|
||||
GPIOPINMODES7,
|
||||
GPIOPINMODES8,
|
||||
GPIOPINMODES9,
|
||||
GPIOPINMODES10,
|
||||
GPIOPINMODES11,
|
||||
GPIOPINMODES12,
|
||||
GPIOPINMODES13,
|
||||
GPIOPINMODES14,
|
||||
GPIOPINMODES15,
|
||||
GPIOPINMODES16,
|
||||
FSIOOUTPUTPINS1,
|
||||
FSIOOUTPUTPINS2,
|
||||
FSIOOUTPUTPINS3,
|
||||
FSIOOUTPUTPINS4,
|
||||
FSIOOUTPUTPINS5,
|
||||
FSIOOUTPUTPINS6,
|
||||
FSIOOUTPUTPINS7,
|
||||
FSIOOUTPUTPINS8,
|
||||
FSIOOUTPUTPINS9,
|
||||
FSIOOUTPUTPINS10,
|
||||
FSIOOUTPUTPINS11,
|
||||
FSIOOUTPUTPINS12,
|
||||
FSIOOUTPUTPINS13,
|
||||
FSIOOUTPUTPINS14,
|
||||
FSIOOUTPUTPINS15,
|
||||
FSIOOUTPUTPINS16,
|
||||
MAX31855_CS1,
|
||||
MAX31855_CS2,
|
||||
MAX31855_CS3,
|
||||
MAX31855_CS4,
|
||||
MAX31855_CS5,
|
||||
MAX31855_CS6,
|
||||
MAX31855_CS7,
|
||||
MAX31855_CS8,
|
||||
MAX31855SPIDEVICE,
|
||||
CONSOLEUARTDEVICE,
|
||||
MAPMINBUFFERLENGTH,
|
||||
IDLEPIDDEACTIVATIONTPSTHRESHOLD,
|
||||
STEPPERPARKINGEXTRASTEPS,
|
||||
NB2RATIOFROM,
|
||||
NB2RATIOTO,
|
||||
TRIGGERERRORPIN,
|
||||
TRIGGERERRORPINMODE,
|
||||
ACRELAYPIN,
|
||||
ACRELAYPINMODE,
|
||||
FSIOFREQUENCY1,
|
||||
FSIOFREQUENCY2,
|
||||
FSIOFREQUENCY3,
|
||||
FSIOFREQUENCY4,
|
||||
FSIOFREQUENCY5,
|
||||
FSIOFREQUENCY6,
|
||||
FSIOFREQUENCY7,
|
||||
FSIOFREQUENCY8,
|
||||
FSIOFREQUENCY9,
|
||||
FSIOFREQUENCY10,
|
||||
FSIOFREQUENCY11,
|
||||
FSIOFREQUENCY12,
|
||||
FSIOFREQUENCY13,
|
||||
FSIOFREQUENCY14,
|
||||
FSIOFREQUENCY15,
|
||||
FSIOFREQUENCY16,
|
||||
FSIO_SETTING1,
|
||||
FSIO_SETTING2,
|
||||
FSIO_SETTING3,
|
||||
FSIO_SETTING4,
|
||||
FSIO_SETTING5,
|
||||
FSIO_SETTING6,
|
||||
FSIO_SETTING7,
|
||||
FSIO_SETTING8,
|
||||
FSIO_SETTING9,
|
||||
FSIO_SETTING10,
|
||||
FSIO_SETTING11,
|
||||
FSIO_SETTING12,
|
||||
FSIO_SETTING13,
|
||||
FSIO_SETTING14,
|
||||
FSIO_SETTING15,
|
||||
FSIO_SETTING16,
|
||||
SPI1MOSIPIN,
|
||||
SPI1MISOPIN,
|
||||
SPI1SCKPIN,
|
||||
SPI2MOSIPIN,
|
||||
SPI2MISOPIN,
|
||||
SPI2SCKPIN,
|
||||
SPI3MOSIPIN,
|
||||
SPI3MISOPIN,
|
||||
SPI3SCKPIN,
|
||||
CDMINPUTPIN,
|
||||
JOYSTICKCENTERPIN,
|
||||
JOYSTICKAPIN,
|
||||
JOYSTICKBPIN,
|
||||
JOYSTICKCPIN,
|
||||
JOYSTICKDPIN,
|
||||
UNUSEDJOY,
|
||||
SENSORCHARTMODE,
|
||||
MAFSENSORTYPE,
|
||||
FSIODIGITALINPUTS1,
|
||||
FSIODIGITALINPUTS2,
|
||||
FSIODIGITALINPUTS3,
|
||||
FSIODIGITALINPUTS4,
|
||||
FSIODIGITALINPUTS5,
|
||||
FSIODIGITALINPUTS6,
|
||||
FSIODIGITALINPUTS7,
|
||||
FSIODIGITALINPUTS8,
|
||||
FSIODIGITALINPUTS9,
|
||||
FSIODIGITALINPUTS10,
|
||||
FSIODIGITALINPUTS11,
|
||||
FSIODIGITALINPUTS12,
|
||||
FSIODIGITALINPUTS13,
|
||||
FSIODIGITALINPUTS14,
|
||||
FSIODIGITALINPUTS15,
|
||||
FSIODIGITALINPUTS16,
|
||||
VEHICLESPEEDSENSORINPUTPIN,
|
||||
CLUTCHUPPIN,
|
||||
FREQUENCYREPORTINGMAPINPUTPIN,
|
||||
CLUTCHUPPINMODE,
|
||||
ETBIDLERANGE,
|
||||
VVTDISPLAYINVERTED,
|
||||
FUELCLOSEDLOOPCORRECTIONENABLED,
|
||||
ISVERBOSEIAC,
|
||||
ISVERBOSEETB,
|
||||
USECONSTANTDWELLDURINGCRANKING,
|
||||
ISENGINECHARTENABLED,
|
||||
SILENTTRIGGERERROR,
|
||||
USELINEARCLTSENSOR,
|
||||
CANREADENABLED,
|
||||
CANWRITEENABLED,
|
||||
USELINEARIATSENSOR,
|
||||
USEFSIO16FORTIMINGADJUSTMENT,
|
||||
TACHPULSEDURATIONASDUTYCYCLE,
|
||||
ISALTERNATORCONTROLENABLED,
|
||||
INVERTPRIMARYTRIGGERSIGNAL,
|
||||
INVERTSECONDARYTRIGGERSIGNAL,
|
||||
CUTFUELONHARDLIMIT,
|
||||
CUTSPARKONHARDLIMIT,
|
||||
STEP1FUELCUTENABLE,
|
||||
STEP1SPARKCUTENABLE,
|
||||
HASFREQUENCYREPORTINGMAPSENSOR,
|
||||
USEFSIO8FORSERVO1,
|
||||
USEFSIO9FORSERVO2,
|
||||
USEFSIO10FORSERVO3,
|
||||
USEFSIO11FORSERVO4,
|
||||
USEFSIO12FORSERVO5,
|
||||
USEFSIO15FORIDLERPMADJUSTMENT,
|
||||
USEFSIO5FORCRITICALISSUEENGINESTOP,
|
||||
USEFSIO4FORSERIOUSENGINEWARNING,
|
||||
UNUSED_BIT_1472_29,
|
||||
UNUSED_BIT_1472_30,
|
||||
HIPOUTPUTCHANNEL,
|
||||
IDLEMODE,
|
||||
ISINJECTIONENABLED,
|
||||
ISIGNITIONENABLED,
|
||||
ISCYLINDERCLEANUPENABLED,
|
||||
SECONDTRIGGERCHANNELENABLED,
|
||||
NEEDSECONDTRIGGERINPUTDEPRECATED,
|
||||
ISMAPAVERAGINGENABLED,
|
||||
OVERRIDECRANKINGIACSETTING,
|
||||
USESEPARATEADVANCEFORIDLE,
|
||||
ISTUNERSTUDIOENABLED,
|
||||
ISWAVEANALYZERENABLED,
|
||||
USESEPARATEVEFORIDLE,
|
||||
ISPRINTTRIGGERSYNCHDETAILS,
|
||||
ISMANUALSPINNINGMODE,
|
||||
TWOWIREBATCHINJECTION,
|
||||
USEONLYRISINGEDGEFORTRIGGER,
|
||||
TWOWIREBATCHIGNITION,
|
||||
USEFIXEDBAROCORRFROMMAP,
|
||||
USESEPARATEADVANCEFORCRANKING,
|
||||
USEADVANCECORRECTIONSFORCRANKING,
|
||||
USETPSADVANCETABLE,
|
||||
UNUSED_1484_BIT_20,
|
||||
UNUSED_1484_BIT_21,
|
||||
ENGINECHARTSIZE,
|
||||
IDLEPIDRPMUPPERLIMIT,
|
||||
PRIMEINJFALLOFFTEMPERATURE,
|
||||
ACSWITCHADC,
|
||||
IGNMATHCALCULATEATINDEX,
|
||||
ACCUTOFFLOWRPM,
|
||||
ACCUTOFFHIGHRPM,
|
||||
ACIDLERPMBUMP,
|
||||
WARNINGPERIOD,
|
||||
VREFADCCHANNEL,
|
||||
KNOCKDETECTIONWINDOWSTART,
|
||||
KNOCKDETECTIONWINDOWEND,
|
||||
IDLESTEPPERREACTIONTIME,
|
||||
KNOCKVTHRESHOLD,
|
||||
FSIOINPUTMODES1,
|
||||
FSIOINPUTMODES2,
|
||||
FSIOINPUTMODES3,
|
||||
FSIOINPUTMODES4,
|
||||
FSIOINPUTMODES5,
|
||||
FSIOINPUTMODES6,
|
||||
FSIOINPUTMODES7,
|
||||
FSIOINPUTMODES8,
|
||||
FSIOINPUTMODES9,
|
||||
FSIOINPUTMODES10,
|
||||
FSIOINPUTMODES11,
|
||||
FSIOINPUTMODES12,
|
||||
FSIOINPUTMODES13,
|
||||
FSIOINPUTMODES14,
|
||||
FSIOINPUTMODES15,
|
||||
FSIOINPUTMODES16,
|
||||
IDLESTEPPERTOTALSTEPS,
|
||||
NOACCELAFTERHARDLIMITPERIODSECS,
|
||||
MAPAVERAGINGSCHEDULINGATINDEX,
|
||||
BAROCORRTABLE,
|
||||
TACHPULSEDURACTIONMS,
|
||||
TACHPULSETRIGGERINDEX,
|
||||
WWAETAU,
|
||||
ALTERNATORCONTROL_PFACTOR,
|
||||
ALTERNATORCONTROL_IFACTOR,
|
||||
ALTERNATORCONTROL_DFACTOR,
|
||||
ALTERNATORCONTROL_OFFSET,
|
||||
ALTERNATORCONTROL_PERIODMS,
|
||||
ALTERNATORCONTROL_MINVALUE,
|
||||
ALTERNATORCONTROL_MAXVALUE,
|
||||
ETB_PFACTOR,
|
||||
ETB_IFACTOR,
|
||||
ETB_DFACTOR,
|
||||
ETB_OFFSET,
|
||||
ETB_PERIODMS,
|
||||
ETB_MINVALUE,
|
||||
ETB_MAXVALUE,
|
||||
WARMUPAFRPID_PFACTOR,
|
||||
WARMUPAFRPID_IFACTOR,
|
||||
WARMUPAFRPID_DFACTOR,
|
||||
WARMUPAFRPID_OFFSET,
|
||||
WARMUPAFRPID_PERIODMS,
|
||||
WARMUPAFRPID_MINVALUE,
|
||||
WARMUPAFRPID_MAXVALUE,
|
||||
MAPERRORDETECTIONTOOLOW,
|
||||
MAPERRORDETECTIONTOOHIGH,
|
||||
STEP1RPMWINDOW,
|
||||
IDLERPMPID_PFACTOR,
|
||||
IDLERPMPID_IFACTOR,
|
||||
IDLERPMPID_DFACTOR,
|
||||
IDLERPMPID_OFFSET,
|
||||
IDLERPMPID_PERIODMS,
|
||||
IDLERPMPID_MINVALUE,
|
||||
IDLERPMPID_MAXVALUE,
|
||||
WWAEBETA,
|
||||
COMMUNICATIONLEDPIN,
|
||||
RUNNINGLEDPIN,
|
||||
BINARYSERIALTXPIN,
|
||||
BINARYSERIALRXPIN,
|
||||
AUXVALVES1,
|
||||
AUXVALVES2,
|
||||
CONSOLESERIALTXPIN,
|
||||
CONSOLESERIALRXPIN,
|
||||
THROTTLEPEDALUPVOLTAGE,
|
||||
THROTTLEPEDALWOTVOLTAGE,
|
||||
STARTUPFUELPUMPDURATION,
|
||||
IDLEPIDRPMDEADZONE,
|
||||
TARGETVBATT,
|
||||
ALTERNATOROFFABOVETPS,
|
||||
STARTOFCRANKINGPRIMINGPULSE,
|
||||
AFTERCRANKINGIACTAPERDURATION,
|
||||
IACBYTPSTAPER,
|
||||
FATALERRORPIN,
|
||||
WARNINGLEDPIN,
|
||||
UNUSED1234234,
|
||||
LIS302DLCSPIN,
|
||||
TPSACCELLENGTH,
|
||||
TPSACCELENRICHMENTTHRESHOLD,
|
||||
VVTOFFSET,
|
||||
ENGINELOADACCELLENGTH,
|
||||
ENGINELOADDECELENLEANMENTTHRESHOLD,
|
||||
ENGINELOADDECELENLEANMENTMULTIPLIER,
|
||||
ENGINELOADACCELENRICHMENTTHRESHOLD,
|
||||
ENGINELOADACCELENRICHMENTMULTIPLIER,
|
||||
UARTCONSOLESERIALSPEED,
|
||||
TPSDECELENLEANMENTTHRESHOLD,
|
||||
TPSDECELENLEANMENTMULTIPLIER,
|
||||
SLOWADCALPHA,
|
||||
DEBUGMODE,
|
||||
WARMUPAFRTHRESHOLD,
|
||||
BOOSTCUTPRESSURE,
|
||||
FSIOADC1,
|
||||
FSIOADC2,
|
||||
FSIOADC3,
|
||||
FSIOADC4,
|
||||
FIXEDTIMING,
|
||||
MAPLOWVALUEVOLTAGE,
|
||||
MAPHIGHVALUEVOLTAGE,
|
||||
EGOVALUESHIFT,
|
||||
AUXPIDPINS1,
|
||||
AUXPIDPINS2,
|
||||
AUXPIDPINS3,
|
||||
AUXPIDPINS4,
|
||||
CAMINPUT,
|
||||
CJ125CSPINMODE,
|
||||
DIZZYSPARKOUTPUTPIN,
|
||||
DIZZYSPARKOUTPUTPINMODE,
|
||||
CRANKINGIACPOSITION,
|
||||
TCHARGEMINRPMMINTPS,
|
||||
TCHARGEMINRPMMAXTPS,
|
||||
TCHARGEMAXRPMMINTPS,
|
||||
TCHARGEMAXRPMMAXTPS,
|
||||
AUXPIDFREQUENCY1,
|
||||
AUXPIDFREQUENCY2,
|
||||
AUXPIDFREQUENCY3,
|
||||
AUXPIDFREQUENCY4,
|
||||
ALTERNATORPWMFREQUENCY,
|
||||
STORAGEMODE,
|
||||
CJ125SPIDEVICE,
|
||||
VVTMODE,
|
||||
BIQUAD_A0,
|
||||
BIQUAD_A1,
|
||||
BIQUAD_A2,
|
||||
BIQUAD_B1,
|
||||
BIQUAD_B2,
|
||||
NBVVTINDEX,
|
||||
AUTOTUNECLTTHRESHOLD,
|
||||
AUTOTUNETPSROCTHRESHOLD,
|
||||
AUTOTUNETPSQUIETPERIOD,
|
||||
POSTCRANKINGTARGETCLT,
|
||||
POSTCRANKINGFACTOR,
|
||||
POSTCRANKINGDURATIONSEC,
|
||||
AUXTEMPSENSOR1_TEMPC_1,
|
||||
AUXTEMPSENSOR1_TEMPC_2,
|
||||
AUXTEMPSENSOR1_TEMPC_3,
|
||||
AUXTEMPSENSOR1_RESISTANCE_1,
|
||||
AUXTEMPSENSOR1_RESISTANCE_2,
|
||||
AUXTEMPSENSOR1_RESISTANCE_3,
|
||||
AUXTEMPSENSOR1_BIAS_RESISTOR,
|
||||
AUXTEMPSENSOR1_ADCCHANNEL,
|
||||
AUXTEMPSENSOR2_TEMPC_1,
|
||||
AUXTEMPSENSOR2_TEMPC_2,
|
||||
AUXTEMPSENSOR2_TEMPC_3,
|
||||
AUXTEMPSENSOR2_RESISTANCE_1,
|
||||
AUXTEMPSENSOR2_RESISTANCE_2,
|
||||
AUXTEMPSENSOR2_RESISTANCE_3,
|
||||
AUXTEMPSENSOR2_BIAS_RESISTOR,
|
||||
AUXTEMPSENSOR2_ADCCHANNEL,
|
||||
FUELCLOSEDLOOPCLTTHRESHOLD,
|
||||
FUELCLOSEDLOOPTPSTHRESHOLD,
|
||||
FUELCLOSEDLOOPRPMTHRESHOLD,
|
||||
ETBFREQ,
|
||||
FUELCLOSEDLOOPPID_PFACTOR,
|
||||
FUELCLOSEDLOOPPID_IFACTOR,
|
||||
FUELCLOSEDLOOPPID_DFACTOR,
|
||||
FUELCLOSEDLOOPPID_OFFSET,
|
||||
FUELCLOSEDLOOPPID_PERIODMS,
|
||||
FUELCLOSEDLOOPPID_MINVALUE,
|
||||
FUELCLOSEDLOOPPID_MAXVALUE,
|
||||
FUELCLOSEDLOOPAFRHIGHTHRESHOLD,
|
||||
TIMING_OFFSET_CYLINDER1,
|
||||
TIMING_OFFSET_CYLINDER2,
|
||||
TIMING_OFFSET_CYLINDER3,
|
||||
TIMING_OFFSET_CYLINDER4,
|
||||
TIMING_OFFSET_CYLINDER5,
|
||||
TIMING_OFFSET_CYLINDER6,
|
||||
TIMING_OFFSET_CYLINDER7,
|
||||
TIMING_OFFSET_CYLINDER8,
|
||||
TIMING_OFFSET_CYLINDER9,
|
||||
TIMING_OFFSET_CYLINDER10,
|
||||
TIMING_OFFSET_CYLINDER11,
|
||||
TIMING_OFFSET_CYLINDER12,
|
||||
IDLEPIDACTIVATIONTIME,
|
||||
SDCARDSPIDEVICE,
|
||||
SPI1SCKMODE,
|
||||
SPI1MOSIMODE,
|
||||
SPI1MISOMODE,
|
||||
SPI2SCKMODE,
|
||||
SPI2MOSIMODE,
|
||||
SPI2MISOMODE,
|
||||
SPI3SCKMODE,
|
||||
SPI3MOSIMODE,
|
||||
SPI3MISOMODE,
|
||||
STEPPERENABLEPINMODE,
|
||||
MC33816_RSTB,
|
||||
MC33816_DRIVEN,
|
||||
BRAKEPEDALPIN,
|
||||
CJ125UA,
|
||||
CJ125UR,
|
||||
BRAKEPEDALPINMODE,
|
||||
AUXPID1_PFACTOR,
|
||||
AUXPID1_IFACTOR,
|
||||
AUXPID1_DFACTOR,
|
||||
AUXPID1_OFFSET,
|
||||
AUXPID1_PERIODMS,
|
||||
AUXPID1_MINVALUE,
|
||||
AUXPID1_MAXVALUE,
|
||||
AUXPID2_PFACTOR,
|
||||
AUXPID2_IFACTOR,
|
||||
AUXPID2_DFACTOR,
|
||||
AUXPID2_OFFSET,
|
||||
AUXPID2_PERIODMS,
|
||||
AUXPID2_MINVALUE,
|
||||
AUXPID2_MAXVALUE,
|
||||
AUXPID3_PFACTOR,
|
||||
AUXPID3_IFACTOR,
|
||||
AUXPID3_DFACTOR,
|
||||
AUXPID3_OFFSET,
|
||||
AUXPID3_PERIODMS,
|
||||
AUXPID3_MINVALUE,
|
||||
AUXPID3_MAXVALUE,
|
||||
AUXPID4_PFACTOR,
|
||||
AUXPID4_IFACTOR,
|
||||
AUXPID4_DFACTOR,
|
||||
AUXPID4_OFFSET,
|
||||
AUXPID4_PERIODMS,
|
||||
AUXPID4_MINVALUE,
|
||||
AUXPID4_MAXVALUE,
|
||||
OILPRESSURE_HWCHANNEL,
|
||||
OILPRESSURE_V1,
|
||||
OILPRESSURE_VALUE1,
|
||||
OILPRESSURE_V2,
|
||||
OILPRESSURE_VALUE2,
|
||||
ACCELEROMETERSPIDEVICE,
|
||||
FLEXFUELSENSOR,
|
||||
TEST557PIN,
|
||||
STEPPERDIRECTIONPINMODE,
|
||||
EXTERNALKNOCKSENSEADC,
|
||||
STEPPERENABLEPIN,
|
||||
TLE8888_CS,
|
||||
TLE8888_CSPINMODE,
|
||||
MC33816_CS,
|
||||
SERVOOUTPUTPINS1,
|
||||
SERVOOUTPUTPINS2,
|
||||
SERVOOUTPUTPINS3,
|
||||
SERVOOUTPUTPINS4,
|
||||
SERVOOUTPUTPINS5,
|
||||
SERVOOUTPUTPINS6,
|
||||
SERVOOUTPUTPINS7,
|
||||
SERVOOUTPUTPINS8,
|
||||
COASTINGFUELCUTRPMHIGH,
|
||||
COASTINGFUELCUTRPMLOW,
|
||||
COASTINGFUELCUTTPS,
|
||||
COASTINGFUELCUTCLT,
|
||||
PIDEXTRAFORLOWRPM,
|
||||
COASTINGFUELCUTMAP,
|
||||
IGNITIONTPSTABLE,
|
||||
TCHARGEAIRCOEFMIN,
|
||||
TCHARGEAIRCOEFMAX,
|
||||
TCHARGEAIRFLOWMAX,
|
||||
TCHARGEAIRINCRLIMIT,
|
||||
TCHARGEAIRDECRLIMIT,
|
||||
TCHARGEMODE,
|
||||
HIP9011GAIN,
|
||||
ETB_ITERMMIN,
|
||||
ETB_ITERMMAX,
|
||||
ETBDEADBAND,
|
||||
ETB2_DIRECTIONPIN1,
|
||||
ETB2_DIRECTIONPIN2,
|
||||
ETB2_CONTROLPIN1,
|
||||
ETB2_CONTROLPIN2,
|
||||
IDLETIMINGPID_PFACTOR,
|
||||
IDLETIMINGPID_IFACTOR,
|
||||
IDLETIMINGPID_DFACTOR,
|
||||
IDLETIMINGPID_OFFSET,
|
||||
IDLETIMINGPID_PERIODMS,
|
||||
IDLETIMINGPID_MINVALUE,
|
||||
IDLETIMINGPID_MAXVALUE,
|
||||
IDLETIMINGPIDWORKZONE,
|
||||
IDLETIMINGPIDDEADZONE,
|
||||
IDLEPIDFALLOFFDELTARPM,
|
||||
TPSACCELFRACTIONPERIOD,
|
||||
TPSACCELFRACTIONDIVISOR,
|
||||
TLE8888SPIDEVICE,
|
||||
MC33816SPIDEVICE,
|
||||
TLE6240SPIDEVICE,
|
||||
MC33972SPIDEVICE,
|
||||
PEDALTOTPSTABLE,
|
||||
FSIOFORMULAS1,
|
||||
FSIOFORMULAS2,
|
||||
FSIOFORMULAS3,
|
||||
FSIOFORMULAS4,
|
||||
FSIOFORMULAS5,
|
||||
FSIOFORMULAS6,
|
||||
FSIOFORMULAS7,
|
||||
FSIOFORMULAS8,
|
||||
FSIOFORMULAS9,
|
||||
FSIOFORMULAS10,
|
||||
FSIOFORMULAS11,
|
||||
FSIOFORMULAS12,
|
||||
FSIOFORMULAS13,
|
||||
FSIOFORMULAS14,
|
||||
FSIOFORMULAS15,
|
||||
FSIOFORMULAS16,
|
||||
TIMINGMULTIPLIER,
|
||||
TIMINGADDITIVE,
|
||||
IGNITIONIATCORRTABLE,
|
||||
INJECTIONPHASE,
|
||||
FUELTABLE,
|
||||
IGNITIONTABLE,
|
||||
VETABLE,
|
||||
AFRTABLE,
|
||||
TPSTPSACCELTABLE,
|
||||
FSIOTABLE1,
|
||||
FSIOTABLE2,
|
||||
FSIOTABLE3,
|
||||
FSIOTABLE4,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package com.rusefi.config;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class FieldsMap {
|
||||
public final static Map<String, Field> VALUES = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (Field field : Fields.VALUES)
|
||||
VALUES.put(field.getName(), field);
|
||||
}
|
||||
}
|
|
@ -46,7 +46,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see EngineSnifferPanel
|
||||
*/
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20190610;
|
||||
public static final int CONSOLE_VERSION = 20190614;
|
||||
public static final boolean SHOW_STIMULATOR = false;
|
||||
public static final String INPUT_FILES_PATH = "..";
|
||||
private static final String TAB_INDEX = "main_tab";
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.rusefi.ui;
|
|||
|
||||
import com.rusefi.config.Field;
|
||||
import com.rusefi.config.FieldType;
|
||||
import com.rusefi.config.FieldsMap;
|
||||
import com.rusefi.ui.config.*;
|
||||
import com.rusefi.ui.util.UiUtils;
|
||||
|
||||
|
@ -130,7 +131,7 @@ public class SettingsTab {
|
|||
if (f.getKey() == null)
|
||||
continue;
|
||||
|
||||
Field field = Field.VALUES.get(f.getKey().toUpperCase());
|
||||
Field field = FieldsMap.VALUES.get(f.getKey().toUpperCase());
|
||||
if (field == null)
|
||||
throw new NullPointerException("No field for " + f.getKey());
|
||||
// System.out.println("Located " + field);
|
||||
|
|
Binary file not shown.
|
@ -28,13 +28,13 @@ public class ConfigDefinition {
|
|||
public static String MESSAGE;
|
||||
|
||||
private static final String ROM_RAIDER_XML_TEMPLATE = "rusefi_template.xml";
|
||||
private static final String ROM_RAIDER_XML_OUTPUT = "rusefi.xml";
|
||||
public static final String KEY_DEFINITION = "-definition";
|
||||
private static final String KEY_ROM_INPUT = "-romraider";
|
||||
public static final String KEY_TS_DESTINATION = "-ts_destination";
|
||||
private static final String KEY_C_DESTINATION = "-c_destination";
|
||||
private static final String KEY_C_DEFINES = "-c_defines";
|
||||
private static final String KEY_CONSOLE_DESTINATION = "-java_destination";
|
||||
private static final String KEY_JAVA_DESTINATION = "-java_destination";
|
||||
private static final String KEY_ROMRAIDER_DESTINATION = "-romraider_destination";
|
||||
public static final String KEY_PREPEND = "-prepend";
|
||||
private static final String KEY_SKIP = "-skip";
|
||||
public static String definitionInputFile = null;
|
||||
|
@ -55,7 +55,7 @@ public class ConfigDefinition {
|
|||
+ KEY_DEFINITION + " x\r\n"
|
||||
+ KEY_TS_DESTINATION + " x\r\n"
|
||||
+ KEY_C_DESTINATION + " x\r\n"
|
||||
+ KEY_CONSOLE_DESTINATION + " x\r\n"
|
||||
+ KEY_JAVA_DESTINATION + " x\r\n"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -63,7 +63,8 @@ public class ConfigDefinition {
|
|||
String tsPath = null;
|
||||
String destCHeader = null;
|
||||
String destCDefines = null;
|
||||
String javaConsolePath = null;
|
||||
String javaDestination = null;
|
||||
String romRaiderDestination = null;
|
||||
List<String> prependFiles = new ArrayList<>();
|
||||
String skipRebuildFile = null;
|
||||
String romRaiderInputFile = null;
|
||||
|
@ -78,8 +79,10 @@ public class ConfigDefinition {
|
|||
destCHeader = args[i + 1];
|
||||
} else if (key.equals(KEY_C_DEFINES)) {
|
||||
destCDefines = args[i + 1];
|
||||
} else if (key.equals(KEY_CONSOLE_DESTINATION)) {
|
||||
javaConsolePath = args[i + 1];
|
||||
} else if (key.equals(KEY_JAVA_DESTINATION)) {
|
||||
javaDestination = args[i + 1];
|
||||
} else if (key.equals(KEY_ROMRAIDER_DESTINATION)) {
|
||||
romRaiderDestination = args[i + 1];
|
||||
} else if (key.equals(KEY_PREPEND)) {
|
||||
prependFiles.add(args[i + 1]);
|
||||
} else if (key.equals(KEY_SKIP)) {
|
||||
|
@ -119,9 +122,8 @@ public class ConfigDefinition {
|
|||
CharArrayWriter tsWriter = new CharArrayWriter();
|
||||
destinations.add(new TSProjectConsumer(tsWriter, tsPath, state));
|
||||
}
|
||||
if (javaConsolePath != null) {
|
||||
CharArrayWriter javaFieldsWriter = new CharArrayWriter();
|
||||
destinations.add(new JavaFieldsConsumer(javaFieldsWriter, state, javaConsolePath));
|
||||
if (javaDestination != null) {
|
||||
destinations.add(new JavaFieldsConsumer(state, javaDestination));
|
||||
}
|
||||
|
||||
if (destinations.isEmpty())
|
||||
|
@ -134,10 +136,9 @@ public class ConfigDefinition {
|
|||
if (destCDefines != null)
|
||||
VariableRegistry.INSTANCE.writeNumericsToFile(destCDefines);
|
||||
|
||||
if (javaConsolePath != null && romRaiderInputFile != null) {
|
||||
if (romRaiderDestination != null && romRaiderInputFile != null) {
|
||||
String inputFileName = romRaiderInputFile + File.separator + ROM_RAIDER_XML_TEMPLATE;
|
||||
String outputFileName = javaConsolePath + File.separator + ROM_RAIDER_XML_OUTPUT;
|
||||
processTextTemplate(inputFileName, outputFileName);
|
||||
processTextTemplate(inputFileName, romRaiderDestination);
|
||||
}
|
||||
if (skipRebuildFile != null) {
|
||||
System.out.println("Writing " + currentMD5 + " to " + skipRebuildFile);
|
||||
|
|
|
@ -126,13 +126,6 @@ public class ConfigField {
|
|||
}
|
||||
|
||||
|
||||
public void writeJavaFieldName(Writer javaFieldsWriter, String nameWithPrefix, int tsPosition) throws IOException {
|
||||
javaFieldsWriter.write("\tpublic static final Field ");
|
||||
javaFieldsWriter.write(nameWithPrefix.toUpperCase());
|
||||
javaFieldsWriter.write(" = Field.create(\"" + nameWithPrefix.toUpperCase() + "\", "
|
||||
+ tsPosition + ", ");
|
||||
}
|
||||
|
||||
public String getCommentContent() {
|
||||
if (comment == null || comment.isEmpty())
|
||||
return comment;
|
||||
|
|
|
@ -15,56 +15,55 @@ import static com.rusefi.ConfigDefinition.EOL;
|
|||
*/
|
||||
public class JavaFieldsConsumer implements ConfigurationConsumer {
|
||||
private static final Set<String> javaEnums = new HashSet<>();
|
||||
private static final String JAVA_SOURCE_CODE_FILE_NAME = "models/src/com/rusefi/config/Fields.java";
|
||||
public static final String JAVA_PACKAGE = "com.rusefi.config";
|
||||
private static final String JAVA_PACKAGE = "com.rusefi.config";
|
||||
|
||||
private final CharArrayWriter javaFieldsWriter;
|
||||
private final ReaderState state;
|
||||
private final String javaConsolePath;
|
||||
private final LazyFile javaFields;
|
||||
private final StringBuffer allFields = new StringBuffer("\tpublic static final Field[] VALUES = {" + EOL);
|
||||
private final String className;
|
||||
|
||||
public JavaFieldsConsumer(CharArrayWriter javaFieldsWriter, ReaderState state, String javaConsolePath) throws IOException {
|
||||
this.javaFieldsWriter = javaFieldsWriter;
|
||||
public JavaFieldsConsumer(ReaderState state, String javaDestination) {
|
||||
this.javaFieldsWriter = new CharArrayWriter();
|
||||
this.state = state;
|
||||
this.javaConsolePath = javaConsolePath;
|
||||
|
||||
javaFields = new LazyFile(javaConsolePath + File.separator + JAVA_SOURCE_CODE_FILE_NAME);
|
||||
javaFields = new LazyFile(javaDestination);
|
||||
String className = new File(javaDestination).getName();
|
||||
this.className = className.substring(0, className.indexOf('.'));
|
||||
}
|
||||
|
||||
public static int writeJavaFields(List<ConfigField> tsFields, ReaderState state, String prefix, Writer javaFieldsWriter, int tsPosition) throws IOException {
|
||||
private int writeJavaFields(List<ConfigField> tsFields, String prefix, int tsPosition) throws IOException {
|
||||
FieldIterator fieldIterator = new FieldIterator();
|
||||
for (int i = 0; i < tsFields.size(); i++) {
|
||||
ConfigField next = i == tsFields.size() - 1 ? ConfigField.VOID : tsFields.get(i + 1);
|
||||
ConfigField cf = tsFields.get(i);
|
||||
tsPosition = writeJavaFields(cf, prefix, javaFieldsWriter, tsPosition, next, fieldIterator.bitState.get());
|
||||
tsPosition = writeJavaFields(cf, prefix, tsPosition, next, fieldIterator.bitState.get());
|
||||
|
||||
fieldIterator.bitState.incrementBitIndex(cf, next);
|
||||
}
|
||||
return tsPosition;
|
||||
}
|
||||
|
||||
public static int writeJavaFields(ConfigField configField, String prefix, Writer javaFieldsWriter, int tsPosition, ConfigField next, int bitIndex) throws IOException {
|
||||
private int writeJavaFields(ConfigField configField, String prefix, int tsPosition, ConfigField next, int bitIndex) throws IOException {
|
||||
ConfigStructure cs = configField.getState().structures.get(configField.getType());
|
||||
if (cs != null) {
|
||||
String extraPrefix = cs.withPrefix ? configField.getName() + "_" : "";
|
||||
return writeJavaFields(cs.tsFields, configField.getState(), prefix + extraPrefix, javaFieldsWriter, tsPosition);
|
||||
return writeJavaFields(cs.tsFields, prefix + extraPrefix, tsPosition);
|
||||
}
|
||||
|
||||
String nameWithPrefix = prefix + configField.getName();
|
||||
|
||||
|
||||
if (configField.isBit()) {
|
||||
configField.writeJavaFieldName(javaFieldsWriter, nameWithPrefix, tsPosition);
|
||||
writeJavaFieldName(nameWithPrefix, tsPosition);
|
||||
javaFieldsWriter.append("FieldType.BIT, " + bitIndex + ");" + EOL);
|
||||
tsPosition += configField.getSize(next);
|
||||
return tsPosition;
|
||||
}
|
||||
|
||||
|
||||
if (configField.getArraySize() != 1) {
|
||||
// todo: array support
|
||||
} else if (TypesHelper.isFloat(configField.getType())) {
|
||||
configField.writeJavaFieldName(javaFieldsWriter, nameWithPrefix, tsPosition);
|
||||
writeJavaFieldName(nameWithPrefix, tsPosition);
|
||||
javaFieldsWriter.write("FieldType.FLOAT);" + EOL);
|
||||
} else {
|
||||
String enumOptions = VariableRegistry.INSTANCE.get(configField.getType() + ConfigField.ENUM_SUFFIX);
|
||||
|
@ -74,7 +73,7 @@ public class JavaFieldsConsumer implements ConfigurationConsumer {
|
|||
javaFieldsWriter.write("\tpublic static final String[] " + configField.getType() + " = {" + enumOptions + "};" + EOL);
|
||||
}
|
||||
|
||||
configField.writeJavaFieldName(javaFieldsWriter, nameWithPrefix, tsPosition);
|
||||
writeJavaFieldName(nameWithPrefix, tsPosition);
|
||||
if (configField.getElementSize() == 1) {
|
||||
javaFieldsWriter.write("FieldType.INT8");
|
||||
} else if (configField.getElementSize() == 2) {
|
||||
|
@ -93,18 +92,26 @@ public class JavaFieldsConsumer implements ConfigurationConsumer {
|
|||
return tsPosition;
|
||||
}
|
||||
|
||||
private void writeJavaFieldName(String nameWithPrefix, int tsPosition) throws IOException {
|
||||
javaFieldsWriter.write("\tpublic static final Field ");
|
||||
allFields.append("\t" + nameWithPrefix.toUpperCase() + "," + EOL);
|
||||
javaFieldsWriter.write(nameWithPrefix.toUpperCase());
|
||||
javaFieldsWriter.write(" = Field.create(\"" + nameWithPrefix.toUpperCase() + "\", "
|
||||
+ tsPosition + ", ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startFile() throws IOException {
|
||||
public void startFile() {
|
||||
javaFields.write("package " + JAVA_PACKAGE + ";" + ConfigDefinition.EOL + ConfigDefinition.EOL);
|
||||
javaFields.write("// this file " + ConfigDefinition.MESSAGE + ConfigDefinition.EOL);
|
||||
javaFields.write("public class Fields {" + ConfigDefinition.EOL);
|
||||
javaFields.write("public class " + className + " {" + ConfigDefinition.EOL);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleEndStruct(ConfigStructure structure) throws IOException {
|
||||
if (state.stack.isEmpty()) {
|
||||
writeJavaFields(structure.tsFields, state, "", javaFieldsWriter, 0);
|
||||
writeJavaFields(structure.tsFields, "", 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,6 +119,10 @@ public class JavaFieldsConsumer implements ConfigurationConsumer {
|
|||
public void endFile() throws IOException {
|
||||
javaFields.write(VariableRegistry.INSTANCE.getJavaConstants());
|
||||
javaFields.write(javaFieldsWriter.toString());
|
||||
|
||||
allFields.append("\t};" + EOL);
|
||||
javaFields.write(allFields.toString());
|
||||
|
||||
javaFields.write("}" + ConfigDefinition.EOL);
|
||||
javaFields.close();
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class LazyFile {
|
|||
for (int i = 0; i < Math.min(fileContent.length(), newContent.length()); i++) {
|
||||
if (fileContent.charAt(i) != newContent.charAt(i)) {
|
||||
System.out.println(getClass().getSimpleName() + " " + filename + ": Not same at " + i);
|
||||
if (i > 15) {
|
||||
if (i > 15 && i < fileContent.length() - 6 && i < newContent.length() - 6) {
|
||||
System.out.println("file " + fileContent.substring(i - 15, i + 5));
|
||||
System.out.println("newContent " + newContent.substring(i - 15, i + 5));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue