Merge branch 'master' of https://github.com/rusefi/rusefi
This commit is contained in:
commit
68801865f3
|
@ -69,7 +69,7 @@ pins:
|
||||||
class: outputs
|
class: outputs
|
||||||
ts_name: Injector 1 Output (E15)
|
ts_name: Injector 1 Output (E15)
|
||||||
- id: E1
|
- id: E1
|
||||||
class: analog_inputs
|
class: switch_inputs
|
||||||
ts_name: Clutch Input (E1)
|
ts_name: Clutch Input (E1)
|
||||||
- id: C7
|
- id: C7
|
||||||
class: outputs
|
class: outputs
|
||||||
|
|
|
@ -126,7 +126,7 @@ pins:
|
||||||
- pin: 64
|
- pin: 64
|
||||||
# H144_IN_TPS
|
# H144_IN_TPS
|
||||||
id: EFI_ADC_4
|
id: EFI_ADC_4
|
||||||
class: outputs
|
class: analog_inputs
|
||||||
ts_name: C2-64 - TPS1
|
ts_name: C2-64 - TPS1
|
||||||
function: TPS1
|
function: TPS1
|
||||||
type: av
|
type: av
|
||||||
|
@ -135,7 +135,7 @@ pins:
|
||||||
- pin: 66
|
- pin: 66
|
||||||
# H144_IN_AUX1
|
# H144_IN_AUX1
|
||||||
id: EFI_ADC_8
|
id: EFI_ADC_8
|
||||||
class: outputs
|
class: analog_inputs
|
||||||
ts_name: C2-66 - TPS2
|
ts_name: C2-66 - TPS2
|
||||||
function: TPS2
|
function: TPS2
|
||||||
type: av
|
type: av
|
||||||
|
|
|
@ -11,6 +11,7 @@ pins:
|
||||||
# H144_IN_CLT
|
# H144_IN_CLT
|
||||||
id: EFI_ADC_12
|
id: EFI_ADC_12
|
||||||
type: av
|
type: av
|
||||||
|
class: analog_inputs
|
||||||
ts_name: C3-55 - CLT
|
ts_name: C3-55 - CLT
|
||||||
function: CLT
|
function: CLT
|
||||||
color: purple
|
color: purple
|
||||||
|
@ -19,6 +20,7 @@ pins:
|
||||||
# H144_IN_IAT
|
# H144_IN_IAT
|
||||||
id: EFI_ADC_13
|
id: EFI_ADC_13
|
||||||
type: av
|
type: av
|
||||||
|
class: analog_inputs
|
||||||
ts_name: C3-56 - IAT
|
ts_name: C3-56 - IAT
|
||||||
function: CLT
|
function: CLT
|
||||||
color: purple
|
color: purple
|
||||||
|
|
|
@ -20,8 +20,8 @@ pins:
|
||||||
type: can
|
type: can
|
||||||
|
|
||||||
- pin: 1F
|
- pin: 1F
|
||||||
id: [F9, ADC3_CHANNEL_7]
|
id: [F9]
|
||||||
class: [switch_inputs, analog_inputs]
|
class: [switch_inputs]
|
||||||
ts_name: 1F - Brake/RES1
|
ts_name: 1F - Brake/RES1
|
||||||
function: Brake Switch
|
function: Brake Switch
|
||||||
|
|
||||||
|
@ -127,9 +127,9 @@ pins:
|
||||||
function: CLT sensor
|
function: CLT sensor
|
||||||
|
|
||||||
- pin: 2F
|
- pin: 2F
|
||||||
id: F7
|
# id: F7
|
||||||
class: analog_inputs
|
# class: analog_inputs
|
||||||
ts_name: 2M - KNOCK
|
# ts_name: 2M - KNOCK
|
||||||
function: Knock sens. in
|
function: Knock sens. in
|
||||||
|
|
||||||
- pin: 2H
|
- pin: 2H
|
||||||
|
|
|
@ -116,8 +116,8 @@ pins:
|
||||||
type: ls
|
type: ls
|
||||||
|
|
||||||
- pin: 38
|
- pin: 38
|
||||||
id: [F9, ADC3_CHANNEL_7]
|
id: [F9]
|
||||||
class: [switch_inputs, analog_inputs]
|
class: [switch_inputs]
|
||||||
ts_name: 48 - IN RES1
|
ts_name: 48 - IN RES1
|
||||||
function: IN_RES1
|
function: IN_RES1
|
||||||
|
|
||||||
|
|
|
@ -284,8 +284,8 @@ pins:
|
||||||
color: black W4
|
color: black W4
|
||||||
|
|
||||||
- pin: 4B
|
- pin: 4B
|
||||||
id: [F9, ADC3_CHANNEL_7]
|
id: [F9]
|
||||||
class: [switch_inputs, analog_inputs]
|
class: [switch_inputs]
|
||||||
ts_name: 4B - Brake/RES1 (A7)
|
ts_name: 4B - Brake/RES1 (A7)
|
||||||
function: Brake Switch
|
function: Brake Switch
|
||||||
|
|
||||||
|
|
|
@ -64,9 +64,9 @@ pins:
|
||||||
|
|
||||||
- pin: 9
|
- pin: 9
|
||||||
function: Fuel Level / CLT Analog Input
|
function: Fuel Level / CLT Analog Input
|
||||||
id: F5
|
# id: F5
|
||||||
class: analog_inputs
|
# class: analog_inputs
|
||||||
ts_name: 9 - IN_SENS3
|
# ts_name: 9 - IN_SENS3
|
||||||
color: white
|
color: white
|
||||||
|
|
||||||
- pin: 10
|
- pin: 10
|
||||||
|
|
|
@ -62,15 +62,15 @@ pins:
|
||||||
function: GND
|
function: GND
|
||||||
|
|
||||||
- pin: 1Q
|
- pin: 1Q
|
||||||
id: [F9, ADC3_CHANNEL_7]
|
id: [F9]
|
||||||
class: [switch_inputs, analog_inputs]
|
class: [switch_inputs]
|
||||||
ts_name: 1Q - Brake/RES1
|
ts_name: 1Q - Brake/RES1
|
||||||
function: Brake Switch
|
function: Brake Switch
|
||||||
|
|
||||||
- pin: 1S
|
- pin: 1S
|
||||||
id: F7
|
# id: F7
|
||||||
class: analog_inputs
|
# class: analog_inputs
|
||||||
ts_name: 2M - KNOCK
|
# ts_name: 2M - KNOCK
|
||||||
function: Knock sens. in
|
function: Knock sens. in
|
||||||
|
|
||||||
- pin: 1U
|
- pin: 1U
|
||||||
|
|
|
@ -89,10 +89,10 @@ pins:
|
||||||
type: 12V
|
type: 12V
|
||||||
|
|
||||||
- pin: 16
|
- pin: 16
|
||||||
id: EFI_ADC3_10
|
# id: EFI_ADC3_10
|
||||||
class: analog_inputs
|
# class: analog_inputs
|
||||||
function: Atm Pressure Sensor output to TCU
|
function: Atm Pressure Sensor output to TCU
|
||||||
ts_name: (BUG!) A16 - Atm Pressure Sensor Ain
|
# ts_name: (BUG!) A16 - Atm Pressure Sensor Ain
|
||||||
type: av
|
type: av
|
||||||
|
|
||||||
- pin: 17
|
- pin: 17
|
||||||
|
|
Binary file not shown.
|
@ -34,7 +34,16 @@ public class PinoutLogic {
|
||||||
this.boardYamlFiles = boardYamlFiles;
|
this.boardYamlFiles = boardYamlFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerPins(ArrayList<PinState> listPins, VariableRegistry registry, ReaderState state) {
|
private static Map.Entry<String, Value> find(EnumsReader.EnumState enumList, String id) {
|
||||||
|
for (Map.Entry<String, Value> kv : enumList.entrySet()) {
|
||||||
|
if (kv.getKey().equals(id)) {
|
||||||
|
return kv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void registerPins(String boardName, ArrayList<PinState> listPins, VariableRegistry registry, ReaderState state) {
|
||||||
if (listPins == null || listPins.isEmpty()) {
|
if (listPins == null || listPins.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -54,17 +63,17 @@ public class PinoutLogic {
|
||||||
String pinType = listPinType.getPinType();
|
String pinType = listPinType.getPinType();
|
||||||
EnumsReader.EnumState enumList = state.enumsReader.getEnums().get(pinType);
|
EnumsReader.EnumState enumList = state.enumsReader.getEnums().get(pinType);
|
||||||
Objects.requireNonNull(enumList, "Enum for " + pinType);
|
Objects.requireNonNull(enumList, "Enum for " + pinType);
|
||||||
for (Map.Entry<String, Value> kv : enumList.entrySet()) {
|
Map.Entry<String, Value> kv = find(enumList, id);
|
||||||
if (kv.getKey().equals(id)) {
|
if (kv == null) {
|
||||||
|
throw new IllegalStateException(boardName + ": Not found " + id + " in " + className);
|
||||||
|
}
|
||||||
|
|
||||||
int index = kv.getValue().getIntValue();
|
int index = kv.getValue().getIntValue();
|
||||||
classList.ensureCapacity(index + 1);
|
classList.ensureCapacity(index + 1);
|
||||||
for (int ii = classList.size(); ii <= index; ii++) {
|
for (int ii = classList.size(); ii <= index; ii++) {
|
||||||
classList.add(null);
|
classList.add(null);
|
||||||
}
|
}
|
||||||
classList.set(index, listPin.getPinTsName());
|
classList.set(index, listPin.getPinTsName());
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (Map.Entry<String, ArrayList<String>> kv : names.entrySet()) {
|
for (Map.Entry<String, ArrayList<String>> kv : names.entrySet()) {
|
||||||
PinType namePinType = PinType.find(kv.getKey());
|
PinType namePinType = PinType.find(kv.getKey());
|
||||||
|
@ -176,20 +185,23 @@ public class PinoutLogic {
|
||||||
PinState thisPin = new PinState(id, pinTsName, pinClass);
|
PinState thisPin = new PinState(id, pinTsName, pinClass);
|
||||||
globalList.add(thisPin);
|
globalList.add(thisPin);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
PinoutLogic logic = create("hellen-gm-e67","../../firmware/config/boards/hellen/");
|
String boardName = "hellen-gm-e67";
|
||||||
|
PinoutLogic logic = create(boardName,"../../firmware/config/boards/hellen/");
|
||||||
logic.readFiles();
|
logic.readFiles();
|
||||||
log.info(logic.toString());
|
log.info(logic.toString());
|
||||||
|
|
||||||
registerPins(logic.globalList, new VariableRegistry(), new ReaderState());
|
registerPins(boardName, logic.globalList, new VariableRegistry(), new ReaderState());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public static PinoutLogic create(String boardName, String rootFolder) {
|
public static PinoutLogic create(String boardName, String rootFolder) {
|
||||||
String dirPath = rootFolder + boardName + PinoutLogic.CONNECTORS;
|
String dirPath = rootFolder + boardName + PinoutLogic.CONNECTORS;
|
||||||
File dirName = new File(dirPath);
|
File dirName = new File(dirPath);
|
||||||
FilenameFilter filter = (f, name) -> name.endsWith(".yaml");
|
FilenameFilter filter = (f, name) -> name.endsWith(".yaml");
|
||||||
File[] boardYamlFiles = dirName.listFiles(filter);
|
File[] boardYamlFiles = dirName.listFiles(filter);
|
||||||
|
Arrays.sort(boardYamlFiles);
|
||||||
if (boardYamlFiles == null) {
|
if (boardYamlFiles == null) {
|
||||||
log.info("No yaml files in " + dirPath);
|
log.info("No yaml files in " + dirPath);
|
||||||
return null;
|
return null;
|
||||||
|
@ -199,7 +211,7 @@ public class PinoutLogic {
|
||||||
|
|
||||||
public void registerBoardSpecificPinNames(VariableRegistry registry, ReaderState state) throws IOException {
|
public void registerBoardSpecificPinNames(VariableRegistry registry, ReaderState state) throws IOException {
|
||||||
readFiles();
|
readFiles();
|
||||||
registerPins(globalList, registry, state);
|
registerPins(boardName, globalList, registry, state);
|
||||||
|
|
||||||
try (FileWriter getTsNameByIdFile = new FileWriter(PinoutLogic.CONFIG_BOARDS + boardName + PinoutLogic.CONNECTORS + File.separator + "generated_ts_name_by_pin.cpp")) {
|
try (FileWriter getTsNameByIdFile = new FileWriter(PinoutLogic.CONFIG_BOARDS + boardName + PinoutLogic.CONNECTORS + File.separator + "generated_ts_name_by_pin.cpp")) {
|
||||||
getTsNameByIdFile.append(header);
|
getTsNameByIdFile.append(header);
|
||||||
|
|
Loading…
Reference in New Issue