From 53e295a616f1c3984445ea6a42e16ee7b39c3063 Mon Sep 17 00:00:00 2001 From: Jitin George Date: Thu, 20 Jun 2019 15:48:20 +0530 Subject: [PATCH] example/simple_ota_example: Fix python formatting and KConfig --- .../system/ota/simple_ota_example/example_test.py | 5 +---- .../ota/simple_ota_example/main/Kconfig.projbuild | 2 +- .../ota/simple_ota_example/main/simple_ota_example.c | 11 +++++------ examples/system/ota/simple_ota_example/sdkconfig.ci | 4 ++-- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/examples/system/ota/simple_ota_example/example_test.py b/examples/system/ota/simple_ota_example/example_test.py index 736c611d5..7c732a542 100644 --- a/examples/system/ota/simple_ota_example/example_test.py +++ b/examples/system/ota/simple_ota_example/example_test.py @@ -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() diff --git a/examples/system/ota/simple_ota_example/main/Kconfig.projbuild b/examples/system/ota/simple_ota_example/main/Kconfig.projbuild index 0f19b04ac..c3edc5365 100644 --- a/examples/system/ota/simple_ota_example/main/Kconfig.projbuild +++ b/examples/system/ota/simple_ota_example/main/Kconfig.projbuild @@ -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" diff --git a/examples/system/ota/simple_ota_example/main/simple_ota_example.c b/examples/system/ota/simple_ota_example/main/simple_ota_example.c index 666c5ed3b..139e83747 100644 --- a/examples/system/ota/simple_ota_example/main/simple_ota_example.c +++ b/examples/system/ota/simple_ota_example/main/simple_ota_example.c @@ -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 diff --git a/examples/system/ota/simple_ota_example/sdkconfig.ci b/examples/system/ota/simple_ota_example/sdkconfig.ci index 6d493cbf1..8367dac01 100644 --- a/examples/system/ota/simple_ota_example/sdkconfig.ci +++ b/examples/system/ota/simple_ota_example/sdkconfig.ci @@ -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