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),
|
||||
SimpleHTTPServer.SimpleHTTPRequestHandler)
|
||||
|
||||
print "server cert path: " + server_file
|
||||
print "key file path: " + key_file
|
||||
httpd.socket = ssl.wrap_socket(httpd.socket,
|
||||
keyfile=key_file,
|
||||
certfile=server_file, server_side=True)
|
||||
print "serving OTA image at: " + server_ip + "port: " + "port"
|
||||
httpd.serve_forever()
|
||||
|
||||
|
||||
@ -126,7 +123,7 @@ def test_examples_protocol_simple_ota_example(env, extra_data):
|
||||
IDF.check_performance("simple_ota_bin_size", bin_size // 1024)
|
||||
# start test
|
||||
host_ip = get_my_ip()
|
||||
thread1 = Thread(target=start_https_server, args=(dut1.app.binary_path,host_ip,8000))
|
||||
thread1 = Thread(target=start_https_server, args=(dut1.app.binary_path, host_ip, 8000))
|
||||
thread1.daemon = True
|
||||
thread1.start()
|
||||
dut1.start_app()
|
||||
|
@ -21,7 +21,7 @@ menu "Example Configuration"
|
||||
|
||||
config EXAMPLE_FIRMWARE_UPGRADE_URL_FROM_STDIN
|
||||
bool
|
||||
default y if FIRMWARE_UPGRADE_URL = "FROM_STDIN"
|
||||
default y if EXAMPLE_FIRMWARE_UPGRADE_URL = "FROM_STDIN"
|
||||
|
||||
config EXAMPLE_SKIP_COMMON_NAME_CHECK
|
||||
bool "Skip server certificate CN fieldcheck"
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "nvs_flash.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 "driver/uart.h"
|
||||
#endif
|
||||
@ -41,8 +41,7 @@ const int CONNECTED_BIT = BIT0;
|
||||
|
||||
#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)
|
||||
{
|
||||
// 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_http_client_config_t config = {
|
||||
.url = CONFIG_FIRMWARE_UPGRADE_URL,
|
||||
.url = CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL,
|
||||
.cert_pem = (char *)server_cert_pem_start,
|
||||
.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];
|
||||
if (strcmp(config.url, "FROM_STDIN") == 0) {
|
||||
example_configure_stdin_stdout();
|
||||
@ -158,7 +157,7 @@ void simple_ota_example_task(void * pvParameter)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SKIP_COMMON_NAME_CHECK
|
||||
#ifdef CONFIG_EXAMPLE_SKIP_COMMON_NAME_CHECK
|
||||
config.skip_cert_common_name_check = true;
|
||||
#endif
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
CONFIG_FIRMWARE_UPGRADE_URL="FROM_STDIN"
|
||||
CONFIG_SKIP_COMMON_NAME_CHECK=y
|
||||
CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL="FROM_STDIN"
|
||||
CONFIG_EXAMPLE_SKIP_COMMON_NAME_CHECK=y
|
||||
|
Loading…
Reference in New Issue
Block a user