You are reading a single comment by @oesterle and its replies. Click here to read the full conversation.
  • Right now, everything lives inside onInit(). Can you reorganize your code into separate task-focused functions? That may relieve memory issues, and also make your code more reusable on other projects.

    I'd try to make onInit() focused on just the setup you need to do on power on.

    You also have a long-lived nest of multiple callback functions. I'd pull the connection and sending out into a separate function that's called every 2 minutes. In that function, I'd also turn off Wi-Fi when done sending. This is good practice for IoT sensors that you intend to battery power, also.

    Finally, you'll still probably have rare occasions where connection or sending fails, but these should be less frequent.

About

Avatar for oesterle @oesterle started