Full Optimized – High Speed #4818

refactoring - nicer API
This commit is contained in:
rusefillc 2022-11-23 21:21:03 -05:00
parent 4cf5b8b411
commit 1cdcfffc11
2 changed files with 4 additions and 11 deletions

View File

@ -6,9 +6,6 @@ import com.rusefi.io.tcp.BinaryProtocolServer;
import java.io.IOException;
import static com.rusefi.binaryprotocol.IoHelper.putShort;
import static com.rusefi.binaryprotocol.IoHelper.swap16;
public class GetOutputsCommand {
public static byte[] createRequest() {
@ -17,8 +14,7 @@ public class GetOutputsCommand {
public static byte[] createRequest(int offset, int size) {
byte[] packet = new byte[4];
putShort(packet, 0, swap16(offset));
putShort(packet, 2, swap16(size));
ByteRange.packOffsetAndSize(offset, size, packet);
return packet;
}

View File

@ -1,18 +1,15 @@
package com.rusefi.ui.livedocs;
import com.rusefi.binaryprotocol.BinaryProtocol;
import com.rusefi.config.Field;
import com.rusefi.core.SensorCentral;
import com.rusefi.enums.live_data_e;
import com.rusefi.io.commands.ByteRange;
import com.rusefi.ldmp.StateDictionary;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
import static com.rusefi.binaryprotocol.IoHelper.putShort;
import static com.rusefi.binaryprotocol.IoHelper.swap16;
/**
* Singleton map of all live documentation entities. Using this registry we know all the entities to update periodically.
* Andrey Belomutskiy, (c) 2013-2020
@ -51,8 +48,8 @@ public enum LiveDocsRegistry {
Field[] values = StateDictionary.INSTANCE.getFields(context);
int size = Field.getStructureSize(values);
byte[] packet = new byte[4];
putShort(packet, 0, swap16(context.ordinal())); // offset
putShort(packet, 2, swap16(size));
int offset = context.ordinal();
ByteRange.packOffsetAndSize(offset, size, packet);
int structOffset = StateDictionary.INSTANCE.getOffset(context);
byte[] overallOutputs = SensorCentral.getInstance().getResponse();