How to protect the module to not work too hard?

I have write to code that have to read value every 3 sec . After 30mins or more than module have been stop or auto shutdown.

Do anyone have the ways to clean the old data while app is running or fix the maximum value and clean the old data when it was in max value?

you can control this in your application

how to?
Do you have sample?

this is sample of my code now
wifi.c (28.3 KB)

what is the reason for module shutdown or stop?

I don’t know. Is It have way to check?

do you check the dmesg
do you check the logread