2022-11-12 19:13:12 -08:00
|
|
|
package com.rusefi.can.deprecated.decoders.bmw;
|
2022-02-02 21:03:56 -08:00
|
|
|
|
|
|
|
import com.rusefi.can.CANPacket;
|
2024-01-12 22:08:24 -08:00
|
|
|
import com.rusefi.can.SensorValue;
|
2022-11-12 19:13:12 -08:00
|
|
|
import com.rusefi.can.deprecated.PacketPayload;
|
|
|
|
import com.rusefi.can.deprecated.SensorType;
|
|
|
|
import com.rusefi.can.deprecated.decoders.AbstractPacketDecoder;
|
2022-02-02 21:03:56 -08:00
|
|
|
|
|
|
|
public class Bmw0AA extends AbstractPacketDecoder {
|
2022-02-20 19:26:49 -08:00
|
|
|
public static final int ID = 0xAA;
|
|
|
|
|
2022-02-02 21:03:56 -08:00
|
|
|
public Bmw0AA() {
|
2022-02-20 19:26:49 -08:00
|
|
|
super(ID);
|
2022-02-02 21:03:56 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public PacketPayload decode(CANPacket packet) {
|
|
|
|
SensorValue pedal = new SensorValue(SensorType.PPS, packet.getUnsigned(3) * 0.39063);
|
2022-02-20 21:33:22 -08:00
|
|
|
int rawRpm = packet.getTwoBytesByByteIndex(4);
|
2022-02-02 21:12:35 -08:00
|
|
|
if (rawRpm == 0xFFFF)
|
|
|
|
return null;
|
|
|
|
SensorValue rpm = new SensorValue(SensorType.RPM, rawRpm * 0.25);
|
2022-02-02 21:03:56 -08:00
|
|
|
return new PacketPayload(packet.getTimeStamp(), pedal, rpm);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|