Skip to content

Commit 56b26ab

Browse files
committed
removed response mask and changed to treat frame as big endian
1 parent 57c7f55 commit 56b26ab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bms-growatt-hv-can/src/main/java/com/airepublic/bmstoinverter/bms/growatthv/can/GrowattHVBmsCANProcessor.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ protected List<ByteBuffer> sendMessage(final Port port, final Command cmd, final
120120
// read frames until the requested frame is read
121121
do {
122122
final ByteBuffer receiveFrame = port.receiveFrame();
123+
123124
LOG.debug("RECEIVED: {}", Port.printBuffer(receiveFrame));
124125

125126
if (receiveFrame == null) {
@@ -140,6 +141,8 @@ protected List<ByteBuffer> sendMessage(final Port port, final Command cmd, final
140141
} catch (final InterruptedException e) {
141142
}
142143
} else {
144+
receiveFrame.order(ByteOrder.BIG_ENDIAN);
145+
143146
// read the BMS id
144147
final int canId = receiveFrame.getInt();
145148
final byte bmsId = (byte) (canId & 0x00000001); // last 4 bits represents bms id
@@ -150,7 +153,7 @@ protected List<ByteBuffer> sendMessage(final Port port, final Command cmd, final
150153
} else {
151154
frameReceived = true;
152155
// request has 4th byte 0x10 and response 0x20
153-
final Command command = Command.forCommand(canId - 0x00001000);
156+
final Command command = Command.forCommand(canId);
154157
// move position to the data part
155158
receiveFrame.getInt();
156159

0 commit comments

Comments
 (0)