mirror of https://github.com/rusefi/RomRaider.git
Checking in so I can work on ecu def branch
git-svn-id: https://svn2.assembla.com/svn/romraider/branches/dev_olmaf@318 38686702-15cf-42e4-a595-3071df8bf5ea
This commit is contained in:
parent
b4dc09027f
commit
41e062e400
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<settings>
|
||||
<window>
|
||||
<maximized value="false"/>
|
||||
<size x="600" y="800"/>
|
||||
<location x="400" y="150"/>
|
||||
<splitpane location="150"/>
|
||||
</window>
|
||||
<files>
|
||||
<image_dir path="C:\workspace\romraider\images"/>
|
||||
</files>
|
||||
<options>
|
||||
<obsoletewarning value="true"/>
|
||||
<calcconflictwarning value="true"/>
|
||||
<debug value="false"/>
|
||||
<userlevel value="1"/>
|
||||
<tableclickcount value="1"/>
|
||||
<version value="0.5.3 Beta RC7"/>
|
||||
<savedebugtables value="true"/>
|
||||
<displayhightables value="true"/>
|
||||
<valuelimitwarning value="true"/>
|
||||
</options>
|
||||
<tabledisplay>
|
||||
<font face="Arial" size="11" decoration="1"/>
|
||||
<cellsize height="18" width="42"/>
|
||||
<colors>
|
||||
<max r="255" g="102" b="102"/>
|
||||
<min r="153" g="153" b="255"/>
|
||||
<highlight r="204" g="204" b="204"/>
|
||||
<increaseborder r="255" g="0" b="0"/>
|
||||
<decreaseborder r="0" g="0" b="255"/>
|
||||
<axis r="255" g="255" b="255"/>
|
||||
<warning r="255" g="0" b="0"/>
|
||||
</colors>
|
||||
</tabledisplay>
|
||||
<logger>
|
||||
<serial port="" refresh="true"/>
|
||||
<maximized value="false"/>
|
||||
<size x="600" y="1000"/>
|
||||
<location x="0" y="0"/>
|
||||
<tabs selected="0" showlist="true"/>
|
||||
<definition path=""/>
|
||||
<profile path=""/>
|
||||
<filelogging path="C:\Users\owner" switchid="S20" active="true" absolutetimestamp="false"/>
|
||||
</logger>
|
||||
</settings>
|
|
@ -139,6 +139,7 @@ import com.romraider.logger.ecu.ui.handler.injector.InjectorUpdateHandler;
|
|||
import com.romraider.logger.ecu.ui.handler.livedata.LiveDataTableModel;
|
||||
import com.romraider.logger.ecu.ui.handler.livedata.LiveDataUpdateHandler;
|
||||
import com.romraider.logger.ecu.ui.handler.maf.MafUpdateHandler;
|
||||
import com.romraider.logger.ecu.ui.handler.maf.OLMafUpdateHandler;
|
||||
import com.romraider.logger.ecu.ui.handler.table.TableUpdateHandler;
|
||||
import com.romraider.logger.ecu.ui.paramlist.ParameterListTable;
|
||||
import com.romraider.logger.ecu.ui.paramlist.ParameterListTableModel;
|
||||
|
@ -219,6 +220,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
private DashboardUpdateHandler dashboardUpdateHandler;
|
||||
private MafTab mafTab;
|
||||
private MafUpdateHandler mafUpdateHandler;
|
||||
private OLMafUpdateHandler olMafUpdateHandler;
|
||||
private DataUpdateHandlerManager mafHandlerManager;
|
||||
private DataRegistrationBroker mafTabBroker;
|
||||
private InjectorTab injectorTab;
|
||||
|
@ -296,15 +298,17 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
dashboardPanel = new JPanel(new BetterFlowLayout(FlowLayout.CENTER, 3, 3));
|
||||
dashboardUpdateHandler = new DashboardUpdateHandler(dashboardPanel);
|
||||
mafUpdateHandler = new MafUpdateHandler();
|
||||
olMafUpdateHandler = new OLMafUpdateHandler();
|
||||
injectorUpdateHandler = new InjectorUpdateHandler();
|
||||
dynoUpdateHandler = new DynoUpdateHandler();
|
||||
controller = new LoggerControllerImpl(settings, ecuInitCallback, this, liveDataUpdateHandler,
|
||||
graphUpdateHandler, dashboardUpdateHandler, mafUpdateHandler, injectorUpdateHandler,
|
||||
graphUpdateHandler, dashboardUpdateHandler, mafUpdateHandler, olMafUpdateHandler, injectorUpdateHandler,
|
||||
dynoUpdateHandler, fileUpdateHandler, TableUpdateHandler.getInstance());
|
||||
mafHandlerManager = new DataUpdateHandlerManagerImpl();
|
||||
mafTabBroker = new DataRegistrationBrokerImpl(controller, mafHandlerManager);
|
||||
mafTab = new MafTabImpl(mafTabBroker, ecuEditor);
|
||||
mafUpdateHandler.setMafTab(mafTab);
|
||||
olMafUpdateHandler.setMafTab(mafTab);
|
||||
injectorHandlerManager = new DataUpdateHandlerManagerImpl();
|
||||
injectorTabBroker = new DataRegistrationBrokerImpl(controller, injectorHandlerManager);
|
||||
injectorTab = new InjectorTabImpl(injectorTabBroker, ecuEditor);
|
||||
|
@ -871,7 +875,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
ThreadUtil.runAsDaemon(new Runnable() {
|
||||
public void run() {
|
||||
PlaybackManagerImpl playbackManager = new PlaybackManagerImpl(ecuParams, liveDataUpdateHandler, graphUpdateHandler, dashboardUpdateHandler, mafUpdateHandler, dynoUpdateHandler,
|
||||
PlaybackManagerImpl playbackManager = new PlaybackManagerImpl(ecuParams, liveDataUpdateHandler, graphUpdateHandler, dashboardUpdateHandler, mafUpdateHandler, olMafUpdateHandler, dynoUpdateHandler,
|
||||
TableUpdateHandler.getInstance());
|
||||
playbackManager.load(new File("foo.csv"));
|
||||
playbackManager.play();
|
||||
|
|
|
@ -57,7 +57,11 @@ public final class MafUpdateHandler implements DataUpdateHandler {
|
|||
clOl = (int) findValue(response, "E33");
|
||||
LOGGER.trace("MAF:[CL/OL:E33]: " + clOl);
|
||||
}
|
||||
valid = mafTab.isValidClOl(clOl);
|
||||
if (mafTab.methodIsCl()) {
|
||||
valid = mafTab.isValidClOl(clOl);
|
||||
} else {
|
||||
valid = false;
|
||||
}
|
||||
LOGGER.trace("MAF:[CL/OL]: " + valid);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,196 @@
|
|||
/*
|
||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||
* Copyright (C) 2006-2010 RomRaider.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package com.romraider.logger.ecu.ui.handler.maf;
|
||||
|
||||
import com.romraider.logger.ecu.comms.query.Response;
|
||||
import com.romraider.logger.ecu.definition.LoggerData;
|
||||
import com.romraider.logger.ecu.ui.handler.DataUpdateHandler;
|
||||
import com.romraider.logger.ecu.ui.tab.maf.MafTab;
|
||||
import static java.lang.Math.abs;
|
||||
import static java.lang.System.currentTimeMillis;
|
||||
import org.apache.log4j.Logger;
|
||||
import static org.apache.log4j.Logger.getLogger;
|
||||
import javax.swing.SwingUtilities;
|
||||
import java.util.Set;
|
||||
|
||||
public final class OLMafUpdateHandler implements DataUpdateHandler {
|
||||
private static final Logger LOGGER = getLogger(OLMafUpdateHandler.class);
|
||||
private static final String MAFV = "P18";
|
||||
private static final String OL_FUELING_BASE_16 = "E124";
|
||||
private static final String OL_FUELING_BASE_32 = "E123";
|
||||
private MafTab mafTab;
|
||||
private double lastMafv;
|
||||
private long lastUpdate;
|
||||
|
||||
public synchronized void registerData(LoggerData loggerData) {
|
||||
}
|
||||
|
||||
public synchronized void handleDataUpdate(Response response) {
|
||||
if (mafTab.isRecordData() && ( containsData(response, MAFV, OL_FUELING_BASE_16) || containsData(response, MAFV, OL_FUELING_BASE_32) )) {
|
||||
boolean valid = true;
|
||||
|
||||
// cl/ol check
|
||||
if ((containsData(response, "E3") || containsData(response, "E33"))) {
|
||||
double clOl = -1;
|
||||
if (containsData(response, "E3")) {
|
||||
clOl = (int) findValue(response, "E3");
|
||||
LOGGER.trace("MAF:[CL/OL:E3]: " + clOl);
|
||||
}
|
||||
if (containsData(response, "E33")) {
|
||||
clOl = (int) findValue(response, "E33");
|
||||
LOGGER.trace("MAF:[CL/OL:E33]: " + clOl);
|
||||
}
|
||||
if (!mafTab.methodIsCl()) {
|
||||
valid = mafTab.isValidClOl(clOl);
|
||||
} else {
|
||||
valid = false;
|
||||
}
|
||||
LOGGER.trace("MAF:[CL/OL]: " + valid);
|
||||
}
|
||||
|
||||
// afr check
|
||||
String afrId = mafTab.getSelectedAfrSource().getId();
|
||||
if (valid && containsData(response, afrId)) {
|
||||
double afr = findValue(response, afrId);
|
||||
LOGGER.trace("MAF:[AFR:" + afrId + "]: " + afr);
|
||||
valid = mafTab.isValidAfr(afr);
|
||||
LOGGER.trace("MAF:[AFR]: " + valid);
|
||||
}
|
||||
|
||||
// rpm check
|
||||
if (valid && containsData(response, "P8")) {
|
||||
double rpm = findValue(response, "P8");
|
||||
LOGGER.trace("MAF:[RPM:P8]: " + rpm);
|
||||
valid = mafTab.isValidRpm(rpm);
|
||||
LOGGER.trace("MAF:[RPM]: " + valid);
|
||||
}
|
||||
|
||||
// maf check
|
||||
if (valid && containsData(response, "P12")) {
|
||||
double maf = findValue(response, "P12");
|
||||
LOGGER.trace("MAF:[MAF:P12]: " + maf);
|
||||
valid = mafTab.isValidMaf(maf);
|
||||
LOGGER.trace("MAF:[MAF]: " + valid);
|
||||
}
|
||||
|
||||
// intake air temp check
|
||||
if (valid && containsData(response, "P11")) {
|
||||
double temp = findValue(response, "P11");
|
||||
LOGGER.trace("MAF:[IAT:P11]: " + temp);
|
||||
valid = mafTab.isValidIntakeAirTemp(temp);
|
||||
LOGGER.trace("MAF:[IAT]: " + valid);
|
||||
}
|
||||
|
||||
// coolant temp check
|
||||
if (valid && containsData(response, "P2")) {
|
||||
double temp = findValue(response, "P2");
|
||||
LOGGER.trace("MAF:[CT:P2]: " + temp);
|
||||
valid = mafTab.isValidCoolantTemp(temp);
|
||||
LOGGER.trace("MAF:[CT]: " + valid);
|
||||
}
|
||||
|
||||
// dMAFv/dt check
|
||||
if (valid && containsData(response, "P18")) {
|
||||
double mafv = findValue(response, "P18");
|
||||
long now = currentTimeMillis();
|
||||
double mafvChange = abs((mafv - lastMafv) / (now - lastUpdate) * 1000);
|
||||
LOGGER.trace("MAF:[dMAFv/dt]: " + mafvChange);
|
||||
valid = mafTab.isValidMafvChange(mafvChange);
|
||||
LOGGER.trace("MAF:[dMAFv/dt]: " + valid);
|
||||
lastMafv = mafv;
|
||||
lastUpdate = now;
|
||||
}
|
||||
|
||||
// tip-in throttle check
|
||||
if (valid && (containsData(response, "E23") || containsData(response, "E54"))) {
|
||||
double tipIn = -1;
|
||||
if (containsData(response, "E23")) {
|
||||
tipIn = findValue(response, "E23");
|
||||
LOGGER.trace("MAF:[TIP:E23]: " + tipIn);
|
||||
}
|
||||
if (containsData(response, "E54")) {
|
||||
tipIn = findValue(response, "E54");
|
||||
LOGGER.trace("MAF:[TIP:E54]: " + tipIn);
|
||||
}
|
||||
valid = mafTab.isValidTipInThrottle(tipIn);
|
||||
LOGGER.trace("MAF:[TIP]: " + valid);
|
||||
}
|
||||
|
||||
if (valid) {
|
||||
final double mafv = findValue(response, MAFV);
|
||||
final double afrActual = findValue(response, mafTab.getSelectedAfrSource().getId());
|
||||
double afrTarget = 0.0;
|
||||
if (containsData(response, OL_FUELING_BASE_16)) {
|
||||
afrTarget = findValue(response, OL_FUELING_BASE_16);
|
||||
} else if (containsData(response, OL_FUELING_BASE_32)) {
|
||||
afrTarget = findValue(response, OL_FUELING_BASE_32);
|
||||
}
|
||||
final double afrError = ( afrTarget - afrActual) / afrTarget;
|
||||
|
||||
LOGGER.trace("MAF Data: " + mafv + "v, " + afrError + "%");
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
mafTab.addData(mafv, afrError);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean containsData(Response response, String... ids) {
|
||||
Set<LoggerData> datas = response.getData();
|
||||
for (String id : ids) {
|
||||
boolean found = false;
|
||||
for (LoggerData data : datas) {
|
||||
if (data.getId().equals(id)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private double findValue(Response response, String id) {
|
||||
for (LoggerData loggerData : response.getData()) {
|
||||
if (id.equals(loggerData.getId())) {
|
||||
return response.getDataValue(loggerData);
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("Expected data item " + id + " not in response.");
|
||||
}
|
||||
|
||||
public synchronized void deregisterData(LoggerData loggerData) {
|
||||
}
|
||||
|
||||
public synchronized void cleanUp() {
|
||||
}
|
||||
|
||||
public synchronized void reset() {
|
||||
}
|
||||
|
||||
public void setMafTab(MafTab mafTab) {
|
||||
this.mafTab = mafTab;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||
* Copyright (C) 2006-2010 RomRaider.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -65,15 +65,23 @@ public final class MafControlPanel extends JPanel {
|
|||
private static final String COOLANT_TEMP = "P2";
|
||||
private static final String AF_CORRECTION_1 = "P3";
|
||||
private static final String AF_LEARNING_1 = "P4";
|
||||
private static final String OL_FUELING_BASE_16 = "E124";
|
||||
private static final String OL_FUELING_BASE_32 = "E123";
|
||||
private static final String ENGINE_SPEED = "P8";
|
||||
private static final String INTAKE_AIR_TEMP = "P11";
|
||||
private static final String MASS_AIR_FLOW = "P12";
|
||||
private static final String MASS_AIR_FLOW_V = "P18";
|
||||
private static final String AFR = "P58";
|
||||
private static final String TGV_LEFT = "P40";
|
||||
private static final String TGV_RIGHT = "P39";
|
||||
private static final String CL_OL_16 = "E3";
|
||||
private static final String CL_OL_32 = "E33";
|
||||
private static final String TIP_IN_THROTTLE_16 = "E23";
|
||||
private static final String TIP_IN_THROTTLE_32 = "E54";
|
||||
public static final int CLOL_CLOSED_LOOP_NORMAL = 8;
|
||||
public static final int CLOL_OPEN_LOOP_NORMAL = 10;
|
||||
public static final int CLOL_OPEN_LOOP_COOLANT = 7;
|
||||
public static final int CLOL_OPEN_LOOP_SYSTEM = 14;
|
||||
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);
|
||||
|
@ -86,6 +94,8 @@ public final class MafControlPanel extends JPanel {
|
|||
private final JTextField iatMax = new JTextField("45", 3);
|
||||
private final JTextField coolantMin = new JTextField("70", 3);
|
||||
private final JTextField mafvChangeMax = new JTextField("0.1", 3);
|
||||
private final JTextField mafCorrectionFactor = new JTextField("100", 3);
|
||||
private final JComboBox clolSelect = new JComboBox();
|
||||
private final JComboBox afrSourceList = new JComboBox();
|
||||
private final DataRegistrationBroker broker;
|
||||
private final LoggerChartPanel chartPanel;
|
||||
|
@ -109,7 +119,15 @@ public final class MafControlPanel extends JPanel {
|
|||
}
|
||||
|
||||
public boolean isValidClOl(double value) {
|
||||
return value == 8;
|
||||
if (afrSourceList.getSelectedItem().equals("Closed Loop")) {
|
||||
return value == CLOL_CLOSED_LOOP_NORMAL;
|
||||
} else {
|
||||
return value == CLOL_OPEN_LOOP_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean methodIsCl() {
|
||||
return afrSourceList.getSelectedItem().equals("Closed Loop");
|
||||
}
|
||||
|
||||
public boolean isValidAfr(double value) {
|
||||
|
@ -180,16 +198,11 @@ public final class MafControlPanel extends JPanel {
|
|||
GridBagLayout gridBagLayout = new GridBagLayout();
|
||||
panel.setLayout(gridBagLayout);
|
||||
|
||||
// add(panel, gridBagLayout, buildAfrSourcePanel(), 0, 0, 1, HORIZONTAL);
|
||||
// add(panel, gridBagLayout, buildFilterPanel(), 0, 1, 1, HORIZONTAL);
|
||||
// add(panel, gridBagLayout, buildInterpolatePanel(), 0, 2, 1, HORIZONTAL);
|
||||
// add(panel, gridBagLayout, buildUpdateMafPanel(), 0, 3, 1, HORIZONTAL);
|
||||
// add(panel, gridBagLayout, buildResetPanel(), 0, 4, 1, HORIZONTAL);
|
||||
|
||||
add(panel, gridBagLayout, buildFilterPanel(), 0, 0, 1, HORIZONTAL);
|
||||
add(panel, gridBagLayout, buildInterpolatePanel(), 0, 1, 1, HORIZONTAL);
|
||||
add(panel, gridBagLayout, buildUpdateMafPanel(), 0, 2, 1, HORIZONTAL);
|
||||
add(panel, gridBagLayout, buildResetPanel(), 0, 3, 1, HORIZONTAL);
|
||||
add(panel, gridBagLayout, buildAfrSourcePanel(), 0, 0, 1, HORIZONTAL);
|
||||
add(panel, gridBagLayout, buildFilterPanel(), 0, 1, 1, HORIZONTAL);
|
||||
add(panel, gridBagLayout, buildInterpolatePanel(), 0, 2, 1, HORIZONTAL);
|
||||
add(panel, gridBagLayout, buildUpdateMafPanel(), 0, 3, 1, HORIZONTAL);
|
||||
add(panel, gridBagLayout, buildResetPanel(), 0, 4, 1, HORIZONTAL);
|
||||
|
||||
add(panel);
|
||||
}
|
||||
|
@ -205,6 +218,19 @@ public final class MafControlPanel extends JPanel {
|
|||
JPanel panel = new JPanel();
|
||||
panel.setBorder(new TitledBorder("AFR Source"));
|
||||
panel.add(afrSourceList);
|
||||
afrSourceList.setEnabled(false); // Until clolSelect enables it
|
||||
|
||||
// Add ECU params
|
||||
/*for (EcuParameter e : params) {
|
||||
LOGGER.debug("MAF tab internal source " + e.getName() + ":" + e.getName().contains("AFR") + ":" + e.getName().contains("A/F") );
|
||||
if (e.getName().contains("AFR") || e.getName().contains("A/F")) afrSourceList.addItem(e);
|
||||
}
|
||||
|
||||
// Add external sensors
|
||||
for (ExternalData e : externals) {
|
||||
LOGGER.debug("MAF tab external source " + e.getName() + " added");
|
||||
afrSourceList.addItem(e);
|
||||
}*/
|
||||
return panel;
|
||||
}
|
||||
|
||||
|
@ -223,7 +249,8 @@ public final class MafControlPanel extends JPanel {
|
|||
panel.setLayout(gridBagLayout);
|
||||
|
||||
addMinMaxFilter(panel, gridBagLayout, "MAFv Range", mafvMin, mafvMax, 0);
|
||||
addComponent(panel, gridBagLayout, buildUpdateMafButton(), 3);
|
||||
addLabeledComponent(panel, gridBagLayout, "Factor (%)", mafCorrectionFactor, 3);
|
||||
addComponent(panel, gridBagLayout, buildUpdateMafButton(), 6);
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
@ -254,13 +281,14 @@ public final class MafControlPanel extends JPanel {
|
|||
GridBagLayout gridBagLayout = new GridBagLayout();
|
||||
panel.setLayout(gridBagLayout);
|
||||
|
||||
addMinMaxFilter(panel, gridBagLayout, "AFR Range", afrMin, afrMax, 0);
|
||||
addMinMaxFilter(panel, gridBagLayout, "RPM Range", rpmMin, rpmMax, 3);
|
||||
addMinMaxFilter(panel, gridBagLayout, "MAF Range (g/s)", mafMin, mafMax, 6);
|
||||
addLabeledComponent(panel, gridBagLayout, "Min. Coolant Temp.", coolantMin, 9);
|
||||
addLabeledComponent(panel, gridBagLayout, "Max. Intake Temp.", iatMax, 12);
|
||||
addLabeledComponent(panel, gridBagLayout, "Max. dMAFv/dt (V/s)", mafvChangeMax, 15);
|
||||
addComponent(panel, gridBagLayout, buildRecordDataButton(), 18);
|
||||
addComboBoxFilter(panel, gridBagLayout, "Closed/Open Loop", buildClolSelect(), 0);
|
||||
addMinMaxFilter(panel, gridBagLayout, "AFR Range", afrMin, afrMax, 3);
|
||||
addMinMaxFilter(panel, gridBagLayout, "RPM Range", rpmMin, rpmMax, 6);
|
||||
addMinMaxFilter(panel, gridBagLayout, "MAF Range (g/s)", mafMin, mafMax, 9);
|
||||
addLabeledComponent(panel, gridBagLayout, "Min. Coolant Temp.", coolantMin, 12);
|
||||
addLabeledComponent(panel, gridBagLayout, "Max. Intake Temp.", iatMax, 15);
|
||||
addLabeledComponent(panel, gridBagLayout, "Max. dMAFv/dt (V/s)", mafvChangeMax, 18);
|
||||
addComponent(panel, gridBagLayout, buildRecordDataButton(), 21);
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
@ -268,14 +296,26 @@ public final class MafControlPanel extends JPanel {
|
|||
private JToggleButton buildRecordDataButton() {
|
||||
recordDataButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
LOGGER.debug("MAF record button pushed");
|
||||
if (recordDataButton.isSelected()) {
|
||||
// afrSourceList.setEnabled(false);
|
||||
// registerAfr();
|
||||
registerData(COOLANT_TEMP, AF_CORRECTION_1, AF_LEARNING_1, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, CL_OL_16, CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32);
|
||||
afrSourceList.setEnabled(false);
|
||||
if (clolSelect.getSelectedItem().equals("Closed Loop")) {
|
||||
LOGGER.debug("Starting CL MAF scaling");
|
||||
registerData(COOLANT_TEMP, AF_CORRECTION_1, AF_LEARNING_1, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, CL_OL_16, CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32);
|
||||
} else {
|
||||
LOGGER.debug("Starting OL Maf scaling");
|
||||
registerAfr();
|
||||
registerData(COOLANT_TEMP, OL_FUELING_BASE_16, OL_FUELING_BASE_32, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, CL_OL_16, CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32);
|
||||
}
|
||||
} else {
|
||||
// deregisterAfr();
|
||||
deregisterData(COOLANT_TEMP, AF_CORRECTION_1, AF_LEARNING_1, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, CL_OL_16, CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32);
|
||||
// afrSourceList.setEnabled(true);
|
||||
LOGGER.debug("Stopping MAF scaling");
|
||||
if (clolSelect.getSelectedItem().equals("Closed Loop")) {
|
||||
deregisterData(COOLANT_TEMP, AF_CORRECTION_1, AF_LEARNING_1, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, CL_OL_16, CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32);
|
||||
} else {
|
||||
afrSourceList.setEnabled(true);
|
||||
deregisterAfr();
|
||||
deregisterData(COOLANT_TEMP, OL_FUELING_BASE_16, OL_FUELING_BASE_32, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, CL_OL_16, CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -292,7 +332,7 @@ public final class MafControlPanel extends JPanel {
|
|||
if (data != null) broker.deregisterLoggerDataFromLogging(data);
|
||||
}
|
||||
|
||||
private LoggerData getSelectedAfrSource() {
|
||||
public LoggerData getSelectedAfrSource() {
|
||||
KeyedComboBoxModel model = (KeyedComboBoxModel) afrSourceList.getModel();
|
||||
return (LoggerData) model.getSelectedKey();
|
||||
}
|
||||
|
@ -335,6 +375,12 @@ public final class MafControlPanel extends JPanel {
|
|||
add(panel, gridBagLayout, new JLabel(" - "), 1, y, 1, NONE);
|
||||
add(panel, gridBagLayout, max, 2, y, 1, NONE);
|
||||
}
|
||||
|
||||
private void addComboBoxFilter(JPanel panel, GridBagLayout gridBagLayout, String name, JComboBox combo, int y) {
|
||||
add(panel, gridBagLayout, new JLabel(name), 0, y, 3, HORIZONTAL);
|
||||
y += 1;
|
||||
add(panel, gridBagLayout, combo, 0, y, 1, NONE);
|
||||
}
|
||||
|
||||
private GridBagConstraints buildBaseConstraints() {
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
|
@ -355,8 +401,14 @@ public final class MafControlPanel extends JPanel {
|
|||
|
||||
private void updateAfrSourceList() {
|
||||
List<LoggerData> sources = new ArrayList<LoggerData>();
|
||||
|
||||
LoggerData afr = findData(AFR);
|
||||
if (afr != null) sources.add(afr);
|
||||
LoggerData tgvLeft = findData(TGV_LEFT);
|
||||
if (tgvLeft != null && tgvLeft.getName().contains("A/F")) sources.add(tgvLeft);
|
||||
LoggerData tgvRight = findData(TGV_RIGHT);
|
||||
if (tgvRight != null && tgvRight.getName().contains("A/F")) sources.add(tgvRight);
|
||||
|
||||
sources.addAll(externals);
|
||||
List<String> keys = new ArrayList<String>();
|
||||
for (LoggerData source : sources) keys.add(source.getName());
|
||||
|
@ -391,6 +443,20 @@ public final class MafControlPanel extends JPanel {
|
|||
orderComboBox.setSelectedItem(10);
|
||||
return orderComboBox;
|
||||
}
|
||||
|
||||
private JComboBox buildClolSelect() {
|
||||
final JComboBox output = new JComboBox(new String[] {"Closed Loop", "Open Loop"} );
|
||||
output.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
if (output.getSelectedItem().equals("Closed Loop")) {
|
||||
afrSourceList.setEnabled(false);
|
||||
} else {
|
||||
afrSourceList.setEnabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
return output;
|
||||
}
|
||||
|
||||
private JButton buildUpdateMafButton() {
|
||||
final JButton updateMafButton = new JButton("Update MAF");
|
||||
|
@ -485,7 +551,7 @@ public final class MafControlPanel extends JPanel {
|
|||
|
||||
public void setEcuParams(List<EcuParameter> params) {
|
||||
this.params = new ArrayList<EcuParameter>(params);
|
||||
// updateAfrSourceList();
|
||||
updateAfrSourceList();
|
||||
}
|
||||
|
||||
public void setEcuSwitches(List<EcuSwitch> switches) {
|
||||
|
@ -494,6 +560,6 @@ public final class MafControlPanel extends JPanel {
|
|||
|
||||
public void setExternalDatas(List<ExternalData> externals) {
|
||||
this.externals = new ArrayList<ExternalData>(externals);
|
||||
// updateAfrSourceList();
|
||||
updateAfrSourceList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package com.romraider.logger.ecu.ui.tab.maf;
|
||||
|
||||
import com.romraider.logger.ecu.definition.LoggerData;
|
||||
import com.romraider.logger.ecu.ui.tab.Tab;
|
||||
|
||||
public interface MafTab extends Tab {
|
||||
|
@ -38,5 +39,9 @@ public interface MafTab extends Tab {
|
|||
boolean isValidIntakeAirTemp(double value);
|
||||
|
||||
boolean isValidTipInThrottle(double value);
|
||||
|
||||
boolean methodIsCl();
|
||||
|
||||
LoggerData getSelectedAfrSource();
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.romraider.editor.ecu.ECUEditor;
|
|||
import com.romraider.logger.ecu.definition.EcuParameter;
|
||||
import com.romraider.logger.ecu.definition.EcuSwitch;
|
||||
import com.romraider.logger.ecu.definition.ExternalData;
|
||||
import com.romraider.logger.ecu.definition.LoggerData;
|
||||
import com.romraider.logger.ecu.ui.DataRegistrationBroker;
|
||||
import com.romraider.logger.ecu.ui.tab.LoggerChartPanel;
|
||||
import static java.awt.BorderLayout.CENTER;
|
||||
|
@ -54,6 +55,10 @@ public final class MafTabImpl extends JPanel implements MafTab {
|
|||
public boolean isValidClOl(double value) {
|
||||
return controlPanel.isValidClOl(value);
|
||||
}
|
||||
|
||||
public boolean methodIsCl() {
|
||||
return controlPanel.methodIsCl();
|
||||
}
|
||||
|
||||
public boolean isValidAfr(double value) {
|
||||
return controlPanel.isValidAfr(value);
|
||||
|
@ -98,6 +103,10 @@ public final class MafTabImpl extends JPanel implements MafTab {
|
|||
public void setExternalDatas(List<ExternalData> external) {
|
||||
controlPanel.setExternalDatas(external);
|
||||
}
|
||||
|
||||
public LoggerData getSelectedAfrSource() {
|
||||
return controlPanel.getSelectedAfrSource();
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
return this;
|
||||
|
|
Loading…
Reference in New Issue