@@ -92,9 +92,9 @@ bool EMUcan::decodeEmuFrame(struct can_frame *msg) {
9292 // 0-1 RPM in 16Bit unsigned
9393 emu_data.RPM = (msg->data [1 ] << 8 ) + msg->data [0 ];
9494 // 2 TPS in /2 %
95- emu_data.TPS = msg->data [2 ] / 2 ;
95+ emu_data.TPS = msg->data [2 ] * 0.5 ;
9696 // 3 IAT 8bit signed -40-127°C
97- emu_data.IAT = msg->data [3 ];
97+ emu_data.IAT = int8_t ( msg->data [3 ]) ;
9898 // 4-5 MAP 16Bit 0-600kpa
9999 emu_data.MAP = (msg->data [5 ] << 8 ) + msg->data [4 ];
100100 // 6-7 INJPW 0-50 0.016129ms
@@ -110,29 +110,29 @@ bool EMUcan::decodeEmuFrame(struct can_frame *msg) {
110110 }
111111 // Base +2:
112112 if (msg->can_id == _EMUbase + 2 ) {
113- // 0-1 VSPD in 16Bit unsigned
113+ // 0-1 VSPD in 16Bit unsigned 1 kmh/h / bit
114114 emu_data.vssSpeed = (msg->data [1 ] << 8 ) + msg->data [0 ];
115- // 2 BARO kPa
115+ // 2 BARO 50-130 kPa
116116 emu_data.Baro = msg->data [2 ];
117117 // 3 OILT 0-160°C
118118 emu_data.oilTemperature = msg->data [3 ];
119- // 4 OILP BAR 0.0625
119+ // 4 OILP BAR 0.0625 bar/bit
120120 emu_data.oilPressure = msg->data [4 ] * 0.0625 ;
121- // 5 FUELP BAR 0.0625
121+ // 5 FUELP BAR 0.0625 bar/bit
122122 emu_data.fuelPressure = msg->data [5 ] * 0.0625 ;
123- // 6-7 CLT 16bit Signed 0.016129ms
124- emu_data.CLT = (( msg->data [7 ] << 8 ) + msg->data [6 ]);
123+ // 6-7 CLT 16bit Signed -40-250 1 C/bit
124+ emu_data.CLT = int16_t ((( msg->data [7 ] << 8 ) + msg->data [6 ]) );
125125 }
126126 // Base +3:
127127 if (msg->can_id == _EMUbase + 3 ) {
128128 // 0 IGNANG in 8Bit signed -60 60 0.5deg/bit
129- emu_data.IgnAngle = msg->data [0 ] / 2 ;
129+ emu_data.IgnAngle = int8_t ( msg->data [0 ]) * 0.5 ;
130130 // 1 DWELL 0-10ms 0.05ms/bit
131131 emu_data.dwellTime = msg->data [1 ] * 0.05 ;
132132 // 2 LAMBDA 8bit 0-2 0.0078125 L/bit
133133 emu_data.wboLambda = msg->data [2 ] * 0.0078125 ;
134134 // 3 LAMBDACORR 75-125 0.5%
135- emu_data.LambdaCorrection = msg->data [3 ] / 2 ;
135+ emu_data.LambdaCorrection = msg->data [3 ] * 0.5 ;
136136 // 4-5 EGT1 16bit °C
137137 emu_data.Egt1 = ((msg->data [5 ] << 8 ) + msg->data [4 ]);
138138 // 6-7 EGT2 16bit °C
@@ -169,14 +169,14 @@ bool EMUcan::decodeEmuFrame(struct can_frame *msg) {
169169 emu_data.boostTarget = ((msg->data [1 ] << 8 ) + msg->data [0 ]);
170170 // 2 PWM#1 DC 1%/bit
171171 emu_data.pwm1 = msg->data [2 ];
172- if (msg->can_dlc == 8 ) {
173- // 4 Lambda target 8bit 0.01%/bit
174- emu_data.lambdaTarget = msg->buf [4 ] / 100.0 ;
175- // 5 PWM#2 DC 1%/bit
176- emu_data.pwm2 = msg->buf [5 ];
177- // 6-7 Fuel used 16bit 0.01L/bit
178- emu_data.fuel_used = ((msg->buf [7 ] << 8 ) + msg->buf [6 ]) / 100.0 ;
179- }
172+ if (msg->can_dlc == 8 ) {
173+ // 4 Lambda target 8bit 0.01%/bit
174+ emu_data.lambdaTarget = msg->data [4 ] * 0.01 ;
175+ // 5 PWM#2 DC 1%/bit
176+ emu_data.pwm2 = msg->data [5 ];
177+ // 6-7 Fuel used 16bit 0.01L/bit
178+ emu_data.fuel_used = ((msg->data [7 ] << 8 ) + msg->data [6 ]) * 0.01 ;
179+ }
180180 }
181181 return true ;
182182}
0 commit comments