auto-sync
This commit is contained in:
parent
8a89f2723e
commit
30df52c8d5
|
@ -237,7 +237,8 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
|||
|
||||
// boardConfiguration->useWarmupPidAfr = true;
|
||||
engineConfiguration->warmupAfrPid.pFactor = -0.2;
|
||||
engineConfiguration->warmupAfrPid.dFactor = -0.02;
|
||||
engineConfiguration->warmupAfrPid.iFactor = -0.0005;
|
||||
// engineConfiguration->warmupAfrPid.dFactor = -0.02;
|
||||
engineConfiguration->debugMode = WARMUP_ENRICH;
|
||||
|
||||
// set_global_trigger_offset_angle 38
|
||||
|
|
|
@ -36,6 +36,10 @@ extern fuel_Map3D_t afrMap;
|
|||
EXTERN_ENGINE
|
||||
;
|
||||
|
||||
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||
extern TunerStudioOutputChannels tsOutputChannels;
|
||||
#endif
|
||||
|
||||
MockAdcState::MockAdcState() {
|
||||
memset(hasMockAdc, 0, sizeof(hasMockAdc));
|
||||
}
|
||||
|
@ -153,6 +157,11 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_F) {
|
|||
} else {
|
||||
cltFuelCorrection = warmupAfrPid.getValue(13, getAfr(PASS_ENGINE_PARAMETER_F), 1);
|
||||
}
|
||||
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||
if (engineConfiguration->debugMode == WARMUP_ENRICH) {
|
||||
warmupAfrPid.postState(&tsOutputChannels);
|
||||
}
|
||||
#endif
|
||||
|
||||
} else {
|
||||
cltFuelCorrection = getCltCorrection(clt PASS_ENGINE_PARAMETER);
|
||||
|
|
|
@ -32,7 +32,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see EngineSnifferPanel
|
||||
*/
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20160208;
|
||||
public static final int CONSOLE_VERSION = 20160209;
|
||||
public static final boolean SHOW_STIMULATOR = false;
|
||||
private static final String TAB_INDEX = "main_tab";
|
||||
protected static final String PORT_KEY = "port";
|
||||
|
@ -44,7 +44,7 @@ public class Launcher {
|
|||
private final TableEditorPane tableEditor = new TableEditorPane();
|
||||
private final SettingsTab settingsTab = new SettingsTab();
|
||||
private final LogDownloader logsManager = new LogDownloader();
|
||||
private final FuelTunePane fuelTunePane = new FuelTunePane();
|
||||
private final FuelTunePane fuelTunePane;
|
||||
|
||||
FrameHelper frame = new FrameHelper() {
|
||||
@Override
|
||||
|
@ -114,6 +114,7 @@ public class Launcher {
|
|||
tabbedPane.add("Bench Test", new BenchTestPane().getContent());
|
||||
if (!LinkManager.isLogViewer() && false) // todo: fix it & better name?
|
||||
tabbedPane.add("Logs Manager", logsManager.getContent());
|
||||
fuelTunePane = new FuelTunePane(getConfig().getRoot().getChild("fueltune"));
|
||||
if (true)
|
||||
tabbedPane.add("Fuel Tune", fuelTunePane.getContent());
|
||||
|
||||
|
|
|
@ -73,10 +73,10 @@ public class UploadChanges {
|
|||
final BinaryProtocol bp = new BinaryProtocol(logger, serialPort);
|
||||
bp.setController(ci1);
|
||||
|
||||
scheduleUpload(ci2);
|
||||
scheduleUpload(ci2, null);
|
||||
}
|
||||
|
||||
public static void scheduleUpload(final ConfigurationImage newVersion) {
|
||||
public static void scheduleUpload(final ConfigurationImage newVersion, final Runnable afterUpload) {
|
||||
JFrame frame = wnd.getFrame();
|
||||
frame.setVisible(true);
|
||||
LinkManager.COMMUNICATION_EXECUTOR.execute(new Runnable() {
|
||||
|
@ -84,6 +84,8 @@ public class UploadChanges {
|
|||
public void run() {
|
||||
try {
|
||||
BinaryProtocol.instance.uploadChanges(newVersion, logger);
|
||||
if (afterUpload != null)
|
||||
afterUpload.run();
|
||||
} catch (InterruptedException | EOFException | SerialPortException e) {
|
||||
logger.error("Error: " + e);
|
||||
throw new IllegalStateException(e);
|
||||
|
|
|
@ -60,6 +60,6 @@ public class BinaryProtocolCmd {
|
|||
}
|
||||
|
||||
public static void scheduleUpload(ConfigurationImage newVersion) {
|
||||
UploadChanges.scheduleUpload(newVersion);
|
||||
UploadChanges.scheduleUpload(newVersion, null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,22 +11,22 @@ import com.rusefi.FileLog;
|
|||
import com.rusefi.UploadChanges;
|
||||
import com.rusefi.autotune.FuelAutoTune;
|
||||
import com.rusefi.binaryprotocol.BinaryProtocol;
|
||||
import com.rusefi.config.Field;
|
||||
import com.rusefi.config.Fields;
|
||||
import com.rusefi.core.Sensor;
|
||||
import com.rusefi.core.SensorCentral;
|
||||
import com.rusefi.ui.config.BaseConfigField;
|
||||
import com.rusefi.ui.storage.Node;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.*;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.RunnableFuture;
|
||||
|
||||
/**
|
||||
* (c) Andrey Belomutskiy 2013-2016
|
||||
|
@ -37,6 +37,10 @@ import java.util.List;
|
|||
public class FuelTunePane {
|
||||
private final JPanel content = new JPanel(new BorderLayout());
|
||||
|
||||
private final static int veLoadOffset = Fields.VETABLE.getOffset() + Fields.FUEL_RPM_COUNT * Fields.FUEL_LOAD_COUNT * 4;
|
||||
private final static int veRpmOffset = Fields.VETABLE.getOffset() + Fields.FUEL_RPM_COUNT * Fields.FUEL_LOAD_COUNT * 4 + Fields.FUEL_LOAD_COUNT * 4;
|
||||
|
||||
|
||||
private final List<FuelDataPoint> incomingDataPoints = new ArrayList<>();
|
||||
private final float veLoadBins[] = new float[Fields.FUEL_LOAD_COUNT];
|
||||
private final float veRpmBins[] = new float[Fields.FUEL_RPM_COUNT];
|
||||
|
@ -48,7 +52,7 @@ public class FuelTunePane {
|
|||
private byte[] newVeMap;
|
||||
private DataOutputStream dos;
|
||||
|
||||
public FuelTunePane() {
|
||||
public FuelTunePane(Node config) {
|
||||
final JLabel incomingBufferSize = new JLabel();
|
||||
|
||||
JButton runLogic = new JButton("one iteration");
|
||||
|
@ -61,25 +65,17 @@ public class FuelTunePane {
|
|||
upload.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
byte[] newVeMap = FuelTunePane.this.newVeMap;
|
||||
BinaryProtocol bp = BinaryProtocol.instance;
|
||||
if (newVeMap == null || bp == null)
|
||||
return;
|
||||
ConfigurationImage ci = bp.getController().clone();
|
||||
System.arraycopy(newVeMap, 0, ci.getContent(), Fields.VETABLE.getOffset(), newVeMap.length);
|
||||
UploadChanges.scheduleUpload(ci);
|
||||
uploadCurrentResukt();
|
||||
}
|
||||
});
|
||||
clean.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
synchronized (incomingDataPoints) {
|
||||
incomingDataPoints.clear();
|
||||
}
|
||||
doClean();
|
||||
}
|
||||
});
|
||||
|
||||
collect.setSelected(true);
|
||||
collect.setSelected(false);
|
||||
JPanel topPanel = new JPanel(new FlowLayout());
|
||||
topPanel.add(collect);
|
||||
topPanel.add(clean);
|
||||
|
@ -87,6 +83,23 @@ public class FuelTunePane {
|
|||
topPanel.add(runLogic);
|
||||
topPanel.add(upload);
|
||||
|
||||
Timer runTime = new Timer(1000, new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
boolean runJob;
|
||||
synchronized (incomingDataPoints) {
|
||||
runJob = incomingDataPoints.size() > 50;
|
||||
}
|
||||
if (runJob) {
|
||||
doJob();
|
||||
uploadCurrentResukt();
|
||||
}
|
||||
}
|
||||
});
|
||||
runTime.start();
|
||||
|
||||
|
||||
// todo: records based on change, not based on timer
|
||||
Timer timer = new Timer(300, new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
@ -104,7 +117,11 @@ public class FuelTunePane {
|
|||
|
||||
JPanel rightPanel = new JPanel(new GridLayout(2, 1));
|
||||
rightPanel.add(changeMap);
|
||||
rightPanel.add(new JLabel("bottom"));
|
||||
GaugesGrid grid = new GaugesGrid(1, 3);
|
||||
rightPanel.add(grid.panel);
|
||||
|
||||
grid.panel.add(GaugesGridElement.read(config.getChild("1"), Sensor.RPM));
|
||||
grid.panel.add(GaugesGridElement.read(config.getChild("2"), Sensor.AFR));
|
||||
|
||||
JPanel middlePanel = new JPanel(new GridLayout(1, 2));
|
||||
middlePanel.add(veTable);
|
||||
|
@ -115,6 +132,35 @@ public class FuelTunePane {
|
|||
initTable(changeMap);
|
||||
}
|
||||
|
||||
private void uploadCurrentResukt() {
|
||||
byte[] newVeMap = FuelTunePane.this.newVeMap;
|
||||
BinaryProtocol bp = BinaryProtocol.instance;
|
||||
if (newVeMap == null || bp == null)
|
||||
return;
|
||||
ConfigurationImage ci = bp.getController().clone();
|
||||
System.arraycopy(newVeMap, 0, ci.getContent(), Fields.VETABLE.getOffset(), newVeMap.length);
|
||||
Runnable afterBurn = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// let's clean so that we collect fresh datapoints based on new settings
|
||||
doClean();
|
||||
reloadVeTable();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
UploadChanges.scheduleUpload(ci, afterBurn);
|
||||
}
|
||||
|
||||
private void doClean() {
|
||||
synchronized (incomingDataPoints) {
|
||||
incomingDataPoints.clear();
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadData(Table table, byte[] content, int offset) {
|
||||
table.reset();
|
||||
table.setStorageAddress(offset);
|
||||
|
@ -255,20 +301,23 @@ public class FuelTunePane {
|
|||
}
|
||||
});
|
||||
|
||||
int veLoadOffset = Fields.VETABLE.getOffset() + Fields.FUEL_RPM_COUNT * Fields.FUEL_LOAD_COUNT * 4;
|
||||
loadArray(veLoadBins, veLoadOffset);
|
||||
int veRpmOffset = Fields.VETABLE.getOffset() + Fields.FUEL_RPM_COUNT * Fields.FUEL_LOAD_COUNT * 4 + Fields.FUEL_LOAD_COUNT * 4;
|
||||
loadArray(veRpmBins, veRpmOffset);
|
||||
|
||||
byte[] content = reloadVeTable();
|
||||
|
||||
loadData(changeMap.getXAxis(), content, veRpmOffset);
|
||||
loadData(changeMap.getYAxis(), content, veLoadOffset);
|
||||
}
|
||||
|
||||
private byte[] reloadVeTable() {
|
||||
BinaryProtocol bp = BinaryProtocol.instance;
|
||||
|
||||
byte[] content = bp.getController().getContent();
|
||||
loadData(veTable.getXAxis(), content, veRpmOffset);
|
||||
loadData(veTable.getYAxis(), content, veLoadOffset);
|
||||
loadData(veTable, content, Fields.VETABLE.getOffset());
|
||||
|
||||
loadData(changeMap.getXAxis(), content, veRpmOffset);
|
||||
loadData(changeMap.getYAxis(), content, veLoadOffset);
|
||||
return content;
|
||||
}
|
||||
|
||||
private void loadMap(float[][] map, int offset) {
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.rusefi.ui;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* (c) Andrey Belomutskiy
|
||||
* 2/9/2016
|
||||
*/
|
||||
public class GaugesGrid {
|
||||
public final JPanel panel;
|
||||
public GaugesGrid(int rows, int cols) {
|
||||
panel = new JPanel(new GridLayout(rows, cols));
|
||||
}
|
||||
}
|
|
@ -57,7 +57,7 @@ public class GaugesPanel {
|
|||
}
|
||||
|
||||
private final JPanel content = new JPanel(new BorderLayout());
|
||||
private final JPanel gauges = new JPanel(new GridLayout(3, 5));
|
||||
private final GaugesGrid gauges = new GaugesGrid(3, 5);
|
||||
private final Node config;
|
||||
|
||||
private boolean showRpmPanel = true;
|
||||
|
@ -109,7 +109,7 @@ public class GaugesPanel {
|
|||
@NotNull
|
||||
private JPanel createMiddleLeftPanel() {
|
||||
JPanel middleLeftPanel = new JPanel(new BorderLayout());
|
||||
middleLeftPanel.add(gauges, BorderLayout.CENTER);
|
||||
middleLeftPanel.add(gauges.panel, BorderLayout.CENTER);
|
||||
middleLeftPanel.add(lowerRpmPanel, BorderLayout.SOUTH);
|
||||
return middleLeftPanel;
|
||||
}
|
||||
|
@ -203,20 +203,20 @@ public class GaugesPanel {
|
|||
public void actionPerformed(ActionEvent e) {
|
||||
String fileName = FileLog.getDate() + "_gauges.png";
|
||||
|
||||
UiUtils.saveImageWithPrompt(fileName, content, gauges);
|
||||
UiUtils.saveImageWithPrompt(fileName, content, gauges.panel);
|
||||
}
|
||||
});
|
||||
return saveImageButton;
|
||||
}
|
||||
|
||||
private void setSensorGridDimensions(int rows, int columns) {
|
||||
gauges.setLayout(new GridLayout(rows, columns));
|
||||
gauges.removeAll();
|
||||
gauges.panel.setLayout(new GridLayout(rows, columns));
|
||||
gauges.panel.removeAll();
|
||||
|
||||
for (int i = 0; i < rows * columns; i++) {
|
||||
Component element = GaugesGridElement.read(config.getChild("element_" + i), DEFAULT_LAYOUT[i]);
|
||||
|
||||
gauges.add(element);
|
||||
gauges.panel.add(element);
|
||||
}
|
||||
|
||||
saveConfig(rows, columns);
|
||||
|
|
Loading…
Reference in New Issue