Hi,
I have an Uno WiFi R4 that works with the File > Example > OTAUpdates sketch that points to
static char const OTA_FILE_LOCATION[] = "https://downloads.arduino.cc/ota/UNOR4WIFI_Animation.ota";
I can download this file. Host it myself via HTTP (not HTTPS), and OTAUpdates works pointed to the file on my webserver.
What I cant seem to do is figure out how to compile a sketch into a format the OTAUpdates sketch will actually download.
I've located the compiled exports from the IDE at:
C:\Users\USERNAME\AppData\Local\arduino\sketches\03CB4EDBD33F2F24AF5F98C5DFDFC182
Where I have a .bin, .hex, .map, .efl etc.
All attempts to host this .bin and point OAUpdates to it result in it hanging or failing at ota.download.
Even for the example PlayAnimation sketch, the .bin is 53KB, VS the .ota linked in the example being 29KB.
Am I beating my head against file size limits? Some way to make a .OTA file beyond just compiling that also compresses?
OTAUpdates Example I'm using:
#include "WiFiS3.h"
#include "OTAUpdate.h"
#include "root_ca.h"
#include "arduino_secrets.h"
const char* ssid = "SSID";
const char* pass = "Pass"; // your network password (use for WPA, or use as key for WEP)
int status = WL_IDLE_STATUS;
OTAUpdate ota;
static char const OTA_FILE_LOCATION[] = "http://192.168.1.100/files/PlayAnimation.bin";
/* -------------------------------------------------------------------------- */
void setup() {
/* -------------------------------------------------------------------------- */
//Initialize serial and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
delay(1000);
// check for the Wi-Fi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with Wi-Fi module failed!");
// don't continue
while (true);
}
String fv = WiFi.firmwareVersion();
if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
Serial.println("Please upgrade the firmware");
}
// attempt to connect to Wi-Fi network:
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
// wait 1 seconds for connection:
delay(1000);
}
delay(1000);
printWiFiStatus();
Serial.println("about to ota.begin");
delay(100);
int ret = ota.begin("/update.bin");
if(ret != OTAUpdate::OTA_ERROR_NONE) {
Serial.println("ota.begin() error: ");
Serial.println((int)ret);
return;
}
// Serial.println("about to ota.setCACert");
// delay(100);
// ret = ota.setCACert(root_ca);
// if(ret != OTAUpdate::OTA_ERROR_NONE) {
// Serial.println("ota.setCACert() error: ");
// Serial.println((int)ret);
// return;
// }
Serial.println("about to ota.download");
delay(100);
int ota_size = ota.download(OTA_FILE_LOCATION, "/update.bin");
if(ota_size <= 0) {
Serial.println("ota.download() error: ");
Serial.println(ota_size);
return;
}
Serial.println("about to ota.verify");
delay(100);
ret = ota.verify();
if(ret != OTAUpdate::OTA_ERROR_NONE) {
Serial.println("ota.verify() error: ");
Serial.println((int)ret);
return;
}
Serial.println("about to ota.update");
delay(100);
ret = ota.update("/update.bin");
if(ret != OTAUpdate::OTA_ERROR_NONE) {
Serial.println("ota.update() error: ");
Serial.println((int)ret);
return;
}
}
/* -------------------------------------------------------------------------- */
void loop() {
/* -------------------------------------------------------------------------- */
delay(1000);
}
/* -------------------------------------------------------------------------- */
void printWiFiStatus() {
/* -------------------------------------------------------------------------- */
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print your board's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}
Any help appreciated.