From 2d7d37598c30414ba37b62c96f14765477d9058c Mon Sep 17 00:00:00 2001 From: ok-home Date: Tue, 10 Oct 2023 09:28:25 +0700 Subject: [PATCH] readme --- README-RU.md | 29 ++++++++++++++------- README.md | 72 ++++++++++++++++++++++++++++++---------------------- 2 files changed, 61 insertions(+), 40 deletions(-) diff --git a/README-RU.md b/README-RU.md index 1bc65e8..0544ae5 100644 --- a/README-RU.md +++ b/README-RU.md @@ -4,18 +4,23 @@ | ESP32 ESP32S3 ESP32C3 | | ----------------- | -# ESP32 OTA обновление через websocket с простым WEB интерфейсом +# ESP32 OTA обновление через WebsSocket с простым WEB интерфейсом. Опционально PreEncrypted режим. - Подключается как компонент к вашей программе - - Использует websocket протокол - - Подключается к любому web серверу на esp32, использующему websocket протокол, например (esp-idf examples/protocols/http_server/ws_echo_server) + - Не требует внешних серверов для хранения прошивок OTA, предназначен в первую очередь для работы в локальной сети. + - Использует WebsSocket или WebsSocket Secure протокол. + - Подключается к любому web серверу на esp32, использующему WebSocket протокол, например (esp-idf examples/protocols/http_server/ws_echo_server) или (esp-idf examples/protocols/https_server/wss_server) как URI handler. + - в зависимости от протокола сервера (http/https) будет выбран протокол обмена (ws/wss) + - режим PreEncrypted (espressif/esp_encrypted_img) подключается в Menuconfig + - для PreEncrypted режима требуется увеличение размера стека httpd_config_t config.stack_size = 4096*4; + - Подробности использования PreEncrypted режима https://components.espressif.com/components/espressif/esp_encrypted_img - Пример - example_ota_ws - Web интерфейс - Выбор файла прошивки - Загрузка прошивки в esp32 - Контроль загрузки прошивки - После обновления прошивки - подтверждение обновления или откат на предыдущую версию - - Выбор URI страницы OTA в menuconfig - - Обновление скачивается частями, размер фрагмента закачки в menuconfig + - Выбор URI страницы OTA в Menuconfig + - Обновление скачивается частями, размер фрагмента закачки в Menuconfig - Пример подключения ``` #include "ota_ws_update.h" // handler definition @@ -48,8 +53,14 @@ ota_0, app, ota_0, , 1M ota_1, app, ota_1, , 1M ``` - Параметры menuconfig - - CONFIG_PARTITION_TABLE_CUSTOM=y - - CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" - - CONFIG_HTTPD_WS_SUPPORT=y - - CONFIG_APP_ROLLBACK_ENABLE=y + - PARTITION_TABLE_CUSTOM=y + - PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" + - HTTPD_WS_SUPPORT=y + - APP_ROLLBACK_ENABLE=y + - OTA_DEFAULT_URI - адрес web интерфейса OTA + - OTA_DEFAULT_WS_URI - адрес ws/wss интерфейса OTA + - OTA_CHUNK_SIZE - размер фрагментов заказчки + - OTA_PRE_ENCRYPTED_MODE - включение PreEncrypted режима + - OTA_PRE_ENCRYPTED_RSA_KEY_LOCATION - место хранения rsa_private_key ( в каталоге компонента или в каталоге проекта ) + - OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY - директория хранения rsa_private_key diff --git a/README.md b/README.md index 542fa08..4d68c87 100644 --- a/README.md +++ b/README.md @@ -4,18 +4,23 @@ | ESP32 ESP32S3 ESP32C3 | | ----------------- | -# ESP32 OTA update via websocket with a simple WEB interface +# ESP32 OTA update via WebsSocket with a simple WEB interface. Optional PreEncrypted mode. - Connects as a component to your program - - Uses websocket protocol - - Connects to any web server on esp32 that uses the websocket protocol, for example (esp-idf examples/protocols/http_server/ws_echo_server) + - Does not require external servers for storing OTA firmware, designed primarily for working on a local network. + - Uses WebsSocket or WebsSocket Secure protocol. + - Connects to any web server on esp32 that uses the WebSocket protocol, for example (esp-idf examples/protocols/http_server/ws_echo_server) or (esp-idf examples/protocols/https_server/wss_server) as a URI handler. + - depending on the server protocol (http/https), the exchange protocol (ws/wss) will be selected + - PreEncrypted mode (espressif/esp_encrypted_img) is enabled in Menuconfig + - PreEncrypted mode requires an increase in the stack size httpd_config_t config.stack_size = 4096*4; + - Details of using PreEncrypted mode https://components.espressif.com/components/espressif/esp_encrypted_img - Example - example_ota_ws - Web interface - Select firmware file - Upload firmware to esp32 - Firmware download control - After updating the firmware - confirm the update or roll back to the previous version - - Select OTA page URI in menuconfig - - The update is downloaded in fragments, the size of the download fragment is in menuconfig + - Select OTA page URI in Menuconfig + - The update is downloaded in parts, the size of the download fragment is in Menuconfig - Connection example ``` #include "ota_ws_update.h" // handler definition @@ -23,33 +28,38 @@ // start webserver from esp-idf "examples/protocols/http_server/ws_echo_server" static httpd_handle_t start_webserver(void) { - httpd_handle_t server = NULL; - httpd_config_t config = HTTPD_DEFAULT_CONFIG(); - // Start the httpd server - ESP_LOGI(TAG, "Starting server on port: '%d'", config.server_port); - if (httpd_start(&server, &config) == ESP_OK) { - ESP_LOGI(TAG, "Registering URI handlers"); - /****************** Registering the ws handler ****************/ - ota_ws_register_uri_handler(server); - // end register ota_ws handler - return server; - } - ESP_LOGI(TAG, "Error starting server!"); - return NULL; + httpd_handle_t server = NULL; + httpd_config_t config = HTTPD_DEFAULT_CONFIG(); + // Start the httpd server + ESP_LOGI(TAG, "Starting server on port: '%d'", config.server_port); + if (httpd_start(&server, &config) == ESP_OK) { + ESP_LOGI(TAG, "Registering URI handlers"); + /****************** Registering the ws handler ****************/ + ota_ws_register_uri_handler(server); + // end register ota_ws handler + return server; + } + ESP_LOGI(TAG, "Error starting server!"); + return NULL; } ``` - - Example partitions.csv + - Example partitions.csv ``` -# Name, Type, SubType, Offset, Size, Flags -nvs, data, nvs, 0x9000, 0x4000 -otadata, data, ota, , 0x2000 -phy_init, data, phy, , 0x1000 -ota_0, app, ota_0, , 1M -ota_1, app, ota_1, , 1M +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x4000 +otadata, data, ota, , 0x2000 +phy_init, data, phy, , 0x1000 +ota_0, app, ota_0, , 1M +ota_1, app, ota_1, , 1M ``` - - menuconfig options - - CONFIG_PARTITION_TABLE_CUSTOM=y - - CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" - - CONFIG_HTTPD_WS_SUPPORT=y - - CONFIG_APP_ROLLBACK_ENABLE=y - + - menuconfig parameters + - PARTITION_TABLE_CUSTOM=y + - PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" + - HTTPD_WS_SUPPORT=y + - APP_ROLLBACK_ENABLE=y + - OTA_DEFAULT_URI - OTA web interface address + - OTA_DEFAULT_WS_URI - ws/wss address of the OTA interface + - OTA_CHUNK_SIZE - size of order fragments + - OTA_PRE_ENCRYPTED_MODE - enable PreEncrypted mode + - OTA_PRE_ENCRYPTED_RSA_KEY_LOCATION - rsa_private_key storage location (in the component directory or in the project directory) + - OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY - rsa_private_key storage directory \ No newline at end of file