updated maf scaler

git-svn-id: https://svn2.assembla.com/svn/romraider/trunk@4 38686702-15cf-42e4-a595-3071df8bf5ea
This commit is contained in:
kascade 2008-04-02 11:35:05 +00:00
parent 49cc37e19e
commit c2a7570f2a
4 changed files with 43 additions and 7 deletions

View File

@ -50,16 +50,28 @@ public final class MafUpdateHandler implements DataUpdateHandler {
valid = mafTab.isValidMaf(maf);
}
// intake air temp check
if (valid && containsData(response, "P11")) {
double temp = findValue(response, "P11");
valid = mafTab.isValidIntakeAirTemp(temp);
}
// coolant temp check
if (valid && containsData(response, "P2")) {
double temp = findValue(response, "P2");
valid = mafTab.isValidCoolantTemp(temp);
}
// intake air temp check
if (valid && containsData(response, "P11")) {
double temp = findValue(response, "P11");
valid = mafTab.isValidIntakeAirTemp(temp);
// tip-in throttle check
if ((containsData(response, "E23") || containsData(response, "E49"))) {
double tipIn = -1;
if (containsData(response, "E23")) {
tipIn = (int) findValue(response, "E23");
}
if (containsData(response, "E49")) {
tipIn = (int) findValue(response, "E49");
}
valid = mafTab.isValidTipInThrottle(tipIn);
}
if (valid) {

View File

@ -51,6 +51,8 @@ public final class MafControlPanel extends JPanel {
private static final String AFR = "P58";
private static final String CL_OL_16 = "E3";
private static final String CL_OL_32 = "E27";
private static final String TIP_IN_THROTTLE_16 = "E23";
private static final String TIP_IN_THROTTLE_32 = "E49";
private final JToggleButton recordDataButton = new JToggleButton("Record Data");
private final JTextField mafvMin = new JTextField("1.20", 3);
private final JTextField mafvMax = new JTextField("2.60", 3);
@ -63,6 +65,7 @@ public final class MafControlPanel extends JPanel {
private final JTextField iatMin = new JTextField("25", 3);
private final JTextField iatMax = new JTextField("35", 3);
private final JTextField coolantMin = new JTextField("70", 3);
private final JTextField tipInMax = new JTextField("0", 3);
private final JCheckBox clCheckbox = new JCheckBox("Closed Loop Only", true);
private final Component parent;
private final XYTrendline trendline;
@ -115,6 +118,10 @@ public final class MafControlPanel extends JPanel {
return checkInRange("Intake Air Temp.", iatMin, iatMax, value);
}
public boolean isValidTipInThrottle(double value) {
return checkLessThan("Tip-In Throttle", tipInMax, value);
}
private boolean checkInRange(String name, JTextField min, JTextField max, double value) {
if (isValidRange(min, max)) {
return inRange(value, min, max);
@ -135,6 +142,16 @@ public final class MafControlPanel extends JPanel {
}
}
private boolean checkLessThan(String name, JTextField max, double value) {
if (isNumber(max)) {
return value <= parseDouble(max);
} else {
showMessageDialog(parent, "Invalid " + name + " specified.", "Error", ERROR_MESSAGE);
recordDataButton.setSelected(false);
return false;
}
}
private void addControls() {
JPanel panel = new JPanel();
@ -208,7 +225,8 @@ public final class MafControlPanel extends JPanel {
addMinMaxFilter(panel, gridBagLayout, "MAF Range (g/s)", mafMin, mafMax, 7);
addMinMaxFilter(panel, gridBagLayout, "IAT Range", iatMin, iatMax, 10);
addLabeledComponent(panel, gridBagLayout, "Min. Coolant Temp.", coolantMin, 13);
addComponent(panel, gridBagLayout, buildRecordDataButton(), 16);
addLabeledComponent(panel, gridBagLayout, "Max. Tip-In Throttle", tipInMax, 16);
addComponent(panel, gridBagLayout, buildRecordDataButton(), 19);
return panel;
}
@ -217,9 +235,9 @@ public final class MafControlPanel extends JPanel {
recordDataButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
if (recordDataButton.isSelected()) {
registerData(COOLANT_TEMP, AF_CORRECTION_1, AF_LEARNING_1, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, AFR, CL_OL_16, CL_OL_32);
registerData(COOLANT_TEMP, AF_CORRECTION_1, AF_LEARNING_1, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, AFR, CL_OL_16, CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32);
} else {
deregisterData(COOLANT_TEMP, AF_CORRECTION_1, AF_LEARNING_1, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, AFR, CL_OL_16, CL_OL_32);
deregisterData(COOLANT_TEMP, AF_CORRECTION_1, AF_LEARNING_1, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, AFR, CL_OL_16, CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32);
}
}
});

View File

@ -21,6 +21,8 @@ public interface MafTab extends Tab {
boolean isValidIntakeAirTemp(double value);
boolean isValidTipInThrottle(double value);
void addData(double mafv, double correction);
void setEcuParams(List<EcuParameter> params);

View File

@ -61,6 +61,10 @@ public final class MafTabImpl extends JPanel implements MafTab {
return controlPanel.isValidIntakeAirTemp(value);
}
public boolean isValidTipInThrottle(double value) {
return controlPanel.isValidTipInThrottle(value);
}
public void addData(double mafv, double correction) {
series.add(mafv, correction);
}