mirror of
https://github.com/ok-home/ota_ws_update.git
synced 2025-11-13 22:03:27 +03:00
reorder to ota_ws_update
This commit is contained in:
12
example_ota_ws/CMakeLists.txt
Normal file
12
example_ota_ws/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
# The following lines of boilerplate have to be in your project's CMakeLists
|
||||
# in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
# (Not part of the boilerplate)
|
||||
# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection.
|
||||
#set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
|
||||
|
||||
set(EXTRA_COMPONENT_DIRS ../)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(example_ota_ws_update)
|
||||
12
example_ota_ws/main/CMakeLists.txt
Normal file
12
example_ota_ws/main/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
# Embed the server root certificate into the final binary
|
||||
|
||||
idf_component_register(
|
||||
SRCS
|
||||
example_ota_ws_update.c
|
||||
REQUIRES
|
||||
ota_ws_update
|
||||
prv_Wifi_Connect
|
||||
esp_http_server
|
||||
mdns
|
||||
esp_wifi
|
||||
)
|
||||
57
example_ota_ws/main/example_ota_ws_update.c
Normal file
57
example_ota_ws/main/example_ota_ws_update.c
Normal file
@@ -0,0 +1,57 @@
|
||||
/* OTA example
|
||||
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_system.h"
|
||||
#include "esp_event.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_ota_ops.h"
|
||||
#include "esp_wifi.h"
|
||||
|
||||
// #include <esp_log.h>
|
||||
|
||||
#include "prv_wifi_connect.h"
|
||||
#include "ota_ws_update.h"
|
||||
|
||||
//static const char *TAG = "ota_ws";
|
||||
|
||||
#define MDNS
|
||||
#ifdef MDNS
|
||||
#define HOST_NAME "esp-ota"
|
||||
#include "mdns.h"
|
||||
#include "lwip/apps/netbiosns.h"
|
||||
#endif // MDNS
|
||||
#ifdef MDNS
|
||||
static void initialise_mdns(void)
|
||||
{
|
||||
mdns_init();
|
||||
mdns_hostname_set(HOST_NAME);
|
||||
mdns_instance_name_set("esp home web server");
|
||||
|
||||
mdns_txt_item_t serviceTxtData[] = {
|
||||
{"board", "esp32"},
|
||||
{"path", "/"}};
|
||||
|
||||
ESP_ERROR_CHECK(mdns_service_add("ESP32-WebServer", "_http", "_tcp", 80, serviceTxtData,
|
||||
sizeof(serviceTxtData) / sizeof(serviceTxtData[0])));
|
||||
netbiosns_init();
|
||||
netbiosns_set_name(HOST_NAME);
|
||||
}
|
||||
#endif // MDNS
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
prv_wifi_connect(); // return with error ?
|
||||
|
||||
#ifdef MDNS
|
||||
initialise_mdns();
|
||||
#endif // MDNS
|
||||
|
||||
prv_start_http_server(PRV_MODE_STAY_ACTIVE, ota_ws_register_uri_handler); // run server
|
||||
}
|
||||
6
example_ota_ws/partitions.csv
Normal file
6
example_ota_ws/partitions.csv
Normal file
@@ -0,0 +1,6 @@
|
||||
# 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
|
||||
|
Reference in New Issue
Block a user