Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement OTA updates #13

Open
jeffkowalski opened this issue Feb 22, 2024 · 10 comments
Open

Implement OTA updates #13

jeffkowalski opened this issue Feb 22, 2024 · 10 comments
Labels
enhancement New feature or request

Comments

@jeffkowalski
Copy link
Collaborator

Brian says:
OTA updates would be wonderful. However, we are nearly at the 2MB limit and OTA requires 3X the storage. We can double our memory because PlatformIO thinks our board only has 2MB of storage when in fact it has 4MB. We need to twiddle a setting.

@jeffkowalski jeffkowalski added the enhancement New feature or request label Feb 22, 2024
@jeffkowalski
Copy link
Collaborator Author

@brianmathews
Copy link
Member

Note, I found the bug where our module was being sensed as only 2MB Flash, when in fact we have 4MB flash.
That issue was fixed in an earlier check-in.
So OTA is very much possible now that we have access to the full 4MB.

@jeffkowalski
Copy link
Collaborator Author

I think that was fixed in 923b601
I've been looking into OTA.
One thing to decide - does the user upload a .bin that they've downloaded from somewhere, or should we "check for updates" against a known URL?

@brianmathews
Copy link
Member

I would check for updates against a known location such as the sotamat.com web server. GitHub LFS does not allow us to purge old versions and storage counts against the free tier quota. Hence we should use some non-GitHub web server.

We also want to make the process as simple as possible for non-developers. Developers can build their own source from GitHub.

@jeffkowalski
Copy link
Collaborator Author

(Note to self, more background information) see https://gitlab.com/kevinwolfe/esp32_template/-/blob/87ca0ecd615115fdc33013d45b84a237da230575/main/main.c for example

@jeffkowalski
Copy link
Collaborator Author

jeffkowalski commented Apr 18, 2024

@brianmathews Please give me a URL on sotamat.com where I can check for "official" releases of SOTAcat. I'd like to implement the "check for new version" feature, which is a component of OTA updates.

Ideally, official releases would have version and checksum encoding built into their filenames. The greatest version, or most-recently-dated version would could be used to determine freshness relative to the user's current version. The checksum would be used to validate the downloaded contents. That could be stored in a separate file (i.e. Vnnnnn-checksum.txt).
Another thing to consider is perhaps having a "latest.txt" which contains the filename and checksum for the most recent release (or just the filename, if the checksum is embedded in it). That would greatly simplify client-side checking, but might complicate the release process.

@brianmathews
Copy link
Member

brianmathews commented Apr 18, 2024

You can name the file(s) anything you want. They will just be part of the Wordpress Media folder as files in the pattern:

https://sotamat.com/wp-content/uploads/YOUR-FILENAME-HERE

...and I am assuming that our releases are infrequent enough that we can just manually publish a new release after testing. If you want automated builds with automated deployment onto the Wordpress site, then we'd need to invest more thought into this.

@jeffkowalski
Copy link
Collaborator Author

Excellent.
What will be the protocol for:

  1. Identifying release-able commit-points
  2. Building the code
  3. Uploading and naming the file. (who has access)
  4. Updating the "latest.txt" at the same place, if we assume to go that route.
    Can you envision a script for 2-4? MakeRelease.sh? ;)

@brianmathews
Copy link
Member

For the 1-click WebSerial deployment that is on the https://sotamat.com/sotacat page, the BIN file and version files are already scripted and part of the build process. For OTA we can extend the build process to make the required files on every build.
When we want to publish I just drag-n-drop the set of files into Wordpress's Media Bin and voila.
If you look at how the current unified BIN file is made in the platformio.ini file and the respective Python build extensions to PlatformIO you can see how you can do something very similar. for 2,3,4: it's just I'd do 2,3,4 on every build (if it is fast) and simply put those assets in the .gitignore. I can drag-n-drop into Wordpress when we want a real "release".

@jeffkowalski
Copy link
Collaborator Author

jeffkowalski commented Apr 18, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants