mirror of https://github.com/rusefi/rusefi-1.git
.logicdata files are a bit broken #1482
This commit is contained in:
parent
830a3ee4dd
commit
5a5f4c16d7
|
@ -3,6 +3,6 @@ package com.rusefi;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public class rusEFIVersion {
|
public class rusEFIVersion {
|
||||||
public static final int CONSOLE_VERSION = 20200604;
|
public static final int CONSOLE_VERSION = 20200606;
|
||||||
public static AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
public static AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ public class LogicdataStreamFile extends StreamFile {
|
||||||
private static int int4or5 = 4;
|
private static int int4or5 = 4;
|
||||||
|
|
||||||
private final String fileName;
|
private final String fileName;
|
||||||
|
private final List<CompositeEvent> eventsBuffer = new ArrayList<>();
|
||||||
|
|
||||||
public LogicdataStreamFile(String fileName) {
|
public LogicdataStreamFile(String fileName) {
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
|
@ -61,13 +62,16 @@ public class LogicdataStreamFile extends StreamFile {
|
||||||
stream = new FileOutputStream(fileName);
|
stream = new FileOutputStream(fileName);
|
||||||
writeHeader();
|
writeHeader();
|
||||||
}
|
}
|
||||||
appendEvents(events);
|
eventsBuffer.addAll(events);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// ignoring this one
|
// ignoring this one
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void appendEvents(List<CompositeEvent> events) throws IOException {
|
/**
|
||||||
|
* this file format is not streaming, we have to write everything at once
|
||||||
|
*/
|
||||||
|
private void writeEvents(List<CompositeEvent> events) throws IOException {
|
||||||
// we need at least 2 records
|
// we need at least 2 records
|
||||||
if (events == null || events.size() < 2)
|
if (events == null || events.size() < 2)
|
||||||
return;
|
return;
|
||||||
|
@ -254,7 +258,6 @@ public class LogicdataStreamFile extends StreamFile {
|
||||||
write(new int[]{ 1, 0, 1 });
|
write(new int[]{ 1, 0, 1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void writeChannelData(int ch, List<Integer> chDeltas, int chLastState, int lastRecord) throws IOException {
|
private void writeChannelData(int ch, List<Integer> chDeltas, int chLastState, int lastRecord) throws IOException {
|
||||||
int numEdges = chDeltas.size();
|
int numEdges = chDeltas.size();
|
||||||
if (numEdges == 0)
|
if (numEdges == 0)
|
||||||
|
@ -346,6 +349,7 @@ public class LogicdataStreamFile extends StreamFile {
|
||||||
protected void writeFooter() throws IOException {
|
protected void writeFooter() throws IOException {
|
||||||
if (stream == null)
|
if (stream == null)
|
||||||
return;
|
return;
|
||||||
|
writeEvents(eventsBuffer);
|
||||||
write(BLOCK);
|
write(BLOCK);
|
||||||
for (int i = 0; i < numChannels; i++) {
|
for (int i = 0; i < numChannels; i++) {
|
||||||
writeId(i, 1);
|
writeId(i, 1);
|
||||||
|
|
Loading…
Reference in New Issue