corsacOTA

An esp8266/esp32 websocket OTA library

MIT License

Stars
7
Committers
2

An esp8266/esp32 websocket OTA library.

Warning: This project is not yet ready for production, API and document are subject to change without notice.

Features

  • Fine-granular OTA management.
  • A frontend component out of the box.
  • Easy to integrate into user projects.
  • No need to embed the frontend page, lower firmware and memory usage.
  • Lightweight and fast WebSocket implementation.

Support device

  • esp8266/esp8285
  • esp32
  • esp32c3
  • esp32s3

Use the web client for OTA

Demo Site

https://user-images.githubusercontent.com/17078589/146638094-34c46717-1b1a-42a6-961f-4835347cc6e5.mp4

Usage

corsacOTA works with esp-idf.

Just add src/corsacOTA.c to your project:

co_handle_t handle;
co_config_t config = {
    .thread_name = "corsacOTA",
    .stack_size = 4096,
    .thread_prio = 8,
    .listen_port = 3241,
    .max_listen_num = 4,
    .wait_timeout_sec = 60,
    .wait_timeout_usec = 0,
};

corsacOTA_init(&handle, &config);

Related examples of use can be found here: examples

Document

API for frontend

corsacOTA provides a default frontend for performing online OTA, and you can also implement it yourself. See: corsacOTA API on postman

Parition table

Currently supported OTA partition table modes: Factory app, two OTA definitions.

Motivation and Notes

Ease of use, minimal dependencies, and fine-grained OTA management were the starting points for this project.


Why do we use websockets in our projects?

In the world of browser, the use of websockets is somewhere between pure sockets and HTTP. Considering that most of the usage scenarios are in the browser, we have chosen websocket.

However, WebSocket is not always a good idea because operations such as handshake and mask add a certain level of complexity. If the network is good, then other solutions should achieve the same results.

Nevertheless, it has some advantages in complex network conditions with frequent packet loss, where you can achieve easy flow control and more precise progress control in the browser.

Overall, our solution is a compromise between ease of use, compatibility and speed.

Dependency

For the main part of the project, there are no dependencies on third-party libraries other than esp-idf.

For frontend:

Credit

Credits to the following project, people and organizations: