Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
LazaUK authored Aug 30, 2022
1 parent 0651d1a commit bad851a
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion Helium_Function/Helium_Decoder.js
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@

function Decoder(bytes, port) {

var decoded = {};

function transformers(bytes){
value = bytes[0] * 256 + bytes[1];
if (value >= 32768) {
value = 32768 - value;
}
value = value/100.0;
return value;
}

if (port == 8) {
decoded.generator_temperature = transformers(bytes.slice(0, 2));
decoded.generator_humidity = transformers(bytes.slice(2, 4));
}

return decoded;
}

0 comments on commit bad851a

Please sign in to comment.