So I couldn’t find a solution.
I have an arduino mega using a sim800l to connect to blynk.
I control the sim800l power with a mosfet, so i can turn it off to save power.
I want to be able to continue with the code even if the sim800 can’t connect to the network.
The problem with GSM connection is that the code in library forces reboot on MCU if it cannot init the modem. In such a case it is not that straightforward to continue without connection. In case of proper modem initialisation but interrupted GPRS communication it is much easier to handle. I can post my solution to review, if needed.
Please do, I would appreciate it!
What i need is to understand if it could connect to the network, ex: if i’m in a location where i don’t have any signal. and if not, to continue with the code and try later.
Tried using config(), managed to connect but if i don’t have any gprs connection, it just reboots. There is no confirmation of a connect or a disconnect. The code just stops there, and I want it to continue instead.
Exactly the way it is. And currently I did nothing with that. You can modify a library to not trigger reboot, but in my case it is the correct behaviour. What I did, is a periodic GPRS connection check and reconnect attempt. But currently I’m on the mobile only and have not access to the computer.
Since I use this circuit on a battery, in case it doesn’t connect, i want it to turn off GSM and go to sleep for a while and try again later. If it keeps rebooting it continues to drain battery. Could you point me to where in the library i can change it? or share your solution when possible ofc.
As it comes to library mod, I traced the BLYNK_FATAL definition located in BlynkDebug.h.:
#define BLYNK_FATAL(msg) { BLYNK_LOG1(msg); BlynkFatal(); }
Where BlynkFatal() part causes the delayed (10sec) reboot
BLYNK_FATAL is called each time an unrecoverable (?) error occurs. In BlynkGsmClient.h file you will find it (among others) in bool connectNetwork() in line #43
SO, perhaps simple changing the BLYNK_FATAL to BLYNK_LOG1 in places, where you want to continue instead of reboot will help. BUT this solution is untested by me