From cb80d665c1ccf568d19b56a14d89c3bc2cb70b10 Mon Sep 17 00:00:00 2001 From: KisChang <734615869@qq.com> Date: Fri, 31 Mar 2023 15:01:28 +0800 Subject: [PATCH 1/2] add CMake variables BOOTLOADER_ENTRY_PIN --- CMakeLists.txt | 5 +++++ README.md | 1 + main.c | 3 +++ 3 files changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index eb3fd0a..d0aae6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,6 +107,11 @@ if (PICOWOTA_WIFI_AP) message("Building in WiFi AP mode.") endif() +if (BOOTLOADER_ENTRY_PIN) + target_compile_definitions(picowota PUBLIC BOOTLOADER_ENTRY_PIN=${BOOTLOADER_ENTRY_PIN}) + message("Building with BOOTLOADER_ENTRY_PIN.") +endif() + # Provide a helper to build a standalone target function(picowota_build_standalone NAME) get_target_property(PICOWOTA_SRC_DIR picowota SOURCE_DIR) diff --git a/README.md b/README.md index 559aab9..bcb342d 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ as CMake variables: PICOWOTA_WIFI_SSID # The WiFi network SSID PICOWOTA_WIFI_PASS # The WiFi network password PICOWOTA_WIFI_AP # Optional; 0 = connect to the network, 1 = create it +BOOTLOADER_ENTRY_PIN # Optional; default use pin 15, you can change it ``` Then, you can either build just your standalone app binary (suitable for diff --git a/main.c b/main.c index 80b892e..4f1b01d 100644 --- a/main.c +++ b/main.c @@ -83,7 +83,10 @@ struct event { }; }; +#ifndef BOOTLOADER_ENTRY_PIN +#warning "BOOTLOADER_ENTRY_PIN not defined" #define BOOTLOADER_ENTRY_PIN 15 +#endif #define TCP_PORT 4242 From 4b765a7b30fce3859a3d2f099f6f62a34531e0b9 Mon Sep 17 00:00:00 2001 From: KisChang <734615869@qq.com> Date: Mon, 3 Apr 2023 10:33:43 +0800 Subject: [PATCH 2/2] change BOOTLOADER_ENTRY_PIN to PICOWOTA_ENTRY_PIN --- CMakeLists.txt | 7 ++++--- README.md | 2 +- main.c | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d0aae6f..bd99a46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,6 +89,7 @@ endfunction() picowota_retrieve_variable(PICOWOTA_WIFI_SSID false) picowota_retrieve_variable(PICOWOTA_WIFI_PASS true) picowota_retrieve_variable(PICOWOTA_WIFI_AP false) +picowota_retrieve_variable(PICOWOTA_ENTRY_PIN false) if ((NOT PICOWOTA_WIFI_SSID) OR (NOT PICOWOTA_WIFI_PASS)) message(FATAL_ERROR @@ -107,9 +108,9 @@ if (PICOWOTA_WIFI_AP) message("Building in WiFi AP mode.") endif() -if (BOOTLOADER_ENTRY_PIN) - target_compile_definitions(picowota PUBLIC BOOTLOADER_ENTRY_PIN=${BOOTLOADER_ENTRY_PIN}) - message("Building with BOOTLOADER_ENTRY_PIN.") +if (PICOWOTA_ENTRY_PIN) + target_compile_definitions(picowota PUBLIC PICOWOTA_ENTRY_PIN=${PICOWOTA_ENTRY_PIN}) + message("Building with custom PICOWOTA_ENTRY_PIN.") endif() # Provide a helper to build a standalone target diff --git a/README.md b/README.md index bcb342d..9c9ce57 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ as CMake variables: PICOWOTA_WIFI_SSID # The WiFi network SSID PICOWOTA_WIFI_PASS # The WiFi network password PICOWOTA_WIFI_AP # Optional; 0 = connect to the network, 1 = create it -BOOTLOADER_ENTRY_PIN # Optional; default use pin 15, you can change it +PICOWOTA_ENTRY_PIN # Optional; default use pin 15, you can change it ``` Then, you can either build just your standalone app binary (suitable for diff --git a/main.c b/main.c index 4f1b01d..f558ebc 100644 --- a/main.c +++ b/main.c @@ -83,9 +83,10 @@ struct event { }; }; -#ifndef BOOTLOADER_ENTRY_PIN -#warning "BOOTLOADER_ENTRY_PIN not defined" +#ifndef PICOWOTA_ENTRY_PIN #define BOOTLOADER_ENTRY_PIN 15 +#else +#define BOOTLOADER_ENTRY_PIN PICOWOTA_ENTRY_PIN #endif #define TCP_PORT 4242