all triggers should be documented way nicer #2001
This commit is contained in:
parent
e61c79c378
commit
7855847a3f
|
@ -220,11 +220,11 @@ typedef enum {
|
|||
/**
|
||||
* https://rusefi.com/wiki/index.php?title=Manual:Software:Trigger#Mazda_Miata_NA
|
||||
*/
|
||||
TT_MAZDA_MIATA_NA = 3,
|
||||
TT_MAZDA_MIATA_NA = TT_TT_MAZDA_MIATA_NA,
|
||||
/**
|
||||
* NB1 means non-VVT NB, 99 and 00 1.8 engine
|
||||
*/
|
||||
TT_MAZDA_MIATA_NB1 = 4,
|
||||
TT_MAZDA_MIATA_NB1 = TT_TT_MAZDA_MIATA_NB1,
|
||||
TT_GM_7X = 5,
|
||||
TT_MINI_COOPER_R50 = 6,
|
||||
TT_MAZDA_SOHC_4 = 7,
|
||||
|
|
|
@ -386,10 +386,13 @@ struct ThermistorConf @brief Thermistor curve parameters
|
|||
end_struct
|
||||
|
||||
#define TT_TT_TOOTHED_WHEEL 0
|
||||
#define TT_TT_FORD_ASPIRE 1
|
||||
#define TT_TT_MAZDA_MIATA_NA 3
|
||||
#define TT_TT_MAZDA_MIATA_NB1 4
|
||||
#define TT_TT_GM_7X 7
|
||||
#define TT_TT_TOOTHED_WHEEL_60_2 8
|
||||
#define TT_TT_TOOTHED_WHEEL_36_1 9
|
||||
#define TT_TT_MAZDA_DOHC_1_4 15
|
||||
#define TT_TT_ONE 18
|
||||
#define TT_TT_60_2_VW 20
|
||||
#define TT_TT_36_2_2_2 23
|
||||
|
|
|
@ -39,6 +39,30 @@ public class TriggerImage {
|
|||
*/
|
||||
public static int EXTRA_COUNT = 1;
|
||||
|
||||
private static String getTriggerName(TriggerWheelInfo triggerName) {
|
||||
switch (triggerName.id) {
|
||||
case Fields.TT_TT_MAZDA_MIATA_NA:
|
||||
return "Miata NA";
|
||||
case Fields.TT_TT_MAZDA_MIATA_NB1:
|
||||
return "Miata NB";
|
||||
case Fields.TT_TT_SUBARU_7_6:
|
||||
return "Subaru 7/6";
|
||||
case Fields.TT_TT_GM_LS_24:
|
||||
return "GM 24x";
|
||||
case Fields.TT_TT_ONE:
|
||||
return "Single Tooth";
|
||||
case Fields.TT_TT_2JZ_1_12:
|
||||
return "2JZ 1/12";
|
||||
case Fields.TT_TT_JEEP_18_2_2_2:
|
||||
return "18/2/2/2";
|
||||
case Fields.TT_TT_RENIX_44_2_2:
|
||||
return "44/2/2";
|
||||
case Fields.TT_TT_RENIX_66_2_2_2:
|
||||
return "66/2/2/2";
|
||||
}
|
||||
return triggerName.triggerName;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws InvocationTargetException, InterruptedException {
|
||||
final String workingFolder;
|
||||
if (args.length != 1) {
|
||||
|
@ -57,7 +81,7 @@ public class TriggerImage {
|
|||
}
|
||||
};
|
||||
|
||||
JPanel topPanel = new JPanel();
|
||||
JPanel topPanel = new JPanel(new FlowLayout());
|
||||
content.add(topPanel, BorderLayout.NORTH);
|
||||
content.add(triggerPanel, BorderLayout.CENTER);
|
||||
|
||||
|
@ -100,16 +124,19 @@ public class TriggerImage {
|
|||
// if (triggerWheelInfo.id != Fields.TT_TT_SUBARU_7_6)
|
||||
// return;
|
||||
|
||||
List<TriggerSignal> firstWheel = triggerWheelInfo.signals.stream().filter(signal -> signal.waveIndex == 0).collect(Collectors.toList());
|
||||
|
||||
if (1 == 1) {
|
||||
firstWheel = compressAngle(firstWheel);
|
||||
}
|
||||
|
||||
JPanel clock = createWheelPanel(firstWheel);
|
||||
|
||||
topPanel.removeAll();
|
||||
topPanel.add(clock);
|
||||
|
||||
JPanel firstWheelControl = createWheelPanel(triggerWheelInfo.getFirstWheeTriggerSignals());
|
||||
|
||||
topPanel.add(firstWheelControl);
|
||||
topPanel.add(StartupFrame.createLogoLabel());
|
||||
|
||||
if (!triggerWheelInfo.waves.get(1).list.isEmpty()) {
|
||||
JPanel secondWheelControl = createWheelPanel(triggerWheelInfo.getSecondWheeTriggerSignals());
|
||||
topPanel.add(secondWheelControl);
|
||||
}
|
||||
|
||||
UiUtils.trueLayout(topPanel);
|
||||
UiUtils.trueLayout(content);
|
||||
|
||||
|
@ -160,11 +187,6 @@ public class TriggerImage {
|
|||
UiUtils.saveImage(OUTPUT_FOLDER + File.separator + "trigger_" + triggerWheelInfo.id + ".png", content);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static List<TriggerSignal> compressAngle(List<TriggerSignal> firstWheel) {
|
||||
return firstWheel.stream().map(triggerSignal -> new TriggerSignal(triggerSignal.waveIndex, triggerSignal.state, triggerSignal.angle / 2)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static JPanel createWheelPanel(List<TriggerSignal> wheel) {
|
||||
JPanel clock = new JPanel() {
|
||||
|
@ -178,7 +200,7 @@ public class TriggerImage {
|
|||
|
||||
drawRadialLine(g, current.angle);
|
||||
|
||||
double nextAngle = i == wheel.size() - 1 ? 360 : wheel.get(i + 1).angle;
|
||||
double nextAngle = i == wheel.size() - 1 ? 360 + wheel.get(0).angle : wheel.get(i + 1).angle;
|
||||
int arcDuration = (int) (nextAngle - current.angle);
|
||||
if (current.state == 0) {
|
||||
g.drawArc(WHEEL_BORDER, WHEEL_BORDER, WHEEL_DIAMETER, WHEEL_DIAMETER, (int) current.angle, arcDuration);
|
||||
|
@ -194,7 +216,7 @@ public class TriggerImage {
|
|||
return new Dimension(WHEEL_DIAMETER + 2 * WHEEL_BORDER, WHEEL_DIAMETER + 2 * WHEEL_BORDER);
|
||||
}
|
||||
};
|
||||
clock.setBackground(Color.orange);
|
||||
// clock.setBackground(Color.orange);
|
||||
return clock;
|
||||
}
|
||||
|
||||
|
@ -213,14 +235,6 @@ public class TriggerImage {
|
|||
g.drawLine(center + smallX, center + smallY, center + largeX, center + largeY);
|
||||
}
|
||||
|
||||
private static String getTriggerName(TriggerWheelInfo triggerName) {
|
||||
switch (triggerName.id) {
|
||||
case Fields.TT_TT_SUBARU_7_6:
|
||||
return "Subaru 7/6";
|
||||
}
|
||||
return triggerName.triggerName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static List<WaveState> convertSignalsToWaves(List<TriggerSignal> signals) {
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.trigger.WaveState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class TriggerWheelInfo {
|
||||
final int id;
|
||||
|
@ -39,4 +42,49 @@ class TriggerWheelInfo {
|
|||
|
||||
return new TriggerWheelInfo(id, tdcPosition, triggerName, waves, signals);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
List<TriggerSignal> getFirstWheeTriggerSignals() {
|
||||
List<TriggerSignal> firstWheel = getTriggerSignals(0);
|
||||
if (isFirstCrankBased()) {
|
||||
return takeFirstHalf(firstWheel);
|
||||
} else {
|
||||
return compressAngle(firstWheel);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private List<TriggerSignal> getTriggerSignals(int index) {
|
||||
return signals.stream().filter(signal -> signal.waveIndex == index).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private List<TriggerSignal> takeFirstHalf(List<TriggerSignal> wheel) {
|
||||
return wheel.stream().filter(triggerSignal -> triggerSignal.angle < 360).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* this is about converting 720 cycle of crank wheel shape into normal 360 circle range
|
||||
*/
|
||||
@NotNull
|
||||
private static List<TriggerSignal> compressAngle(List<TriggerSignal> wheel) {
|
||||
return wheel.stream().map(triggerSignal -> new TriggerSignal(triggerSignal.waveIndex, triggerSignal.state, triggerSignal.angle / 2)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<TriggerSignal> getSecondWheeTriggerSignals() {
|
||||
List<TriggerSignal> secondWheel = getTriggerSignals(1);
|
||||
if (isSecondCamBased()) {
|
||||
return compressAngle(secondWheel);
|
||||
} else {
|
||||
return takeFirstHalf(secondWheel);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isFirstCrankBased() {
|
||||
return id == Fields.TT_TT_GM_LS_24;
|
||||
}
|
||||
|
||||
private boolean isSecondCamBased() {
|
||||
return id == Fields.TT_TT_MAZDA_MIATA_NA;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue