After sometime the Button widget stops working or gets delayed

There is no delay in the loop still Its getting disconnected after an hour or so. First sign is the buttons on the app stops working. But the value display widgets works fine. Is it due to flooding?

My code is here :

You have a lot of timers that will all coincide quite frequently. For example, every 2 seconds you have 7 timers that are all trying to run at the same moment.

Pete.

Isn’t the limit is 10. Also if I set a timer to run every 1 second and another to run every 2 seconds. Wouldn’t they still run at the same moment in every even iteration?

The limit is 16 timers per timer object when using BlynkTimer, but that wasn’t my point.

Exactly, which was my point.
You have three timers that tries to run at exactly the same point every 500ms (not good practice), one timer that tries to run every 1 second (so every 1 second the 500ms and the 1 sec timers try to run.
You then have three timers that try to run every 2 seconds, so every second second you have 3x 500ms timers, 1x 1 second timer and 3x 2 second timers that are all trying to run at the same time.

Whilst the ESP32 processor has two cores, your code is only written to run in one core. The processor isn’t multi-tgreading, so can only perform one instruction set at any one time.
You should search the forum for topics about staggering timers.

This may not solve your problem, but needs to be eliminated as a possible contributing factor.
I suspect that the esp-now code may also be an issue, but TBH I don’t have the time to unpick your code, and you haven’t provided any narrative or back-story to help with this.

Pete.

ESP Now is used here to get value from a sensor node. I’ll reduce virtual writes and see if it goes. Also for the flooding message to appear, will i have to enable

#define BLYNK_DEBUG too

or just the

#define BLYNK_PRINT Serial

There is no flooding message, and I don’t think that flooding is your issue.

You’re not interested in fixing g your overlapping timer issue then?

You’d be better running Blynk on that mode and using Bridge code to get the values.

Pete.

What i understood from timer coinciding was that too many virtual writes are happening so i thought it is flooding, i thought thats what you meant. So I guess all those functions running at same time, (not just virtual writes) are slowing down the CPU is what you mean right? correct me if i’m wrong.

I read someone posted an error log in which It says Blynk error : flood and some URL attached to it.

Also why is chose ESP Now is to make a offline compatible system. I had blynk bridge before but its internet dependency led me to find another way.

The point is that all those functions are trying to run at the same time, but your single threaded processor can’t execute them at the same time.

I never mentioned excessive Blynk writes or flood errors.

I’ve never seen that, but it sounds like a server-side log that might be seen if you were running a local server.

You might be better running a local server in that case.

Pete.