Getting ip address may need to be done with a callback... at least that was the case a while back under certain circumstances (independent processors... not like Espruino on ESP8266... and it may be the same in ESP32... (w/ Espruino on ESP8266 I have not much experience, w/ ESP32 none so far, and with Espruino paired w/ ESP8266 / CC3000 some). - Just looked .getIP() up at https://www.espruino.com/Reference#t_l_Wifi_getIP - and you should be fine using it straight and not need to use the callback. But I though recommend two things:
Put your (active) stuff into 'the' onInit(){ ...} function so it is not executed while your upload is still going on. You start the code then with entering onInt(); in the console... and if you get tired of it while developing, use my lazy trick and have the last line like this (after the onInit(){} function:
Recommended code beginning w/ line 6 is something like that to catch errors (see https://www.espruino.com/Reference#l_Wifi_connect ):
wifi.connect(ssid, {password: password}, function(err) {
if (err) {
// do something w/ the error, like console.log(err) or throw err;
} else {
// move on with the 'good stuff'
});
```
You may think of an app watch dog to retry - deferred - what ever brings your app down or does not get it started...
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.
Getting ip address may need to be done with a callback... at least that was the case a while back under certain circumstances (independent processors... not like Espruino on ESP8266... and it may be the same in ESP32... (w/ Espruino on ESP8266 I have not much experience, w/ ESP32 none so far, and with Espruino paired w/ ESP8266 / CC3000 some). - Just looked
.getIP()
up at https://www.espruino.com/Reference#t_l_Wifi_getIP - and you should be fine using it straight and not need to use the callback. But I though recommend two things:Put your (active) stuff into 'the'
onInit(){ ...}
function so it is not executed while your upload is still going on. You start the code then with entering onInt(); in the console... and if you get tired of it while developing, use my lazy trick and have the last line like this (after the onInit(){} function:wifi.connect(ssid, {password: password}, function(err) {
if (err) {
} else {
});
```
You may think of an app watch dog to retry - deferred - what ever brings your app down or does not get it started...
Did you consult forum conversation http://forum.espruino.com/conversations/313576/ - HTTPS on ESP32?
...and yep, if your app eats away too much vars, that may be the problem...