auto-sync
This commit is contained in:
parent
4e0f8021b2
commit
a7fb6f64d3
|
@ -176,17 +176,17 @@ static void mapAveragingCallback(trigger_event_e ckpEventType, uint32_t index DE
|
|||
|
||||
MAP_sensor_config_s * config = &engineConfiguration->map;
|
||||
|
||||
float startAngle = interpolate2d(rpm, config->samplingAngleBins, config->samplingAngle, MAP_ANGLE_SIZE);
|
||||
float windowAngle = interpolate2d(rpm, config->samplingWindowBins, config->samplingWindow, MAP_WINDOW_SIZE);
|
||||
if (windowAngle <= 0) {
|
||||
angle_t samplingStart = interpolate2d(rpm, config->samplingAngleBins, config->samplingAngle, MAP_ANGLE_SIZE);
|
||||
angle_t samplingDuration = interpolate2d(rpm, config->samplingWindowBins, config->samplingWindow, MAP_WINDOW_SIZE);
|
||||
if (samplingDuration <= 0) {
|
||||
firmwareError("map sampling angle should be positive");
|
||||
return;
|
||||
}
|
||||
|
||||
int structIndex = getRevolutionCounter() % 2;
|
||||
// todo: schedule this based on closest trigger event, same as ignition works
|
||||
scheduleByAngle(rpm, &startTimer[structIndex], startAngle, startAveraging, NULL);
|
||||
scheduleByAngle(rpm, &endTimer[structIndex], startAngle + windowAngle, endAveraging, NULL);
|
||||
scheduleByAngle(rpm, &startTimer[structIndex], samplingStart, startAveraging, NULL);
|
||||
scheduleByAngle(rpm, &endTimer[structIndex], samplingStart + samplingDuration, endAveraging, NULL);
|
||||
}
|
||||
|
||||
static void showMapStats(void) {
|
||||
|
|
|
@ -74,9 +74,9 @@
|
|||
</table>
|
||||
</table>
|
||||
|
||||
<table type="2D" name="Intake air temperature-based extra idle air" storageaddress="@@iatIdleCorr_hex@@" sizex="16" storagetype="float" endian="big">
|
||||
<table type="2D" name="Intake air temperature-based extra idle air" storageaddress="@@cltIdleCorr_hex@@" sizex="16" storagetype="float" endian="big">
|
||||
<scaling units="Target Boost (psia) Compensation (%)" expression="x" to_byte="x" format="0.00" fineincrement=".01" coarseincrement="0.1" />
|
||||
<table type="X Axis" storageaddress="@@iatIdleCorrBins_hex@@" storagetype="float" endian="big">
|
||||
<table type="X Axis" storageaddress="@@cltIdleCorrBins_hex@@" storagetype="float" endian="big">
|
||||
<scaling units="uni" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
|
||||
</table>
|
||||
</table>
|
||||
|
|
|
@ -52,6 +52,8 @@ import java.io.FileReader;
|
|||
import java.io.IOException;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.management.modelmbean.XMLParseException;
|
||||
import javax.naming.NameNotFoundException;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JInternalFrame;
|
||||
|
@ -66,6 +68,7 @@ import javax.swing.tree.TreePath;
|
|||
import com.rusefi.Launcher;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
import com.romraider.Settings;
|
||||
|
@ -171,27 +174,10 @@ public class ECUEditor {
|
|||
return content;
|
||||
}
|
||||
|
||||
public static void openImage(byte[] input, File definitionFile, String fileName) throws Exception {
|
||||
public static void openImage(byte[] input, File definitionFile, String fileName) throws IOException, SAXException,
|
||||
RomNotFoundException, XMLParseException, NameNotFoundException {
|
||||
ECUEditor editor = ECUEditorManager.getECUEditor();
|
||||
DOMParser parser = new DOMParser();
|
||||
Document doc;
|
||||
FileInputStream fileStream;
|
||||
fileStream = new FileInputStream(definitionFile);
|
||||
InputSource src = new InputSource(fileStream);
|
||||
|
||||
parser.parse(src);
|
||||
doc = parser.getDocument();
|
||||
|
||||
Rom rom;
|
||||
try {
|
||||
rom = new DOMRomUnmarshaller().unmarshallXMLDefinition(doc.getDocumentElement(), input, editor.getStatusPanel());
|
||||
} finally {
|
||||
// Release mem after unmarshall.
|
||||
parser.reset();
|
||||
doc.removeChild(doc.getDocumentElement());
|
||||
fileStream.close();
|
||||
System.gc();
|
||||
}
|
||||
Rom rom = readRom(input, definitionFile, editor);
|
||||
|
||||
editor.getStatusPanel().setStatus("Populating tables...");
|
||||
|
||||
|
@ -206,6 +192,29 @@ public class ECUEditor {
|
|||
editor.getStatusPanel().setStatus("Done loading image...");
|
||||
}
|
||||
|
||||
private static Rom readRom(byte[] romContent, File romDefinitionFile, ECUEditor editor) throws SAXException, IOException, RomNotFoundException, XMLParseException, NameNotFoundException {
|
||||
DOMParser parser = new DOMParser();
|
||||
Document doc;
|
||||
FileInputStream fileStream;
|
||||
fileStream = new FileInputStream(romDefinitionFile);
|
||||
InputSource src = new InputSource(fileStream);
|
||||
|
||||
parser.parse(src);
|
||||
doc = parser.getDocument();
|
||||
|
||||
Rom rom;
|
||||
try {
|
||||
rom = new DOMRomUnmarshaller().unmarshallXMLDefinition(doc.getDocumentElement(), romContent, editor.getStatusPanel());
|
||||
} finally {
|
||||
// Release mem after unmarshall.
|
||||
parser.reset();
|
||||
doc.removeChild(doc.getDocumentElement());
|
||||
fileStream.close();
|
||||
System.gc();
|
||||
}
|
||||
return rom;
|
||||
}
|
||||
|
||||
public void initializeEditorUI() {
|
||||
//create menubar
|
||||
menuBar = new ECUEditorMenuBar();
|
||||
|
|
|
@ -19,10 +19,7 @@
|
|||
|
||||
package com.romraider.util;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.*;
|
||||
|
||||
public final class ObjectCloner {
|
||||
|
||||
|
@ -30,7 +27,7 @@ public final class ObjectCloner {
|
|||
}
|
||||
|
||||
// returns a deep copy of an object
|
||||
public static Object deepCopy(Object obj) throws Exception {
|
||||
public static Object deepCopy(Object obj) {
|
||||
/*ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
try {
|
||||
ObjectOutputStream oos = new ObjectOutputStream(bos);
|
||||
|
@ -82,15 +79,25 @@ public final class ObjectCloner {
|
|||
// read the serialized, and deep copied, object and return it
|
||||
return inStream.readObject();
|
||||
|
||||
} catch (Exception e) {
|
||||
throw (e);
|
||||
} catch (Throwable e) {
|
||||
throw new IllegalStateException(e);
|
||||
|
||||
} finally {
|
||||
//always close your streams in finally clauses
|
||||
outStream.close();
|
||||
inStream.close();
|
||||
close(outStream);
|
||||
close(inStream);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void close(Closeable closeable) {
|
||||
if(closeable!=null) {
|
||||
try {
|
||||
closeable.close();
|
||||
} catch (IOException e) {
|
||||
// ignoring exception during close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,6 +29,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import javax.management.modelmbean.XMLParseException;
|
||||
import javax.naming.NameNotFoundException;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import com.rusefi.Launcher;
|
||||
|
@ -62,9 +63,9 @@ public final class DOMRomUnmarshaller {
|
|||
public DOMRomUnmarshaller() {
|
||||
}
|
||||
|
||||
public Rom unmarshallXMLDefinition(Node rootNode, byte[] input,
|
||||
public Rom unmarshallXMLDefinition(Node rootNode, byte[] romContent,
|
||||
JProgressPane progress) throws RomNotFoundException,
|
||||
XMLParseException, StackOverflowError, Exception {
|
||||
XMLParseException, NameNotFoundException {
|
||||
|
||||
this.progress = progress;
|
||||
Node n;
|
||||
|
@ -97,13 +98,13 @@ public final class DOMRomUnmarshaller {
|
|||
RomID romID = unmarshallRomID(n2, new RomID());
|
||||
|
||||
if (romID.getInternalIdString().length() > 0
|
||||
&& foundMatch(romID, input)) {
|
||||
&& foundMatch(romID, romContent)) {
|
||||
Rom output = unmarshallRom(n, new Rom());
|
||||
|
||||
// set ram offset
|
||||
output.getRomID().setRamOffset(
|
||||
output.getRomID().getFileSize()
|
||||
- input.length);
|
||||
- romContent.length);
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
@ -189,7 +190,7 @@ public final class DOMRomUnmarshaller {
|
|||
}
|
||||
|
||||
public Rom unmarshallRom(Node rootNode, Rom rom) throws XMLParseException,
|
||||
RomNotFoundException, StackOverflowError, Exception {
|
||||
RomNotFoundException, NameNotFoundException {
|
||||
Node n;
|
||||
NodeList nodes = rootNode.getChildNodes();
|
||||
|
||||
|
@ -251,8 +252,7 @@ public final class DOMRomUnmarshaller {
|
|||
}
|
||||
|
||||
public Rom getBaseRom(Node rootNode, String xmlID, Rom rom)
|
||||
throws XMLParseException, RomNotFoundException, StackOverflowError,
|
||||
Exception {
|
||||
throws XMLParseException, RomNotFoundException, NameNotFoundException {
|
||||
Node n;
|
||||
NodeList nodes = rootNode.getChildNodes();
|
||||
|
||||
|
@ -351,7 +351,7 @@ public final class DOMRomUnmarshaller {
|
|||
}
|
||||
|
||||
private Table unmarshallTable(Node tableNode, Table table, Rom rom)
|
||||
throws XMLParseException, TableIsOmittedException, Exception {
|
||||
throws XMLParseException, TableIsOmittedException, NameNotFoundException {
|
||||
|
||||
if (unmarshallAttribute(tableNode, "omit", "false").equalsIgnoreCase(
|
||||
"true")) { // remove table if omitted
|
||||
|
|
Loading…
Reference in New Issue