diff --git a/ROMULATOR_STANDALONE.md b/ROMULATOR_STANDALONE.md index 17f663c..d27381a 100644 --- a/ROMULATOR_STANDALONE.md +++ b/ROMULATOR_STANDALONE.md @@ -52,12 +52,8 @@ At this point, your standalone programmer is ready to go. Connect the D1 Mini to Now you can power up, and wait for the blinking LED to stop blinking and be solidly on. This indicates that the board has successfully connected to your router and is now on your wifi network. -Here is one tricky part. The D1 Mini is supposed to be able to self-report a hostname, much like the raspberry pi does on your local network (raspberrypi.local). This would be convenient, since you could refer to this address rather than needing to know the local IP that your router happens to assign to the device. However, I was not able to get this to work, despite trying sample code exactly which claimed to do this. Possibly a router misconfiguration on my part. Feel free to let me know if you have any insights on this.\ -For this reason, I added a simple redirect service hosted on my site, bitfixer.com.\ -Once the D1 Mini successfully connects to your network, it makes a single request to http://bitfixer.com/rmltr/r.php. Included in this request is the local IP address the device was given by your router.\ -After your D1 Mini connects, you can then reach its web interface by going here:\ -[http://bitfixer.com/myromulator](http://bitfixer.com/myromulator)\ -This reads the IP of the incoming request, which will match the IP of the D1 Mini since they are on the same network, and will redirect you back to the D1 Mini's local IP. This allows you to reach the web interface without knowing the specific local IP.\ +Your device should be reachable now under . + You can also just check the local IP of the device on your router as well and connect directly to it, either method works. Once connected to the web interface, you can program the ROMulator with the firmware you built, which will be in bin/romulator.bin in the bf-romulator directory. Just select 'Program' on the webpage and then select this file, and wait until the upload and programming completes. That's it! diff --git a/romulator-programmer-debugger/.gitignore b/romulator-programmer-debugger/.gitignore new file mode 100644 index 0000000..89cc49c --- /dev/null +++ b/romulator-programmer-debugger/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/romulator-programmer-debugger/.vscode/extensions.json b/romulator-programmer-debugger/.vscode/extensions.json new file mode 100644 index 0000000..080e70d --- /dev/null +++ b/romulator-programmer-debugger/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ], + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" + ] +} diff --git a/romulator-programmer-debugger/src/rServer.cpp b/romulator-programmer-debugger/src/rServer.cpp index f9c9697..a1dcec5 100644 --- a/romulator-programmer-debugger/src/rServer.cpp +++ b/romulator-programmer-debugger/src/rServer.cpp @@ -1,6 +1,7 @@ #include "rServer.h" #include #include +#include #include #include #include @@ -354,18 +355,16 @@ void startServer() digitalWrite(LED_PIN, LED_ON); Serial.printf("connected, ip address %s\n", WiFi.localIP().toString().c_str()); - // report local ip address to forwarding service - // this allows you to find your romulator on your local network easily - WiFiClient client; - HTTPClient http; - char url[256]; - sprintf(url, "http://bitfixer.com/rmltr/r.php?ip=%s", WiFi.localIP().toString().c_str()); - - http.begin(client, url); - int httpCode = http.GET(); - Serial.printf("recv %d\n", httpCode); - String payload = http.getString(); - Serial.printf("payload: %s\n", payload.c_str()); + // Set up mDNS responder: + // romulator.local + if (!MDNS.begin("romulator")){ + Serial.println("Error setting up MDNS responder!"); + while (1){ + delay(1000); + } + } + + Serial.println("mDNS responder started"); } server.on("/", handlePortal); @@ -385,6 +384,9 @@ void startServer() server.begin(); Serial.println("HTTP server started.\n"); + // Add service to MDNS-SD + MDNS.addService("http", "tcp", 80); + _lastMillis = millis(); } @@ -408,6 +410,10 @@ void handleClient() _lastMillis += 500; } } - + else + { + MDNS.update(); + } + server.handleClient(); } \ No newline at end of file