Fix DS18B20 Payload Decoder for Negative Values

This commit is contained in:
seiichiro 2021-03-28 16:53:24 +02:00
parent 4161ea5e65
commit 5809f514f0

View file

@ -40,7 +40,11 @@ is filled in ascending order, starting with the first enabled sensor from left t
// var i; // var i;
// var j = 1; // var j = 1;
// for (i = ii; i < input.bytes.length-1; i=i+2) { // for (i = ii; i < input.bytes.length-1; i=i+2) {
// decoded["t" + j] = ((input.bytes[i]) | (input.bytes[i+1] << 8 )) / 100.0; // decoded["t" + j] = ((input.bytes[i]) | (input.bytes[i+1] << 8 ));
// var sign = input.bytes[i+1] & (1 << 7);
// if (sign)
// decoded["t" + j] = 0xFFFF0000 | decoded["t" + j];
// decoded["t" + j] = decoded["t" + j] / 100.0;
// j++; // j++;
// } // }