I have a moteino hooked up to a BPE280 sensor via I2C. With the normal WeatherNode sketch, I wasn't getting any data at the gateway. I uncommented #define SERIAL_EN and noticed that the terminal output had no data either and would consistently return,
WAKEUP
packet length:0
I played with some things but in the end, adding a DEBUG(""); after the line that puts the bme280 to sleep did the trick. Why? With that change, I am getting accurate readings at the terminal as well as the gateway. If I disable SERIAL_EN, the problem returns. Replacing the DEBUG("") with a delay(50) doesn't make any difference so it's not a timing issue. Any ideas?
I don't have a WeatherNode but I have had a problem whereby code worked fine when there was serial output to the UART and when I disabled serial output the code stopped working. I was able to get around it by adding this definition:
#define DEBUG 1
#if !DEBUG
ISR(TIMER0_OVF_vect){} // Needed to make the WDT work
#endif
If you don't know what I'm doing here, DEBUG can either be 0 or 1 and controls whether or not Serial.debug code is compiled or not.
If you don't have the FLASH MEM chip I would comment out the code specific to that.
The SERIALFLUSH() should take care of any serial data, and I don't see a reason why DEBUG on/off should cause a problem.
This sketch was obviously tested before published so it should work as long as everything is wired right.
No change when commenting out the FLASH MEM related code or adding the ISR code recommended by ChemE. It looks like the sprintf to build the buffer fails but why would this change when adding one extra line of code?
I started thinking that this is compiler\optimizer related somehow. So to test this, I searched for another Arduino IDE and installed Platform IO. I built a new WeatherNode project, compile, upload and problem is gone. Maybe I didn't configure the Arduino 1.0.6 IDE correctly? Platform IO is easier to navigate and feels like a more substantial IDE so I'll probably stick to it.
One annoying thing with the Arduino IDE is that I cannot tell where the libraries are being sourced from - the read-only feature is confusing.
Thank you for the help.