bugfix to make console work again
This commit is contained in:
parent
8a8ea6c096
commit
66438b9362
|
@ -20,6 +20,7 @@ import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -393,6 +394,10 @@ public class BinaryProtocol implements BinaryProtocolCommands {
|
||||||
currentOutputs = response;
|
currentOutputs = response;
|
||||||
|
|
||||||
for (Sensor sensor : Sensor.values()) {
|
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);
|
ByteBuffer bb = ByteBuffer.wrap(response, 1 + sensor.getOffset(), 4);
|
||||||
bb.order(ByteOrder.LITTLE_ENDIAN);
|
bb.order(ByteOrder.LITTLE_ENDIAN);
|
||||||
|
|
||||||
|
@ -404,6 +409,9 @@ public class BinaryProtocol implements BinaryProtocolCommands {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double getValueForChannel(ByteBuffer bb, Sensor sensor) {
|
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()) {
|
switch (sensor.getType()) {
|
||||||
case FLOAT:
|
case FLOAT:
|
||||||
return bb.getFloat();
|
return bb.getFloat();
|
||||||
|
|
Loading…
Reference in New Issue