Go Down

Topic: MKR1010 OTA download from Http not working (Read 163 times) previous topic - next topic

kbremner

Hi.
Ive been trying to get OTA downloads working using ArduinoOTA/examples/Advanced/OTASketchDownload/

I have a HTTP server running, and can see the .bins there, but the MKR just keeps reporting 404;
 Check for update file -v2.bin
Update status code: 404

I think the issue is with the path, and I need some help with an explanation of this part of the code;

  const char* SERVER = "192.168.1.108"; // must be string for HttpClient
  const unsigned short SERVER_PORT = 80;
  const char* PATH = "/update-v%d.bin";

Can you please explain the workings of the path..../update-v%d.bin?;
I guess /update can be any path that choose to place the bins right?
What is the -v%d mean?
Perhaps this is a way to capture all(both) .bin files?
Why do I get a 404..I can see the files from another computer just fine, so the http server is working.
If I place the files at Macintosh/users/myname/OTASketch.....what do I need to write into that  const char* PATH = ?

The serialmon reports  "Check for update file -v2.bin"....is there a connection here to the -v?


I feel very close to getting this working...just missing something basic here I think....help!
Thanks
kb

Juraj

you must somehow ensure for the update to not to download again. a version number is used for that.
the example uses simplest possible versioning, because the goal is to show the usage of InternalStorage, not how to download the update.

http://www.cplusplus.com/reference/cstdio/printf/

kbremner

Hi. Thanks for your reply!
Ok so I see now that %d is for a decimal integer value..the version number as a varible.
Ive been trying hard to get the download working but not there yet.
Error 404 has gone and now I get "Update status code: -2". What is code 2 meaning?

Serial monitor is looping with;
Check for update file /update-v2.bin
Update status code: -2

When I export my Sketch, called update-v2, I get two resultant binaries landing in the webserver folder. these are update-v2.ino.mkrwifi1010.bin, and update-v2.ino.with_bootloader.mkrwifi1010.bin.
Will this work?, do we need them both or just one? Is this file naming going to work, or do I need to rename the right file as update-v2.

What am I missing here?
I see in the code there is a constant as const short VERSION = 1;....Do I need to mess with this each time thee is a new version or is this for the first time. And therefore I assume I need to make the next version as update-v2?

Thanks
Keith

Juraj

https://github.com/arduino-libraries/ArduinoHttpClient/blob/7f36561e0bced5458516066ae09636e119cae0ed/src/HttpClient.h#L12

// This call was made when the HttpClient class wasn't expecting it
// to be called.  Usually indicates your code is using the class
// incorrectly
static const int HTTP_ERROR_API =-2;

every new bin prepared to publish for updatte should have a new version number in code and in file name. the only reason is to prevent downloading it more the once

Go Up