vsolina / micropython-web-editor

Web-based code editor (IDE) for MicroPython controllers with WiFi
MIT License
25 stars 3 forks source link

first-time help for new users (show how to connect) #13

Open gitcnd opened 11 months ago

gitcnd commented 11 months ago

BRILLIANT project!!

Might I suggest, where it currently prints this: "Starting IDE web service" you update that message so it says this instead:-

Starting IDE web service on http://192.168.123.123/ ... so we don't have to fuss around trying to work out what IP to use, and whether or not it's on port 80 ...

gitcnd commented 11 months ago

I took a stab at fixing this, but of course, the IP is always 0.0.0.0 until the connection is up

print("Starting IDE web service on http://" + wlan.ifconfig()[0] + "/") # this never works, because non-blocking above (wlan.isconnected())

someone smarter-than-me might have to explain how to code a callback to do the print after the connection comes up...

vsolina commented 11 months ago

That would be a cool feature. There is a bit of complexity, though: ESP32 can have multiple IP addresses (wlan, eth) at the same time, but for start I could just show the WiFI IP if available.

gitcnd commented 11 months ago

I'm in the middle of researching a much better idea... mDNS... eg: "esp32-1234.local" (where we can pick the name by putting it in some file or whatever - e.g. "geiger.local" for my local geiger-counter project when I upgrade that to uPy)... still needs some kind of async tool to wait for an IP then deal with port5353 UDP stuff, so that component itself could also print out the IP (and name) on the serial port when first connected.