I'm using platformio and my ini is:
[env:esp07]
platform = espressif8266
board = esp07
framework = arduino
upload_port = COM16
upload_speed = 115200
build_flags = -Wl,-Tesp8266.flash.1m64.ld
monitor_port = COM16
monitor_baud = 115200
The OTA setup code is below. The rest of the code works, so I assume the issue is here:
void configure_OTA()
{
/** OTA CONFIG **/
ArduinoOTA.onStart([]() {
String type;
if (ArduinoOTA.getCommand() == U_FLASH)
type = "sketch";
else // U_SPIFFS
type = "filesystem";
// NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
Serial.println("Start updating " + type);
});
ArduinoOTA.onEnd([]() {
Serial.println("\nEnd");
});
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
});
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR)
Serial.println("Auth Failed");
else if (error == OTA_BEGIN_ERROR)
Serial.println("Begin Failed");
else if (error == OTA_CONNECT_ERROR)
Serial.println("Connect Failed");
else if (error == OTA_RECEIVE_ERROR)
Serial.println("Receive Failed");
else if (error == OTA_END_ERROR)
Serial.println("End Failed");
});
// Should be default, but let's be explicit.
String chip_id = String(system_get_chip_id());
String hostname = "sensor_" + chip_id;
ArduinoOTA.setHostname(hostname.c_str());
ArduinoOTA.setPassword("my_password");
ArduinoOTA.setPort(8266);
ArduinoOTA.begin();
Serial.println("OTA setup");
/** OTA CONFIG **/
}
This doesn't work, even with the Basic OTA example. The chip outputs something like this on boot:
Chip ID:4266305
Connecting.......Ready
IP address: 192.168.1.6
4266305: Trying to connect to MQQT Broker
4266305: Connected to MQTT Broker
So it's connecting to the WiFi, has an IP address and OTA is configured. However there doesn't seem to be a way of checking if the mDNS service is actually working - aside from seeing if it pops up in platformio's device manager.
Since it did work on the first prototype, what could be different? The firmware is flashed OK, so I don't think it's an upload error. Perhaps the other modules have a different config somehow? (Do I need to upload a different bootloader?)