vshymanskyy / TinyGSM

A small Arduino library for GSM modules, that just works
GNU Lesser General Public License v3.0
1.93k stars 715 forks source link

Blocking function or infinite loop #524

Open brunocadet opened 3 years ago

brunocadet commented 3 years ago

Hi,

I found this issue : When testing .isNetworkConnected() TinyGsm enters in an infinite loop if 'false'.

Thanks for help.

SRGDamia1 commented 3 years ago

It shouldn't. There's no looping at all in that function. If you're looking at inside of waitForNetwork() where there is a loop, there's a built in default of 60 seconds. Awfully long, but not infinite. You can shorten it to whatever you want by using waitForNetwork(timeout_ms).

Otherwise, post the full AT dump showing the problem.

roysG commented 2 years ago

Is there any replace method for waitForNetwork that no blocking the code, or another suggested way to check if the connection is backed, without blocking the loop?

SRGDamia1 commented 2 years ago

@roysG I'd take a pull request if you have a solution.