@@ -34,11 +34,10 @@ public class JKBmsCANProcessor extends BMS {
34
34
protected void collectData (final Port port ) {
35
35
try {
36
36
final ByteBuffer frame = port .receiveFrame ();
37
- frame .order (ByteOrder .LITTLE_ENDIAN );
38
37
final int frameId = frame .getInt ();
39
38
final byte [] bytes = new byte [8 ];
40
39
frame .get (bytes );
41
- final ByteBuffer data = ByteBuffer .wrap (bytes );
40
+ final ByteBuffer data = ByteBuffer .wrap (bytes ). order ( ByteOrder . LITTLE_ENDIAN ) ;
42
41
43
42
final int cmd = frameId & 0xFFFFFFF0 ;
44
43
final int bmsId = (frameId & 0x0000000F ) - 4 ;
@@ -279,11 +278,11 @@ private void readChargingInfo(final BatteryPack pack, final ByteBuffer data) {
279
278
public static void main (final String [] args ) {
280
279
final JKBmsCANProcessor jk = new JKBmsCANProcessor ();
281
280
282
- final ByteBuffer data = ByteBuffer .wrap (new byte [] { (byte ) 0xEC , 0x01 , (byte ) 0xA0 , 0x0F , 0x33 , 0x00 , 0x00 , 0x00 }).order (ByteOrder .LITTLE_ENDIAN );
281
+ final ByteBuffer data = ByteBuffer .wrap (new byte [] { (byte ) 0xED , 0x01 , (byte ) 0xA0 , 0x0F , 0x33 , 0x00 , 0x00 , 0x00 }).order (ByteOrder .LITTLE_ENDIAN );
283
282
System .out .println (Port .printBuffer (data ));
284
283
final BatteryPack pack = new BatteryPack ();
285
284
jk .readBatteryStatus (pack , data );
286
- System .out .println (pack .packVoltage / 10 + "V, " + pack .packCurrent / 10 + "A, " + pack .packSOC / 10 + "%" );
285
+ System .out .println (pack .packVoltage / 10f + "V, " + pack .packCurrent / 10f + "A, " + pack .packSOC / 10f + "%" );
287
286
;
288
287
}
289
288
}
0 commit comments