Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sivar2311/simplehttpupdater
https://github.com/sivar2311/simplehttpupdater
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sivar2311/simplehttpupdater
- Owner: sivar2311
- Created: 2022-06-26T08:21:09.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-26T20:01:40.000Z (about 1 year ago)
- Last Synced: 2024-10-15T03:24:59.668Z (3 months ago)
- Language: C++
- Size: 564 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SimpleHTTPUpdater
Library for automatic generated FIRMWARE_BUILD numbers and for retrieving firmware updates from HTTP servers.
# Installation (PlatformIO)
Add the following line to your `platformio.ini`:
```
lib_deps = https://github.com/sivar2311/SimpleHTTPUpdater
```# Use
### Including the automatically generated `version.h`
```C++
#include "version.h"
```### Define the download URLs for `firmware.bin` and `firmware.nfo`:
```C++
const char* firmware_download_url = "http://server/firmware.bin";
const char* firmware_info_url = "http://server/firmware.nfo";
```### Initialize the library in `setup()`:
```C++
SimpleHTTPUpdate.begin(firmware_download_url, firmware_info_url, FIRMWARE_BUILD);
```### Call the library's handle function periodically in `loop()`:
```C++
SimpleHTTPUpdate.handle();
```
*Note: `FIRMWARE_BUILD`is defined in `version.h` and increases automatically on each firmware-build*# Compile & Upload to your webserver
Compile your project and upload the new versions of `firmware.bin` and `firmware.h` to your webserver.# Using HTTPS
If you'd like to use HTTPS, you can do the following:
```C++
WiFiClientSecure client;
client.setCACert("-----BEGIN CERTIFICATE----- your cert here .....");
SimpleHTTPUpdate.setClient(&client);
```# Example
For details, see the example: [HTTPUpdate.ino](./examples/HTTPUpdate/HTTPUpdate.ino)
# How it works (PlatformIO)The library maks use of PlatformIO scripting and creates and updates automatically the files `version.h` in your source folder and `firmware.nfo` in the project folder.
The version number increases on each firmware build.
`SimpleHTTPUpdate.handle()` checks periodically if new firmware updates are available on the web server.
If a higher version is found, it will be downloaded and installed automatically.