2020-05-17 10:32:37 +00:00
|
|
|
/*********************************************************************
|
|
|
|
* The TTN Payload function equal for all environment applications
|
2020-05-18 09:45:53 +00:00
|
|
|
**********************************************************************/
|
2020-05-17 10:32:37 +00:00
|
|
|
function Decoder(bytes, port) {
|
|
|
|
var retValue = {
|
|
|
|
bytes: bytes
|
|
|
|
};
|
|
|
|
|
|
|
|
retValue.node = bytes[0];
|
|
|
|
retValue.battery = bytes[1] / 10.0;
|
|
|
|
retValue.vcc = bytes[2] / 10.0;
|
|
|
|
retValue.temperature = (((bytes[3] << 8) | bytes[4]) / 10.0) - 40.0;
|
|
|
|
retValue.pressure = ((bytes[5] << 16) | (bytes[6] << 8) | bytes[7]);
|
|
|
|
retValue.humidity = ((bytes[8] << 8) | bytes[9]) / 10.0;
|
|
|
|
return retValue;
|
|
|
|
}
|
2020-05-18 09:45:53 +00:00
|
|
|
|
|
|
|
|