Both the serial monitor and TTN are showing -127
But I wonder if these rows in the code has something to do with that:
case DEVICE_STATE_SEND: { sensors.requestTemperatures(); // Send the command to get temperatures again to refresh at every transmission delay(750);
If I have them in my code it will join the network, but after Joined message nothing happens, so it does not send any data. If I take that away from the code, it sends data.
Here example from the console:
30.04.20 13.42.25: Content of temp float value from Sensor: = -127.00 Degrees Celsius
30.04.20 13.42.25: Preparing to send data via Semtex Radio
30.04.20 13.42.25:
30.04.20 13.42.26: BatteryVoltage:4180
30.04.20 13.42.26: confirmed uplink sending ...
30.04.20 13.42.27: receive data: rssi = -95, snr = -2, datarate = 5
And here are my decoder (I know that battery voltage is missing):
function Decoder(bytes, port) {
var decoded = {};
return decoded;
}function tofloat32(a1,a2,a3,a4){
var s=(a1&0xff)>>7;
var E=(a1<<1&0xff)|a2>>7;
var M0=(a2&0x7f)<<16|a3<<8|a4;
var M=1;
for(var i=0;i<23;i++)
{
if(M0>>i&0x01==1)
{
M=M+Math.pow(2,i-23);
}
}
var result=Math.pow(-1,s)*M*Math.pow(2,E-127);
return result;
}
function Decoder(bytes, Port)
{
var temperature = tofloat32(bytes[3],bytes[2],bytes[1],bytes[0]);
var result={
" ":{
"Temperature Celsius":temperature,
}
}
return result;
}