Description
Hi.
I think the current implementation of OTA port detecting is a little bit to buggy. There are a lot of reoccurring issues from people not getting it to work. (/me coming from the esp8266 side) I struggled the better part of some days to get it to work, never had stable success. Opinions about the reason differ, the state of esp8266mdns, jmdns and the Discoverer-concept (why use timers?) inside the IDE...
That said, I think there is way too many and complex software involved, I would like a more basic approach. This will give other hardware a very fast road to OTA update without porting any mdns stuff.
My current solution uses this inside the sketch:
String initmsg1 = "mysoftware version 1.0";
void PostMyself(void) {
IPAddress broadcastIp(WiFi.localIP() | ( ~WiFi.subnetMask()));
WiFiUDP udp;
udp.begin(8765);
udp.beginPacket(broadcastIp, 8531);
udp.print("1\nesp8266 "+initmsg1+"\n8266\n");
udp.endPacket();
}
It can be located inside a "if (millis()-ticker>5000)"-Timer thing inside the loop(). IDE sees these broadcasts and adds the menue.
Changes are (mainly) at https://github.com/holgerlembke/Arduino-IDE/tree/master/arduino-core/src/cc/arduino/packages/discoverers It is the basic outline, sure needs some work, but should be a good demonstration for this proposal.
I tested it with the current esp8266-ArduinoOTA solution, works.
Opinions?