rusEFI console produces invalid .logicdata files #1563

looks OK
This commit is contained in:
rusefillc 2022-11-20 18:34:29 -05:00
parent 6ce90db155
commit 8fbc45ee7a
2 changed files with 19 additions and 4 deletions

View File

@ -383,6 +383,7 @@ public class LogicdataStreamFile extends StreamFile {
protected void writeFooter() throws IOException {
if (stream == null)
return;
System.out.println("Writing " + eventsBuffer.size() + " event(s)");
writeEvents(eventsBuffer);
write(BLOCK);
for (int i = 0; i < numChannels; i++) {

View File

@ -8,13 +8,27 @@ import java.util.List;
public class LogicdataStreamFileSandbox {
public static void main(String[] args) {
List<CompositeEvent> events = new ArrayList<>();
events.add(new CompositeEvent(10, false, false, false, false, false, false));
long timestamp = 10;
events.add(new CompositeEvent(timestamp, false, false, false, false, false, false));
events.add(new CompositeEvent(20, true, false, true, false, false, false));
events.add(new CompositeEvent(30, false, false, false, false, false, false));
events.add(new CompositeEvent(1000030, false, false, false, false, true, false));
events.add(new CompositeEvent(2000030, false, false, true, false, false, true));
LogicdataStreamFile file = new LogicdataStreamFile("sandbox.logicdata");
for (int i = 0; i < 100; i++) {
timestamp = 100 + i * 1000;
boolean primary = (i % 2) == 0;
events.add(new CompositeEvent(timestamp, primary, false, false, false, false, false));
}
events.add(new CompositeEvent(timestamp + 1000, false, false, false, false, true, false));
events.add(new CompositeEvent(timestamp + 2030, false, false, true, false, false, true));
LogicdataStreamFile file = new LogicdataStreamFile("sandbox2.logicdata");
file.append(events);
file.close();
}