basic updater logo right click menu to upload calibrations (panama UI part) #7418
only:uaefi
This commit is contained in:
parent
5faae7de1d
commit
d77612fb1b
|
@ -0,0 +1,20 @@
|
|||
package com.rusefi.panama;
|
||||
|
||||
import com.opensr5.ini.field.IniField;
|
||||
import com.rusefi.config.generated.TsOutputs;
|
||||
import com.rusefi.core.ISensorHolder;
|
||||
import com.rusefi.core.SensorCentral;
|
||||
import com.rusefi.io.LinkManager;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class PanamaHelper {
|
||||
public static IniField getIniField(LinkManager linkManager) {
|
||||
return linkManager.getBinaryProtocol().getIniFile().getOutputChannel(TsOutputs.MCUSERIAL.getName());
|
||||
}
|
||||
|
||||
public static int getMcuSerial(IniField mcuSerialField) {
|
||||
ByteBuffer bb = ISensorHolder.getByteBuffer(SensorCentral.getInstance().getResponse(), "error", mcuSerialField.getOffset());
|
||||
return bb.getInt();
|
||||
}
|
||||
}
|
|
@ -3,13 +3,11 @@ package com.rusefi.binaryprotocol.test;
|
|||
import com.opensr5.ini.field.IniField;
|
||||
import com.rusefi.autodetect.PortDetector;
|
||||
import com.rusefi.autodetect.SerialAutoChecker;
|
||||
import com.rusefi.config.generated.TsOutputs;
|
||||
import com.rusefi.core.ISensorHolder;
|
||||
import com.rusefi.core.SensorCentral;
|
||||
import com.rusefi.io.HeartBeatListeners;
|
||||
import com.rusefi.io.LinkManager;
|
||||
import com.rusefi.panama.PanamaHelper;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
@ -44,15 +42,14 @@ public class SerialSandbox {
|
|||
throw new IllegalStateException("Not connected in time");
|
||||
}
|
||||
|
||||
IniField mcuSerialField = linkManager.getBinaryProtocol().getIniFile().getOutputChannel(TsOutputs.MCUSERIAL.getName());
|
||||
IniField mcuSerialField = PanamaHelper.getIniField(linkManager);
|
||||
if (mcuSerialField == null) {
|
||||
throw new IllegalStateException("Older unit without MCUSERIAL?");
|
||||
}
|
||||
Objects.requireNonNull(mcuSerialField);
|
||||
|
||||
SensorCentral.getInstance().addListener(() -> {
|
||||
ByteBuffer bb = ISensorHolder.getByteBuffer(SensorCentral.getInstance().getResponse(), "error", mcuSerialField.getOffset());
|
||||
int mcuSerial = bb.getInt();
|
||||
int mcuSerial = PanamaHelper.getMcuSerial(mcuSerialField);
|
||||
System.out.println("mcuSerial " + mcuSerial);
|
||||
});
|
||||
|
||||
|
@ -66,7 +63,5 @@ public class SerialSandbox {
|
|||
}
|
||||
});
|
||||
latch.await(1, TimeUnit.MINUTES);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue