progress Bmw0A9

This commit is contained in:
rusefillc 2022-02-21 20:29:10 -05:00
parent 39c846fd82
commit a630ae2a91
4 changed files with 36 additions and 1 deletions

View File

@ -10,4 +10,5 @@ public enum SensorType {
GEAR,
GEARBOX_CURRENT_TORQUE,
GEARBOX_TORQUE_CHANGE_REQUEST,
TORQ_AVL_MAX,
}

View File

@ -0,0 +1,25 @@
package com.rusefi.can.decoders.bmw;
import com.rusefi.can.CANPacket;
import com.rusefi.can.PacketPayload;
import com.rusefi.can.SensorType;
import com.rusefi.can.SensorValue;
import com.rusefi.can.decoders.AbstractPacketDecoder;
public class Bmw0A9 extends AbstractPacketDecoder {
public static final AbstractPacketDecoder INSTANCE = new Bmw0A9();
public static final int ID = 0xA9;
public Bmw0A9() {
super(ID);
}
@Override
public PacketPayload decode(CANPacket packet) {
int TORQ_AVL_MAX = (int) (packet.getByBitIndex(28, 12) * 0.5);
return new PacketPayload(packet.getTimeStamp(),
new SensorValue(SensorType.TORQ_AVL_MAX, TORQ_AVL_MAX)
);
}
}

View File

@ -7,7 +7,7 @@ import com.rusefi.can.SensorValue;
import com.rusefi.can.decoders.AbstractPacketDecoder;
public class Bmw0B5 extends AbstractPacketDecoder {
public static final Bmw0B5 INSTANCE = new Bmw0B5();
public static final AbstractPacketDecoder INSTANCE = new Bmw0B5();
public Bmw0B5() {
super(0xBA);

View File

@ -1,5 +1,6 @@
package com.rusefi.can;
import com.rusefi.can.decoders.bmw.Bmw0A9;
import com.rusefi.can.decoders.bmw.Bmw0AA;
import com.rusefi.can.decoders.bmw.Bmw0B5;
import com.rusefi.can.decoders.bmw.Bmw1D0;
@ -31,6 +32,14 @@ public class BmwE65DecoderTest {
assertValue(SensorType.FUEL_AMOUNT, 24443, payload.getValues()[2]);
}
@Test
public void decodeTorque2() {
CANPacket packet = new CANPacket(1,
-1, new byte[]{(byte) 0x9C, 0x07, 0x42, 0x7F, 0x2E, (byte) 0xE9, 0x0F, 0x03});
PacketPayload payload = Bmw0A9.INSTANCE.decode(packet);
assertValue(SensorType.TORQ_AVL_MAX, 371, payload.getValues()[0]);
}
@Test
public void decodeTorqueRequestEGS() {
CANPacket packet = new CANPacket(1,