Blocking event causes wifi disconnect

Hello all. Total newb here. My project is using an MQ131 ozone detector. Using the MQ131 library, the sensor needs about 45 seconds of heating time in each reading. That line of code is a blocking event where the code stops until the sensor heating cycle is completed. The wifi on my WeMosD1 mini disconnects.

What’s the best solution? I have tried experimenting with the changing the heartbeat to 60 seconds, but that’s causing other connection issues. I know I can force a reconnect after the sensor has taken a reading, but how do I prevent the disconnect in the first place?

If that is a simple delay(45000) then you can replace this with a non-blocking BlynkTimer, probably as a lambda command.
If it’s a command within the library that does thus then maybe use a different library?

Pete.

Hi, thanks for the reply. No, there are no delays in the code. The blocking event is called “MQ131.sample();” and takes 45 seconds to run (sensor is heating to measure ozone). The code needs to stop running while this happens. No other library will overcome this because it’s a requirement of the sensor.

Back to my question…how do I prevent the wifi from disconnecting? Is this an adjustment to #define BLYNK_HEARTBEAT or #define BLYNK_TIMEOUT_MS (or both).

Any other possible workarounds to keep the connection alive?