board-specific usability #808

This commit is contained in:
rusefi 2019-05-30 00:18:41 -04:00
parent d33f117688
commit f40e0be614
20 changed files with 181 additions and 91 deletions

View File

@ -0,0 +1,5 @@
outputs:
GPIOE_14: "Injector #1"
GPIOE_13: "Injector #2"
GPIOE_12: "Injector #3"
GPIOE_11: "Injector #4"

View File

@ -1,4 +1,4 @@
// this section was generated automatically by ConfigDefinition.jar based on integration\rusefi_config.txt Mon May 27 20:05:22 EDT 2019
// this section was generated automatically by ConfigDefinition.jar based on integration\rusefi_config.txt Wed May 29 23:53:28 EDT 2019
// begin
#ifndef CONTROLLERS_ALGO_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H
#define CONTROLLERS_ALGO_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H
@ -518,7 +518,7 @@ struct board_configuration_s {
/**
* offset 58
*/
smart_pin_e fuelPumpPin;
output_pin_e fuelPumpPin;
/**
* offset 59
*/
@ -526,7 +526,7 @@ struct board_configuration_s {
/**
* offset 60
*/
smart_pin_e malfunctionIndicatorPin;
output_pin_e malfunctionIndicatorPin;
/**
* offset 61
*/
@ -538,7 +538,7 @@ struct board_configuration_s {
/**
* offset 63
*/
smart_pin_e fanPin;
output_pin_e fanPin;
/**
* some cars have a switch to indicate that clutch pedal is all the way down
* offset 64
@ -547,7 +547,7 @@ struct board_configuration_s {
/**
* offset 65
*/
smart_pin_e alternatorControlPin;
output_pin_e alternatorControlPin;
/**
* offset 66
*/
@ -634,7 +634,7 @@ struct board_configuration_s {
/**
* offset 106
*/
smart_pin_e mainRelayPin;
output_pin_e mainRelayPin;
/**
* offset 107
*/
@ -834,7 +834,7 @@ struct board_configuration_s {
* todo: more comments
* offset 180
*/
smart_pin_e fsioOutputPins[FSIO_COMMAND_COUNT];
output_pin_e fsioOutputPins[FSIO_COMMAND_COUNT];
/**
* offset 196
*/
@ -887,7 +887,7 @@ struct board_configuration_s {
/**
* offset 230
*/
smart_pin_e acRelayPin;
output_pin_e acRelayPin;
/**
* offset 231
*/
@ -2042,7 +2042,7 @@ struct engine_configuration_s {
/**
* offset 2240
*/
smart_pin_e auxPidPins[AUX_PID_COUNT];
output_pin_e auxPidPins[AUX_PID_COUNT];
/**
* Camshaft input could be used either just for engine phase detection if your trigger shape does not include cam sensor as 'primary' channel, or it could be used for Variable Valve timing on one of the camshafts.
* TODO #660
@ -2788,4 +2788,4 @@ typedef struct persistent_config_s persistent_config_s;
#endif
// end
// this section was generated automatically by ConfigDefinition.jar based on integration\rusefi_config.txt Mon May 27 20:05:22 EDT 2019
// this section was generated automatically by ConfigDefinition.jar based on integration\rusefi_config.txt Wed May 29 23:53:28 EDT 2019

View File

@ -846,7 +846,7 @@ typedef enum __attribute__ ((__packed__)) {
TLE8888_PIN_28 = 195,
} brain_pin_e;
typedef brain_pin_e smart_pin_e;
typedef brain_pin_e output_pin_e;
/* Plase keep updating this define */
#define BRAIN_PIN_LAST_ONCHIP GPIOH_15

View File

@ -1468,6 +1468,7 @@
#define onOffAlternatorLogic_offset_hex 2e8
#define operationMode_offset 488
#define operationMode_offset_hex 1e8
#define output_pin_e_enum "NONE", "INVALID", "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6","PE7","PE8","PE9","PE10","PE11","PE12","PE13","PE14","PE15", "PF0","PF1","PF2","PF3","PF4","PF5","PF6","PF7","PF8","PF9","PF10","PF11","PF12","PF13","PF14","PF15", "PG0","PG1","PG2","PG3","PG4","PG5","PG6","PG7","PG8","PG9","PG10","PG11","PG12","PG13","PG14","PG15", "PH0","PH1","PH2","PH3","PH4","PH5","PH6","PH7","PH8","PH9","PH10","PH11","PH12","PH13","PH14","PH15","TLE6240_1", "TLE6240_2", "TLE6240_3", "TLE6240_4", "TLE6240_5", "TLE6240_6", "TLE6240_7", "TLE6240_8", "TLE6240_9", "TLE6240_10", "TLE6240_11", "TLE6240_12", "TLE6240_13", "TLE6240_14", "TLE6240_15", "TLE6240_16", "MC33972_1", "MC33972_2", "MC33972_3", "MC33972_4", "MC33972_5", "MC33972_6", "MC33972_7", "MC33972_8", "MC33972_9", "MC33972_10", "MC33972_11", "MC33972_12", "MC33972_13", "MC33972_14", "MC33972_15", "MC33972_16", "MC33972_17", "MC33972_18", "MC33972_19", "MC33972_20", "MC33972_21", "MC33972_22", "TLE8888_1", "TLE8888_2", "TLE8888_3", "TLE8888_4", "TLE8888_5", "TLE8888_6", "TLE8888_7", "TLE8888_8", "TLE8888_9", "TLE8888_10", "TLE8888_11", "TLE8888_12", "TLE8888_13", "TLE8888_14", "TLE8888_15", "TLE8888_16", "TLE8888_17", "TLE8888_18", "TLE8888_19", "TLE8888_20", "TLE8888_21", "TLE8888_22", "TLE8888_23", "TLE8888_24", "TLE8888_25", "TLE8888_26", "TLE8888_27", "TLE8888_28", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
#define overrideCrankingIacSetting_offset 1476
#define overrideCrankingIacSetting_offset_hex 5c4
#define overrideCrankingIgnition_offset 516
@ -1528,7 +1529,6 @@
#define silentTriggerError_offset_hex 5b8
#define slowAdcAlpha_offset 2108
#define slowAdcAlpha_offset_hex 83c
#define smart_pin_e_enum "NONE", "INVALID", "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6","PE7","PE8","PE9","PE10","PE11","PE12","PE13","PE14","PE15", "PF0","PF1","PF2","PF3","PF4","PF5","PF6","PF7","PF8","PF9","PF10","PF11","PF12","PF13","PF14","PF15", "PG0","PG1","PG2","PG3","PG4","PG5","PG6","PG7","PG8","PG9","PG10","PG11","PG12","PG13","PG14","PG15", "PH0","PH1","PH2","PH3","PH4","PH5","PH6","PH7","PH8","PH9","PH10","PH11","PH12","PH13","PH14","PH15","TLE6240_1", "TLE6240_2", "TLE6240_3", "TLE6240_4", "TLE6240_5", "TLE6240_6", "TLE6240_7", "TLE6240_8", "TLE6240_9", "TLE6240_10", "TLE6240_11", "TLE6240_12", "TLE6240_13", "TLE6240_14", "TLE6240_15", "TLE6240_16", "MC33972_1", "MC33972_2", "MC33972_3", "MC33972_4", "MC33972_5", "MC33972_6", "MC33972_7", "MC33972_8", "MC33972_9", "MC33972_10", "MC33972_11", "MC33972_12", "MC33972_13", "MC33972_14", "MC33972_15", "MC33972_16", "MC33972_17", "MC33972_18", "MC33972_19", "MC33972_20", "MC33972_21", "MC33972_22", "TLE8888_1", "TLE8888_2", "TLE8888_3", "TLE8888_4", "TLE8888_5", "TLE8888_6", "TLE8888_7", "TLE8888_8", "TLE8888_9", "TLE8888_10", "TLE8888_11", "TLE8888_12", "TLE8888_13", "TLE8888_14", "TLE8888_15", "TLE8888_16", "TLE8888_17", "TLE8888_18", "TLE8888_19", "TLE8888_20", "TLE8888_21", "TLE8888_22", "TLE8888_23", "TLE8888_24", "TLE8888_25", "TLE8888_26", "TLE8888_27", "TLE8888_28", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
#define sparkDwellRpmBins_offset 332
#define sparkDwellRpmBins_offset_hex 14c
#define sparkDwellValues_offset 364

View File

@ -182,8 +182,8 @@ custom brain_input_pin_e 1 bits, U08, @OFFSET@, [0:6], @@brain_input_pin_e_
#define brain_pin_e_enum "NONE", "INVALID", "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6","PE7","PE8","PE9","PE10","PE11","PE12","PE13","PE14","PE15", "PF0","PF1","PF2","PF3","PF4","PF5","PF6","PF7","PF8","PF9","PF10","PF11","PF12","PF13","PF14","PF15", "PG0","PG1","PG2","PG3","PG4","PG5","PG6","PG7","PG8","PG9","PG10","PG11","PG12","PG13","PG14","PG15", "PH0","PH1","PH2","PH3","PH4","PH5","PH6","PH7","PH8","PH9","PH10","PH11","PH12","PH13","PH14","PH15","INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
custom brain_pin_e 1 bits, U08, @OFFSET@, [0:7], @@brain_pin_e_enum@@
#define smart_pin_e_enum "NONE", "INVALID", "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6","PE7","PE8","PE9","PE10","PE11","PE12","PE13","PE14","PE15", "PF0","PF1","PF2","PF3","PF4","PF5","PF6","PF7","PF8","PF9","PF10","PF11","PF12","PF13","PF14","PF15", "PG0","PG1","PG2","PG3","PG4","PG5","PG6","PG7","PG8","PG9","PG10","PG11","PG12","PG13","PG14","PG15", "PH0","PH1","PH2","PH3","PH4","PH5","PH6","PH7","PH8","PH9","PH10","PH11","PH12","PH13","PH14","PH15","TLE6240_1", "TLE6240_2", "TLE6240_3", "TLE6240_4", "TLE6240_5", "TLE6240_6", "TLE6240_7", "TLE6240_8", "TLE6240_9", "TLE6240_10", "TLE6240_11", "TLE6240_12", "TLE6240_13", "TLE6240_14", "TLE6240_15", "TLE6240_16", "MC33972_1", "MC33972_2", "MC33972_3", "MC33972_4", "MC33972_5", "MC33972_6", "MC33972_7", "MC33972_8", "MC33972_9", "MC33972_10", "MC33972_11", "MC33972_12", "MC33972_13", "MC33972_14", "MC33972_15", "MC33972_16", "MC33972_17", "MC33972_18", "MC33972_19", "MC33972_20", "MC33972_21", "MC33972_22", "TLE8888_1", "TLE8888_2", "TLE8888_3", "TLE8888_4", "TLE8888_5", "TLE8888_6", "TLE8888_7", "TLE8888_8", "TLE8888_9", "TLE8888_10", "TLE8888_11", "TLE8888_12", "TLE8888_13", "TLE8888_14", "TLE8888_15", "TLE8888_16", "TLE8888_17", "TLE8888_18", "TLE8888_19", "TLE8888_20", "TLE8888_21", "TLE8888_22", "TLE8888_23", "TLE8888_24", "TLE8888_25", "TLE8888_26", "TLE8888_27", "TLE8888_28", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
custom smart_pin_e 1 bits, U08, @OFFSET@, [0:7], @@smart_pin_e_enum@@
#define output_pin_e_enum "NONE", "INVALID", "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6","PE7","PE8","PE9","PE10","PE11","PE12","PE13","PE14","PE15", "PF0","PF1","PF2","PF3","PF4","PF5","PF6","PF7","PF8","PF9","PF10","PF11","PF12","PF13","PF14","PF15", "PG0","PG1","PG2","PG3","PG4","PG5","PG6","PG7","PG8","PG9","PG10","PG11","PG12","PG13","PG14","PG15", "PH0","PH1","PH2","PH3","PH4","PH5","PH6","PH7","PH8","PH9","PH10","PH11","PH12","PH13","PH14","PH15","TLE6240_1", "TLE6240_2", "TLE6240_3", "TLE6240_4", "TLE6240_5", "TLE6240_6", "TLE6240_7", "TLE6240_8", "TLE6240_9", "TLE6240_10", "TLE6240_11", "TLE6240_12", "TLE6240_13", "TLE6240_14", "TLE6240_15", "TLE6240_16", "MC33972_1", "MC33972_2", "MC33972_3", "MC33972_4", "MC33972_5", "MC33972_6", "MC33972_7", "MC33972_8", "MC33972_9", "MC33972_10", "MC33972_11", "MC33972_12", "MC33972_13", "MC33972_14", "MC33972_15", "MC33972_16", "MC33972_17", "MC33972_18", "MC33972_19", "MC33972_20", "MC33972_21", "MC33972_22", "TLE8888_1", "TLE8888_2", "TLE8888_3", "TLE8888_4", "TLE8888_5", "TLE8888_6", "TLE8888_7", "TLE8888_8", "TLE8888_9", "TLE8888_10", "TLE8888_11", "TLE8888_12", "TLE8888_13", "TLE8888_14", "TLE8888_15", "TLE8888_16", "TLE8888_17", "TLE8888_18", "TLE8888_19", "TLE8888_20", "TLE8888_21", "TLE8888_22", "TLE8888_23", "TLE8888_24", "TLE8888_25", "TLE8888_26", "TLE8888_27", "TLE8888_28", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
custom output_pin_e 1 bits, U08, @OFFSET@, [0:7], @@output_pin_e_enum@@
@ -514,16 +514,16 @@ float mapFrequency100Kpa;;"Hz", 1, 0, 0, 100000, 2
brain_pin_e gps_rx_pin;
brain_pin_e gps_tx_pin;
smart_pin_e fuelPumpPin;
output_pin_e fuelPumpPin;
pin_output_mode_e fuelPumpPinMode;
smart_pin_e malfunctionIndicatorPin;
output_pin_e malfunctionIndicatorPin;
pin_output_mode_e malfunctionIndicatorPinMode;
pin_output_mode_e fanPinMode;
smart_pin_e fanPin;
output_pin_e fanPin;
brain_pin_e clutchDownPin;some cars have a switch to indicate that clutch pedal is all the way down
smart_pin_e alternatorControlPin;
output_pin_e alternatorControlPin;
pin_output_mode_e alternatorControlPinMode;
pin_input_mode_e clutchDownPinMode;
@ -554,7 +554,7 @@ custom adc_channel_mode_e 4 bits, U32, @OFFSET@, [0:1], "Off", "Slow", "Fas
brain_pin_e tachOutputPin;+This implementation produces one pulse per engine cycle. See also dizzySparkOutputPin.
pin_output_mode_e tachOutputPinMode;
smart_pin_e mainRelayPin;
output_pin_e mainRelayPin;
brain_pin_e sdCardCsPin;
brain_pin_e canTxPin;
brain_pin_e canRxPin;
@ -624,7 +624,7 @@ pin_output_mode_e hip9011IntHoldPinMode;
pin_output_mode_e[FSIO_COMMAND_COUNT iterate] gpioPinModes;
smart_pin_e[FSIO_COMMAND_COUNT iterate] fsioOutputPins;todo: more comments
output_pin_e[FSIO_COMMAND_COUNT iterate] fsioOutputPins;todo: more comments
brain_pin_e[EGT_CHANNEL_COUNT iterate] max31855_cs;
spi_device_e max31855spiDevice;
@ -643,7 +643,7 @@ custom uart_device_e 1 bits,U32, @OFFSET@, [0:1], "Off", "UART1", "UART2", "UA
brain_pin_e triggerErrorPin;This pin is used for debugging - snap a logic analyzer on it and see if it's ever high
pin_output_mode_e triggerErrorPinMode;
smart_pin_e acRelayPin;
output_pin_e acRelayPin;
pin_output_mode_e acRelayPinMode;
custom pid_dt 4 scalar, U32, @OFFSET@, "ms", 1, 0, 0, 3000, 0
@ -895,7 +895,7 @@ float[MAP_ACCEL_TAPER] mapAccelTaperMult;;"mult", 1, 0, 0.0, 300,
float mapHighValueVoltage;MAP voltage for low point;"v", 1, 0, 0.0, 10, 2
float egoValueShift;EGO value correction;"value", 1, 0, -10.0, 10, 2
smart_pin_e[AUX_PID_COUNT iterate] auxPidPins;
output_pin_e[AUX_PID_COUNT iterate] auxPidPins;
brain_input_pin_e camInput;+Camshaft input could be used either just for engine phase detection if your trigger shape does not include cam sensor as 'primary' channel, or it could be used for Variable Valve timing on one of the camshafts.\nTODO #660
pin_output_mode_e cj125CsPinMode;

View File

@ -1,6 +1,6 @@
package com.rusefi.config;
// this file was generated automatically by ConfigDefinition.jar based on integration\rusefi_config.txt Wed May 29 23:14:19 EDT 2019
// this file was generated automatically by ConfigDefinition.jar based on integration\rusefi_config.txt Wed May 29 23:53:28 EDT 2019
public class Fields {
public static final int accelerometerSpiDevice_offset = 2736;
public static final int acCutoffHighRpm_offset = 1498;
@ -1414,15 +1414,15 @@ public class Fields {
public static final Field HD44780_DB7 = Field.create("HD44780_DB7", 655, FieldType.INT8, brain_pin_e);
public static final Field GPS_RX_PIN = Field.create("GPS_RX_PIN", 656, FieldType.INT8, brain_pin_e);
public static final Field GPS_TX_PIN = Field.create("GPS_TX_PIN", 657, FieldType.INT8, brain_pin_e);
public static final String[] smart_pin_e = {"NONE", "INVALID", "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6","PE7","PE8","PE9","PE10","PE11","PE12","PE13","PE14","PE15", "PF0","PF1","PF2","PF3","PF4","PF5","PF6","PF7","PF8","PF9","PF10","PF11","PF12","PF13","PF14","PF15", "PG0","PG1","PG2","PG3","PG4","PG5","PG6","PG7","PG8","PG9","PG10","PG11","PG12","PG13","PG14","PG15", "PH0","PH1","PH2","PH3","PH4","PH5","PH6","PH7","PH8","PH9","PH10","PH11","PH12","PH13","PH14","PH15","TLE6240_1", "TLE6240_2", "TLE6240_3", "TLE6240_4", "TLE6240_5", "TLE6240_6", "TLE6240_7", "TLE6240_8", "TLE6240_9", "TLE6240_10", "TLE6240_11", "TLE6240_12", "TLE6240_13", "TLE6240_14", "TLE6240_15", "TLE6240_16", "MC33972_1", "MC33972_2", "MC33972_3", "MC33972_4", "MC33972_5", "MC33972_6", "MC33972_7", "MC33972_8", "MC33972_9", "MC33972_10", "MC33972_11", "MC33972_12", "MC33972_13", "MC33972_14", "MC33972_15", "MC33972_16", "MC33972_17", "MC33972_18", "MC33972_19", "MC33972_20", "MC33972_21", "MC33972_22", "TLE8888_1", "TLE8888_2", "TLE8888_3", "TLE8888_4", "TLE8888_5", "TLE8888_6", "TLE8888_7", "TLE8888_8", "TLE8888_9", "TLE8888_10", "TLE8888_11", "TLE8888_12", "TLE8888_13", "TLE8888_14", "TLE8888_15", "TLE8888_16", "TLE8888_17", "TLE8888_18", "TLE8888_19", "TLE8888_20", "TLE8888_21", "TLE8888_22", "TLE8888_23", "TLE8888_24", "TLE8888_25", "TLE8888_26", "TLE8888_27", "TLE8888_28", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"};
public static final Field FUELPUMPPIN = Field.create("FUELPUMPPIN", 658, FieldType.INT8, smart_pin_e);
public static final String[] output_pin_e = {"NONE", "INVALID", "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6","PE7","PE8","PE9","PE10","PE11","PE12","PE13","PE14","PE15", "PF0","PF1","PF2","PF3","PF4","PF5","PF6","PF7","PF8","PF9","PF10","PF11","PF12","PF13","PF14","PF15", "PG0","PG1","PG2","PG3","PG4","PG5","PG6","PG7","PG8","PG9","PG10","PG11","PG12","PG13","PG14","PG15", "PH0","PH1","PH2","PH3","PH4","PH5","PH6","PH7","PH8","PH9","PH10","PH11","PH12","PH13","PH14","PH15","TLE6240_1", "TLE6240_2", "TLE6240_3", "TLE6240_4", "TLE6240_5", "TLE6240_6", "TLE6240_7", "TLE6240_8", "TLE6240_9", "TLE6240_10", "TLE6240_11", "TLE6240_12", "TLE6240_13", "TLE6240_14", "TLE6240_15", "TLE6240_16", "MC33972_1", "MC33972_2", "MC33972_3", "MC33972_4", "MC33972_5", "MC33972_6", "MC33972_7", "MC33972_8", "MC33972_9", "MC33972_10", "MC33972_11", "MC33972_12", "MC33972_13", "MC33972_14", "MC33972_15", "MC33972_16", "MC33972_17", "MC33972_18", "MC33972_19", "MC33972_20", "MC33972_21", "MC33972_22", "TLE8888_1", "TLE8888_2", "TLE8888_3", "TLE8888_4", "TLE8888_5", "TLE8888_6", "TLE8888_7", "TLE8888_8", "TLE8888_9", "TLE8888_10", "TLE8888_11", "TLE8888_12", "TLE8888_13", "TLE8888_14", "TLE8888_15", "TLE8888_16", "TLE8888_17", "TLE8888_18", "TLE8888_19", "TLE8888_20", "TLE8888_21", "TLE8888_22", "TLE8888_23", "TLE8888_24", "TLE8888_25", "TLE8888_26", "TLE8888_27", "TLE8888_28", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"};
public static final Field FUELPUMPPIN = Field.create("FUELPUMPPIN", 658, FieldType.INT8, output_pin_e);
public static final Field FUELPUMPPINMODE = Field.create("FUELPUMPPINMODE", 659, FieldType.INT8, pin_output_mode_e);
public static final Field MALFUNCTIONINDICATORPIN = Field.create("MALFUNCTIONINDICATORPIN", 660, FieldType.INT8, smart_pin_e);
public static final Field MALFUNCTIONINDICATORPIN = Field.create("MALFUNCTIONINDICATORPIN", 660, FieldType.INT8, output_pin_e);
public static final Field MALFUNCTIONINDICATORPINMODE = Field.create("MALFUNCTIONINDICATORPINMODE", 661, FieldType.INT8, pin_output_mode_e);
public static final Field FANPINMODE = Field.create("FANPINMODE", 662, FieldType.INT8, pin_output_mode_e);
public static final Field FANPIN = Field.create("FANPIN", 663, FieldType.INT8, smart_pin_e);
public static final Field FANPIN = Field.create("FANPIN", 663, FieldType.INT8, output_pin_e);
public static final Field CLUTCHDOWNPIN = Field.create("CLUTCHDOWNPIN", 664, FieldType.INT8, brain_pin_e);
public static final Field ALTERNATORCONTROLPIN = Field.create("ALTERNATORCONTROLPIN", 665, FieldType.INT8, smart_pin_e);
public static final Field ALTERNATORCONTROLPIN = Field.create("ALTERNATORCONTROLPIN", 665, FieldType.INT8, output_pin_e);
public static final Field ALTERNATORCONTROLPINMODE = Field.create("ALTERNATORCONTROLPINMODE", 666, FieldType.INT8, pin_output_mode_e);
public static final Field CLUTCHDOWNPINMODE = Field.create("CLUTCHDOWNPINMODE", 667, FieldType.INT8);
public static final Field DIGITALPOTENTIOMETERCHIPSELECT1 = Field.create("DIGITALPOTENTIOMETERCHIPSELECT1", 668, FieldType.INT8, brain_pin_e);
@ -1453,7 +1453,7 @@ public class Fields {
public static final Field HIP9011CSPINMODE = Field.create("HIP9011CSPINMODE", 703, FieldType.INT8, pin_output_mode_e);
public static final Field TACHOUTPUTPIN = Field.create("TACHOUTPUTPIN", 704, FieldType.INT8, brain_pin_e);
public static final Field TACHOUTPUTPINMODE = Field.create("TACHOUTPUTPINMODE", 705, FieldType.INT8, pin_output_mode_e);
public static final Field MAINRELAYPIN = Field.create("MAINRELAYPIN", 706, FieldType.INT8, smart_pin_e);
public static final Field MAINRELAYPIN = Field.create("MAINRELAYPIN", 706, FieldType.INT8, output_pin_e);
public static final Field SDCARDCSPIN = Field.create("SDCARDCSPIN", 707, FieldType.INT8, brain_pin_e);
public static final Field CANTXPIN = Field.create("CANTXPIN", 708, FieldType.INT8, brain_pin_e);
public static final Field CANRXPIN = Field.create("CANRXPIN", 709, FieldType.INT8, brain_pin_e);
@ -1531,22 +1531,22 @@ public class Fields {
public static final Field GPIOPINMODES14 = Field.create("GPIOPINMODES14", 777, FieldType.INT8, pin_output_mode_e);
public static final Field GPIOPINMODES15 = Field.create("GPIOPINMODES15", 778, FieldType.INT8, pin_output_mode_e);
public static final Field GPIOPINMODES16 = Field.create("GPIOPINMODES16", 779, FieldType.INT8, pin_output_mode_e);
public static final Field FSIOOUTPUTPINS1 = Field.create("FSIOOUTPUTPINS1", 780, FieldType.INT8, smart_pin_e);
public static final Field FSIOOUTPUTPINS2 = Field.create("FSIOOUTPUTPINS2", 781, FieldType.INT8, smart_pin_e);
public static final Field FSIOOUTPUTPINS3 = Field.create("FSIOOUTPUTPINS3", 782, FieldType.INT8, smart_pin_e);
public static final Field FSIOOUTPUTPINS4 = Field.create("FSIOOUTPUTPINS4", 783, FieldType.INT8, smart_pin_e);
public static final Field FSIOOUTPUTPINS5 = Field.create("FSIOOUTPUTPINS5", 784, FieldType.INT8, smart_pin_e);
public static final Field FSIOOUTPUTPINS6 = Field.create("FSIOOUTPUTPINS6", 785, FieldType.INT8, smart_pin_e);
public static final Field FSIOOUTPUTPINS7 = Field.create("FSIOOUTPUTPINS7", 786, FieldType.INT8, smart_pin_e);
public static final Field FSIOOUTPUTPINS8 = Field.create("FSIOOUTPUTPINS8", 787, FieldType.INT8, smart_pin_e);
public static final Field FSIOOUTPUTPINS9 = Field.create("FSIOOUTPUTPINS9", 788, FieldType.INT8, smart_pin_e);
public static final Field FSIOOUTPUTPINS10 = Field.create("FSIOOUTPUTPINS10", 789, FieldType.INT8, smart_pin_e);
public static final Field FSIOOUTPUTPINS11 = Field.create("FSIOOUTPUTPINS11", 790, FieldType.INT8, smart_pin_e);
public static final Field FSIOOUTPUTPINS12 = Field.create("FSIOOUTPUTPINS12", 791, FieldType.INT8, smart_pin_e);
public static final Field FSIOOUTPUTPINS13 = Field.create("FSIOOUTPUTPINS13", 792, FieldType.INT8, smart_pin_e);
public static final Field FSIOOUTPUTPINS14 = Field.create("FSIOOUTPUTPINS14", 793, FieldType.INT8, smart_pin_e);
public static final Field FSIOOUTPUTPINS15 = Field.create("FSIOOUTPUTPINS15", 794, FieldType.INT8, smart_pin_e);
public static final Field FSIOOUTPUTPINS16 = Field.create("FSIOOUTPUTPINS16", 795, FieldType.INT8, smart_pin_e);
public static final Field FSIOOUTPUTPINS1 = Field.create("FSIOOUTPUTPINS1", 780, FieldType.INT8, output_pin_e);
public static final Field FSIOOUTPUTPINS2 = Field.create("FSIOOUTPUTPINS2", 781, FieldType.INT8, output_pin_e);
public static final Field FSIOOUTPUTPINS3 = Field.create("FSIOOUTPUTPINS3", 782, FieldType.INT8, output_pin_e);
public static final Field FSIOOUTPUTPINS4 = Field.create("FSIOOUTPUTPINS4", 783, FieldType.INT8, output_pin_e);
public static final Field FSIOOUTPUTPINS5 = Field.create("FSIOOUTPUTPINS5", 784, FieldType.INT8, output_pin_e);
public static final Field FSIOOUTPUTPINS6 = Field.create("FSIOOUTPUTPINS6", 785, FieldType.INT8, output_pin_e);
public static final Field FSIOOUTPUTPINS7 = Field.create("FSIOOUTPUTPINS7", 786, FieldType.INT8, output_pin_e);
public static final Field FSIOOUTPUTPINS8 = Field.create("FSIOOUTPUTPINS8", 787, FieldType.INT8, output_pin_e);
public static final Field FSIOOUTPUTPINS9 = Field.create("FSIOOUTPUTPINS9", 788, FieldType.INT8, output_pin_e);
public static final Field FSIOOUTPUTPINS10 = Field.create("FSIOOUTPUTPINS10", 789, FieldType.INT8, output_pin_e);
public static final Field FSIOOUTPUTPINS11 = Field.create("FSIOOUTPUTPINS11", 790, FieldType.INT8, output_pin_e);
public static final Field FSIOOUTPUTPINS12 = Field.create("FSIOOUTPUTPINS12", 791, FieldType.INT8, output_pin_e);
public static final Field FSIOOUTPUTPINS13 = Field.create("FSIOOUTPUTPINS13", 792, FieldType.INT8, output_pin_e);
public static final Field FSIOOUTPUTPINS14 = Field.create("FSIOOUTPUTPINS14", 793, FieldType.INT8, output_pin_e);
public static final Field FSIOOUTPUTPINS15 = Field.create("FSIOOUTPUTPINS15", 794, FieldType.INT8, output_pin_e);
public static final Field FSIOOUTPUTPINS16 = Field.create("FSIOOUTPUTPINS16", 795, FieldType.INT8, output_pin_e);
public static final Field MAX31855_CS1 = Field.create("MAX31855_CS1", 796, FieldType.INT8, brain_pin_e);
public static final Field MAX31855_CS2 = Field.create("MAX31855_CS2", 797, FieldType.INT8, brain_pin_e);
public static final Field MAX31855_CS3 = Field.create("MAX31855_CS3", 798, FieldType.INT8, brain_pin_e);
@ -1564,7 +1564,7 @@ public class Fields {
public static final Field NB2RATIOTO = Field.create("NB2RATIOTO", 824, FieldType.FLOAT);
public static final Field TRIGGERERRORPIN = Field.create("TRIGGERERRORPIN", 828, FieldType.INT8, brain_pin_e);
public static final Field TRIGGERERRORPINMODE = Field.create("TRIGGERERRORPINMODE", 829, FieldType.INT8, pin_output_mode_e);
public static final Field ACRELAYPIN = Field.create("ACRELAYPIN", 830, FieldType.INT8, smart_pin_e);
public static final Field ACRELAYPIN = Field.create("ACRELAYPIN", 830, FieldType.INT8, output_pin_e);
public static final Field ACRELAYPINMODE = Field.create("ACRELAYPINMODE", 831, FieldType.INT8, pin_output_mode_e);
public static final Field FSIOFREQUENCY1 = Field.create("FSIOFREQUENCY1", 832, FieldType.INT16);
public static final Field FSIOFREQUENCY2 = Field.create("FSIOFREQUENCY2", 834, FieldType.INT16);
@ -1808,10 +1808,10 @@ public class Fields {
public static final Field MAPLOWVALUEVOLTAGE = Field.create("MAPLOWVALUEVOLTAGE", 2228, FieldType.FLOAT);
public static final Field MAPHIGHVALUEVOLTAGE = Field.create("MAPHIGHVALUEVOLTAGE", 2232, FieldType.FLOAT);
public static final Field EGOVALUESHIFT = Field.create("EGOVALUESHIFT", 2236, FieldType.FLOAT);
public static final Field AUXPIDPINS1 = Field.create("AUXPIDPINS1", 2240, FieldType.INT8, smart_pin_e);
public static final Field AUXPIDPINS2 = Field.create("AUXPIDPINS2", 2241, FieldType.INT8, smart_pin_e);
public static final Field AUXPIDPINS3 = Field.create("AUXPIDPINS3", 2242, FieldType.INT8, smart_pin_e);
public static final Field AUXPIDPINS4 = Field.create("AUXPIDPINS4", 2243, FieldType.INT8, smart_pin_e);
public static final Field AUXPIDPINS1 = Field.create("AUXPIDPINS1", 2240, FieldType.INT8, output_pin_e);
public static final Field AUXPIDPINS2 = Field.create("AUXPIDPINS2", 2241, FieldType.INT8, output_pin_e);
public static final Field AUXPIDPINS3 = Field.create("AUXPIDPINS3", 2242, FieldType.INT8, output_pin_e);
public static final Field AUXPIDPINS4 = Field.create("AUXPIDPINS4", 2243, FieldType.INT8, output_pin_e);
public static final Field CAMINPUT = Field.create("CAMINPUT", 2244, FieldType.INT8, brain_input_pin_e);
public static final Field CJ125CSPINMODE = Field.create("CJ125CSPINMODE", 2245, FieldType.INT8, pin_output_mode_e);
public static final Field DIZZYSPARKOUTPUTPIN = Field.create("DIZZYSPARKOUTPUTPIN", 2246, FieldType.INT8, brain_pin_e);

Binary file not shown.

View File

@ -3,7 +3,7 @@
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/configuration_definition.iml" filepath="$PROJECT_DIR$/configuration_definition.iml" />
<module fileurl="file://$PROJECT_DIR$/../enum_to_string/enum_to_string.iml" filepath="$PROJECT_DIR$/../enum_to_string/enum_to_string.iml" />
</modules>
</component>
</project>
</project>

View File

@ -13,8 +13,9 @@
source="${javac.source}"
target="${javac.target}"
destdir="build/classes"
classpath="lib/junit.jar:lib/annotations.jar">
<src path="src"/>
classpath="lib/junit.jar:lib/annotations.jar:lib/snakeyaml.jar">
<src path="src"/>
<src path="../enum_to_string/src"/>
</javac>
</target>

View File

@ -17,5 +17,7 @@
</library>
</orderEntry>
<orderEntry type="library" name="junit" level="project" />
<orderEntry type="library" name="snakeyaml" level="project" />
<orderEntry type="module" module-name="enum_to_string" />
</component>
</module>

Binary file not shown.

View File

@ -33,8 +33,6 @@ public class ConfigDefinition {
private static final String KEY_PREPEND = "-prepend";
private static final String KEY_SKIP = "-skip";
public static StringBuilder settingContextHelp = new StringBuilder();
public static void main(String[] args) throws IOException {
if (args.length < 2) {
System.out.println("Please specify\r\n"
@ -71,6 +69,8 @@ public class ConfigDefinition {
prependFile = args[i + 1];
} else if (key.equals(KEY_SKIP)) {
skipRebuildFile = args[i + 1];
} else if (key.equals("-ts_output_name")) {
TSProjectConsumer.TS_FILE_OUTPUT_NAME = args[i + 1];
} else if (key.equals(KEY_ROM_INPUT)) {
romRaiderInputFile = args[i + 1];
}

View File

@ -63,18 +63,6 @@ public class ConfigStructure {
totalSize += fillSize;
}
public int writeTunerStudio(String prefix, Writer tsHeader, 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 = TSProjectConsumer.writeTunerStudio(cf, prefix, tsHeader, tsPosition, next, fieldIterator.bitState.get());
fieldIterator.bitState.incrementBitIndex(cf, next);
}
return tsPosition;
}
public void addBoth(ConfigField cf) {
cFields.add(cf);
tsFields.add(cf);

View File

@ -0,0 +1,61 @@
package com.rusefi.board_generator;
import com.rusefi.EnumToString;
import com.rusefi.EnumsReader;
import com.rusefi.enum_reader.Value;
import org.yaml.snakeyaml.Yaml;
import java.io.FileReader;
import java.io.IOException;
import java.util.Collection;
import java.util.Map;
public class BoardReader {
public static void main(String[] args) throws IOException {
Yaml yaml = new Yaml();
Map<String, Object> data = yaml.load(new FileReader("../../firmware/config/boards/microrusefi/mapping.yaml"));
System.out.println(data);
Map<String, Object> outputs = (Map<String, Object>) data.get("outputs");
EnumsReader.process(new FileReader("../../firmware/" + EnumToString.RELATIVE_PATH));
Map<String, Value> s = EnumsReader.enums.get("brain_pin_e");
System.out.println(s.size());
StringBuffer sb = new StringBuffer();
for (int i = 0; i < 255; i++) {
if (sb.length() > 0)
sb.append(",");
String code;
Value v = findByOrdinal(i, s.values());
if (v == null) {
code = "INVALID";
} else if (v.getName().equals("GPIO_UNASSIGNED")) {
code = "NONE";
} else if (outputs.containsKey(v.getName())) {
code = (String) outputs.get(v.getName());
} else {
code = "INVALID";
}
sb.append("\"" + code + "\"");
}
System.out.println(" #define brain_pin_e_enum " + sb);
}
private static Value findByOrdinal(int ordinal, Collection<Value> values) {
for (Value v : values)
if (v.getValue().equals(String.valueOf(ordinal)))
return v;
return null;
}
}

View File

@ -51,9 +51,6 @@ public class JavaFieldsConsumer implements ConfigurationConsumer {
String nameWithPrefix = prefix + configField.getName();
if (configField.getComment() != null && configField.getComment().startsWith(ConfigField.TS_COMMENT_TAG + "")) {
ConfigDefinition.settingContextHelp.append("\t" + nameWithPrefix + " = \"" + configField.getCommentContent() + "\"" + EOL);
}
if (configField.isBit()) {
configField.writeJavaFieldName(javaFieldsWriter, nameWithPrefix, tsPosition);

View File

@ -7,11 +7,12 @@ import java.io.*;
import static com.rusefi.ConfigDefinition.EOL;
public class TSProjectConsumer implements ConfigurationConsumer {
public static final String TS_FILE_INPUT_NAME = "rusefi.input";
private static final String TS_FILE_INPUT_NAME = "rusefi.input";
private static final int LENGTH = 24;
private static final String CONFIG_DEFINITION_START = "CONFIG_DEFINITION_START";
private static final String CONFIG_DEFINITION_END = "CONFIG_DEFINITION_END";
private static final String TS_FILE_OUTPUT_NAME = "rusefi.ini";
public static String TS_FILE_OUTPUT_NAME = "rusefi.ini";
private StringBuilder settingContextHelp = new StringBuilder();
private final CharArrayWriter tsWriter;
private final String tsPath;
@ -24,15 +25,18 @@ public class TSProjectConsumer implements ConfigurationConsumer {
this.state = state;
}
public static int writeTunerStudio(ConfigField configField, String prefix, Writer tsHeader, int tsPosition, ConfigField next, int bitIndex) throws IOException {
private int writeTunerStudio(ConfigField configField, String prefix, Writer tsHeader, int tsPosition, ConfigField next, int bitIndex) throws IOException {
String nameWithPrefix = prefix + configField.getName();
if (configField.getComment() != null && configField.getComment().startsWith(ConfigField.TS_COMMENT_TAG + "")) {
settingContextHelp.append("\t" + nameWithPrefix + " = \"" + configField.getCommentContent() + "\"" + EOL);
}
VariableRegistry.INSTANCE.register(nameWithPrefix + "_offset", tsPosition);
ConfigStructure cs = configField.getState().structures.get(configField.getType());
if (cs != null) {
String extraPrefix = cs.withPrefix ? configField.getName() + "_" : "";
return cs.writeTunerStudio(prefix + extraPrefix, tsHeader, tsPosition);
return writeTunerStudio(cs, prefix + extraPrefix, tsHeader, tsPosition);
}
if (configField.isBit()) {
@ -79,6 +83,18 @@ public class TSProjectConsumer implements ConfigurationConsumer {
return tsPosition;
}
private int writeTunerStudio(ConfigStructure configStructure, String prefix, Writer tsHeader, int tsPosition) throws IOException {
FieldIterator fieldIterator = new FieldIterator();
for (int i = 0; i < configStructure.tsFields.size(); i++) {
ConfigField next = i == configStructure.tsFields.size() - 1 ? ConfigField.VOID : configStructure.tsFields.get(i + 1);
ConfigField cf = configStructure.tsFields.get(i);
tsPosition = writeTunerStudio(cf, prefix, tsHeader, tsPosition, next, fieldIterator.bitState.get());
fieldIterator.bitState.incrementBitIndex(cf, next);
}
return tsPosition;
}
private void writeTunerStudioFile(String tsPath, String fieldsSection) throws IOException {
TsFileContent tsContent = readTsFile(tsPath);
System.out.println("Got " + tsContent.getPrefix().length() + "/" + tsContent.getPostfix().length() + " of " + TS_FILE_INPUT_NAME);
@ -91,9 +107,9 @@ public class TSProjectConsumer implements ConfigurationConsumer {
tsHeader.write("pageSize = " + totalTsSize + ConfigDefinition.EOL);
tsHeader.write("page = 1" + ConfigDefinition.EOL);
tsHeader.write(fieldsSection);
if (ConfigDefinition.settingContextHelp.length() > 0) {
if (settingContextHelp.length() > 0) {
tsHeader.write("[SettingContextHelp]" + ConfigDefinition.EOL);
tsHeader.write(ConfigDefinition.settingContextHelp.toString() + ConfigDefinition.EOL + ConfigDefinition.EOL);
tsHeader.write(settingContextHelp.toString() + ConfigDefinition.EOL + ConfigDefinition.EOL);
}
tsHeader.write("; " + CONFIG_DEFINITION_END + ConfigDefinition.EOL);
tsHeader.write(tsContent.getPostfix());
@ -142,7 +158,7 @@ public class TSProjectConsumer implements ConfigurationConsumer {
@Override
public void handleEndStruct(ConfigStructure structure) throws IOException {
if (state.stack.isEmpty()) {
totalTsSize = structure.writeTunerStudio("", tsWriter, 0);
totalTsSize = writeTunerStudio(structure, "", tsWriter, 0);
tsWriter.write("; total TS size = " + totalTsSize + EOL);
VariableRegistry.INSTANCE.register("TOTAL_CONFIG_SIZE", totalTsSize);
}

View File

@ -3,9 +3,7 @@ package com.rusefi;
import com.rusefi.enum_reader.Value;
import java.io.*;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import java.util.*;
/**
* (c) Andrey Belomutskiy
@ -72,9 +70,9 @@ public class EnumToString {
public static void process(Reader reader) throws IOException {
EnumsReader.process(reader);
for (Map.Entry<String, Set<Value>> e : EnumsReader.enums.entrySet()) {
for (Map.Entry<String, Map<String, Value>> e : EnumsReader.enums.entrySet()) {
String enumName = e.getKey();
cppFileContent.append(makeCode(enumName, e.getValue()));
cppFileContent.append(makeCode(enumName, e.getValue().values()));
EnumToString.headerFileContent.append(getMethodSignature(enumName) + ";\r\n");
}
}
@ -83,7 +81,7 @@ public class EnumToString {
cppFileContent.setLength(0);
}
private static String makeCode(String enumName, Set<Value> values) {
private static String makeCode(String enumName, Collection<Value> values) {
StringBuilder sb = new StringBuilder();
sb.append(getMethodSignature(enumName) + "{\r\n");

View File

@ -5,6 +5,8 @@ import org.junit.Test;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import static com.rusefi.EnumsReader.isKeyValueLine;
@ -28,7 +30,10 @@ public class EnumToStringTest {
"\tGPIO_INVALID = 1,\n" +
"}brain_pin_e;"));
Set<Value> values = EnumsReader.enums.get("brain_pin_e");
List<Value> values = new ArrayList<>(EnumsReader.enums.get("brain_pin_e").values());
assertEquals(2, values.size());
assertEquals("GPIO_INVALID", values.get(0).getName());
assertEquals("1", values.get(0).getValue());
assertEquals("const char *getBrain_pin_e(brain_pin_e value){\r\n" +
"switch(value) {\r\n" +

View File

@ -11,9 +11,9 @@ import java.util.TreeMap;
import java.util.TreeSet;
public class EnumsReader {
private final static Set<Value> currentValues = new TreeSet<>();
private final static Map<String, Value> currentValues = new TreeMap<>();
public final static Map<String, Set<Value>> enums = new TreeMap<>();
public final static Map<String, Map<String, Value>> enums = new TreeMap<>();
public static void process(Reader in) throws IOException {
boolean isInsideEnum = false;
@ -30,17 +30,20 @@ public class EnumsReader {
isInsideEnum = false;
line = line.substring(1, line.length() - 1);
System.out.println("Ending enum " + line);
enums.put(line, new TreeSet<Value>(currentValues));
enums.put(line, new TreeMap<>(currentValues));
} else {
line = line.replaceAll("//.+", "");
if (isInsideEnum) {
if (isKeyValueLine(line)) {
line = line.replace(",", "");
String value = "";
int index = line.indexOf('=');
if (index != -1)
if (index != -1) {
value = line.substring(index + 1);
line = line.substring(0, index);
}
System.out.println("Line " + line);
currentValues.add(new Value(line));
currentValues.put(line, new Value(line, value));
}
}
}

View File

@ -2,17 +2,31 @@ package com.rusefi.enum_reader;
public class Value implements Comparable<Value> {
private final String name;
private String value;
public Value(String name) {
public Value(String name, String value) {
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public String getValue() {
return value;
}
@Override
public int compareTo(Value o) {
return name.compareTo(o.name);
}
@Override
public String toString() {
return "Value{" +
"name='" + name + '\'' +
", value='" + value + '\'' +
'}';
}
}