Open jlut93 opened 1 year ago
Good questions. I have zero idea why it should hang. There is just not enough information for me ...
I'll add some logging to SRAM logic to the next drop. This way you could look at the state after the system failed and go from there.
Ok thanks.
This is the code inside the if statement:
void measure() { union { float ival; byte bval[4]; } int32AsBytes;
SHT31D result;
digitalWrite(sensorPWR, HIGH); delay(1); result = sht3xd.readTempAndHumidity(SHT3XD_REPEATABILITY_LOW, SHT3XD_MODE_CLOCK_STRETCH, 50); batteryLevel = STM32L0.getVDDA();
digitalWrite(sensorPWR, LOW);
displayVbatSerial(); displayResultSerial(result); LoRaWAN.beginPacket(3);
int32AsBytes.ival = result.t; for(int i = 0; i <= 3; i++) // reverse for big-endian { LoRaWAN.write(int32AsBytes.bval[i]); } int32AsBytes.ival = result.rh; for(int i = 0; i <= 3; i++) // reverse for big-endian { LoRaWAN.write(int32AsBytes.bval[i]); } int32AsBytes.ival = batteryLevel; for(int i = 0; i <= 3; i++) // reverse for big-endian { LoRaWAN.write(int32AsBytes.bval[i]); } LoRaWAN.write(lowByte(buttonPressed)); LoRaWAN.write(lowByte(thisNodeNumber)); LoRaWAN.endPacket(); }
There is a timeout for the sht3xd.readTempAndHumidity function, but I don't think I can add any more
Hi,
I have a few Grasshopper LoRaWAN boards operating in some remote locations, transmitting room temperature and humidity every 10 min.
I find that they transmit to the gateway for about a week and then they stop transmitting. When I pick up the sensor and reset they rejoin the gateway OK and carry on transmitting until I get the issue again. I think that it is hanging somewhere in the code
At the moment the transmitting code is inside an if statement:
if (!LoRaWAN.busy() && LoRaWAN.joined()) code here end
Is this if statement robust enough to ensure that the code won't hang if the packet send fails? Is there something else that I can include? Thanks