mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
example/simple_ota_example: Fix python formatting and KConfig
This commit is contained in:
parent
156ffa412e
commit
53e295a616
@ -101,12 +101,9 @@ def start_https_server(ota_image_dir, server_ip, server_port):
|
|||||||
httpd = BaseHTTPServer.HTTPServer((server_ip, server_port),
|
httpd = BaseHTTPServer.HTTPServer((server_ip, server_port),
|
||||||
SimpleHTTPServer.SimpleHTTPRequestHandler)
|
SimpleHTTPServer.SimpleHTTPRequestHandler)
|
||||||
|
|
||||||
print "server cert path: " + server_file
|
|
||||||
print "key file path: " + key_file
|
|
||||||
httpd.socket = ssl.wrap_socket(httpd.socket,
|
httpd.socket = ssl.wrap_socket(httpd.socket,
|
||||||
keyfile=key_file,
|
keyfile=key_file,
|
||||||
certfile=server_file, server_side=True)
|
certfile=server_file, server_side=True)
|
||||||
print "serving OTA image at: " + server_ip + "port: " + "port"
|
|
||||||
httpd.serve_forever()
|
httpd.serve_forever()
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ menu "Example Configuration"
|
|||||||
|
|
||||||
config EXAMPLE_FIRMWARE_UPGRADE_URL_FROM_STDIN
|
config EXAMPLE_FIRMWARE_UPGRADE_URL_FROM_STDIN
|
||||||
bool
|
bool
|
||||||
default y if FIRMWARE_UPGRADE_URL = "FROM_STDIN"
|
default y if EXAMPLE_FIRMWARE_UPGRADE_URL = "FROM_STDIN"
|
||||||
|
|
||||||
config EXAMPLE_SKIP_COMMON_NAME_CHECK
|
config EXAMPLE_SKIP_COMMON_NAME_CHECK
|
||||||
bool "Skip server certificate CN fieldcheck"
|
bool "Skip server certificate CN fieldcheck"
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
|
||||||
#ifdef CONFIG_FIRMWARE_UPGRADE_URL_FROM_STDIN
|
#ifdef CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL_FROM_STDIN
|
||||||
#include "esp_vfs_dev.h"
|
#include "esp_vfs_dev.h"
|
||||||
#include "driver/uart.h"
|
#include "driver/uart.h"
|
||||||
#endif
|
#endif
|
||||||
@ -41,8 +41,7 @@ const int CONNECTED_BIT = BIT0;
|
|||||||
|
|
||||||
#define OTA_URL_SIZE 256
|
#define OTA_URL_SIZE 256
|
||||||
|
|
||||||
#ifdef CONFIG_FIRMWARE_UPGRADE_URL_FROM_STDIN
|
#ifdef CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL_FROM_STDIN
|
||||||
|
|
||||||
static esp_err_t example_configure_stdin_stdout(void)
|
static esp_err_t example_configure_stdin_stdout(void)
|
||||||
{
|
{
|
||||||
// Initialize VFS & UART so we can use std::cout/cin
|
// Initialize VFS & UART so we can use std::cout/cin
|
||||||
@ -139,12 +138,12 @@ void simple_ota_example_task(void * pvParameter)
|
|||||||
ESP_LOGI(TAG, "Connected to WiFi network! Attempting to connect to server...");
|
ESP_LOGI(TAG, "Connected to WiFi network! Attempting to connect to server...");
|
||||||
|
|
||||||
esp_http_client_config_t config = {
|
esp_http_client_config_t config = {
|
||||||
.url = CONFIG_FIRMWARE_UPGRADE_URL,
|
.url = CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL,
|
||||||
.cert_pem = (char *)server_cert_pem_start,
|
.cert_pem = (char *)server_cert_pem_start,
|
||||||
.event_handler = _http_event_handler,
|
.event_handler = _http_event_handler,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_FIRMWARE_UPGRADE_URL_FROM_STDIN
|
#ifdef CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL_FROM_STDIN
|
||||||
char url_buf[OTA_URL_SIZE];
|
char url_buf[OTA_URL_SIZE];
|
||||||
if (strcmp(config.url, "FROM_STDIN") == 0) {
|
if (strcmp(config.url, "FROM_STDIN") == 0) {
|
||||||
example_configure_stdin_stdout();
|
example_configure_stdin_stdout();
|
||||||
@ -158,7 +157,7 @@ void simple_ota_example_task(void * pvParameter)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SKIP_COMMON_NAME_CHECK
|
#ifdef CONFIG_EXAMPLE_SKIP_COMMON_NAME_CHECK
|
||||||
config.skip_cert_common_name_check = true;
|
config.skip_cert_common_name_check = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
CONFIG_FIRMWARE_UPGRADE_URL="FROM_STDIN"
|
CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL="FROM_STDIN"
|
||||||
CONFIG_SKIP_COMMON_NAME_CHECK=y
|
CONFIG_EXAMPLE_SKIP_COMMON_NAME_CHECK=y
|
||||||
|
Loading…
Reference in New Issue
Block a user