How to catch error from wifi-connect?


#1

Hi

Sometimes when starting up my esp32 board , I got an error: unable to connect (after a wifi-connect). Its very rare , but it happens sometimes , probably to long distances or whatever.(nothing to do with ulisp)
Is it however possible to test for this error after a wifi-connect and if there’s an error to try again the wifi-connect ?

Kind regards ,

Ronny Suy


#2

Currently the routine wifi-connect returns the IP address as a string, and gives an error if there’s any problem connecting to the Wi-Fi network.

You could change this to return nil if there’s any error by replacing each of the calls to error() with return nil.

In general this seems less useful, so I’m not sure whether it should be changed in the release version of uLisp.


#3

Hi David ,

Thanks.
I learned today that I can use (string= “192.168.0.212” (wifi-connect “myssid” “mypaswd”))
It gives t if connected , nil otherwise

I didn’t realize that you could test on the result from wifi-connect.

Kind regards ,
Ronny