bugfix to make console work again
This commit is contained in:
parent
f6c3f12091
commit
1210f5bbec
|
@ -20,6 +20,7 @@ import java.io.IOException;
|
|||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -393,6 +394,10 @@ public class BinaryProtocol implements BinaryProtocolCommands {
|
|||
currentOutputs = response;
|
||||
|
||||
for (Sensor sensor : Sensor.values()) {
|
||||
if (sensor.getType() == null) {
|
||||
// for example ETB_CONTROL_QUALITY, weird use-case
|
||||
continue;
|
||||
}
|
||||
ByteBuffer bb = ByteBuffer.wrap(response, 1 + sensor.getOffset(), 4);
|
||||
bb.order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
|
@ -404,6 +409,9 @@ public class BinaryProtocol implements BinaryProtocolCommands {
|
|||
}
|
||||
|
||||
private static double getValueForChannel(ByteBuffer bb, Sensor sensor) {
|
||||
Objects.requireNonNull(sensor, "sensor");
|
||||
if (sensor.getType() == null)
|
||||
throw new NullPointerException("sensor type " + sensor);
|
||||
switch (sensor.getType()) {
|
||||
case FLOAT:
|
||||
return bb.getFloat();
|
||||
|
|
Loading…
Reference in New Issue