Maybe you could try the following before the getAPs?
wifi.at.cmd("AT+CWMODE=1\r\n", 1000, print);
That'll put the module into non-AP mode. The second connect should have done that automatically though, but maybe the fact that it doesn't manage to connect means that it doesn't remember after a reset.
Also it might be worth trying call getAPs a few seconds after a reset - maybe the ESP8266 needed a few seconds to gather a list of APs (although it didn't on mine).
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Maybe you could try the following before the
getAPs
?That'll put the module into non-AP mode. The second
connect
should have done that automatically though, but maybe the fact that it doesn't manage to connect means that it doesn't remember after a reset.Also it might be worth trying call
getAPs
a few seconds after a reset - maybe the ESP8266 needed a few seconds to gather a list of APs (although it didn't on mine).