From 58b9932ec3b96ee89e1c202a093357d4a60c5541 Mon Sep 17 00:00:00 2001 From: David Kozub Date: Thu, 3 Oct 2019 21:17:45 +0200 Subject: [PATCH 1/4] extras/wificfg: make sure wificfg.h #includes all necessary files Without these, wificfg.h can fail to compile because types like uint32_t, size_t or ssize_t are not available. --- extras/wificfg/wificfg.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extras/wificfg/wificfg.h b/extras/wificfg/wificfg.h index 3461c7a..b823369 100644 --- a/extras/wificfg/wificfg.h +++ b/extras/wificfg/wificfg.h @@ -26,6 +26,10 @@ extern "C" { #endif +#include +#include +#include + /* * Printf format used to initialize a default AP ssid. It is passed the last * three bytes of the mac address. This may be NULL to not default the ssid, From 5f6ccbd1bedb067cc7e029cfd7d39eb49708a68f Mon Sep 17 00:00:00 2001 From: David Kozub Date: Thu, 3 Oct 2019 21:20:23 +0200 Subject: [PATCH 2/4] extras/wificfg: use #if when checking for configUSE_TRACE_FACILITY FreeRTOS/Source/include/FreeRTOSConfig.h makes sure configUSE_TRACE_FACILITY is always defined. But it's defined to 0 when TRACE_FACILITY is disabled. When #ifdef is used, the guarded blocks of code are always compiled and this results in link failure when TRACE_FACILITY is in fact not enabled. --- extras/wificfg/wificfg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/wificfg/wificfg.c b/extras/wificfg/wificfg.c index 1e4c5d2..fe04e9f 100644 --- a/extras/wificfg/wificfg.c +++ b/extras/wificfg/wificfg.c @@ -1540,7 +1540,7 @@ static int handle_wificfg_challenge_post(int s, wificfg_method method, return wificfg_write_string(s, http_redirect_header); } -#ifdef configUSE_TRACE_FACILITY +#if configUSE_TRACE_FACILITY static const char *http_tasks_content[] = { #include "content/tasks.html" }; @@ -1638,7 +1638,7 @@ static const wificfg_dispatch wificfg_dispatch_list[] = { {"/challenge.html", HTTP_METHOD_POST, handle_wificfg_challenge_post, false}, {"/wificfg/restart.html", HTTP_METHOD_POST, handle_restart_post, true}, {"/wificfg/erase.html", HTTP_METHOD_POST, handle_erase_post, true}, -#ifdef configUSE_TRACE_FACILITY +#if configUSE_TRACE_FACILITY {"/tasks", HTTP_METHOD_GET, handle_tasks, false}, {"/tasks.html", HTTP_METHOD_GET, handle_tasks, false}, #endif /* configUSE_TRACE_FACILITY */ From 77b2b2306f23a773c4d9fdf1afc169b8add0faf2 Mon Sep 17 00:00:00 2001 From: David Kozub Date: Thu, 3 Oct 2019 21:23:17 +0200 Subject: [PATCH 3/4] extras/wificfg: make the default wifi options overridable wificfg.c defines the default values for ssid, password and hostname. But because these are not weak, trying to redefine these causes a link error. This change marks the definitions in wificfg.c weak, thus making it possible for a program using the wificfg component to redefine these w/o having to touch wificfg.c. --- extras/wificfg/wificfg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/wificfg/wificfg.c b/extras/wificfg/wificfg.c index fe04e9f..5a5c9c9 100644 --- a/extras/wificfg/wificfg.c +++ b/extras/wificfg/wificfg.c @@ -54,9 +54,9 @@ #endif -const char *wificfg_default_ssid = "EOR_%02X%02X%02X"; -const char *wificfg_default_password = "esp-open-rtos"; -const char *wificfg_default_hostname = "eor-%02x%02x%02x"; +const char *wificfg_default_ssid __attribute__ ((weak)) = "EOR_%02X%02X%02X"; +const char *wificfg_default_password __attribute__ ((weak)) = "esp-open-rtos"; +const char *wificfg_default_hostname __attribute__ ((weak)) = "eor-%02x%02x%02x"; /* The http task stack allocates a single buffer to do much of it's work. */ #define HTTP_BUFFER_SIZE 54 From a4defa37a4209a0871d1d458928a7d9b340d5ffd Mon Sep 17 00:00:00 2001 From: David Kozub Date: Thu, 3 Oct 2019 21:23:44 +0200 Subject: [PATCH 4/4] extras/wificfg: fix a typo in comment --- extras/wificfg/wificfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/wificfg/wificfg.c b/extras/wificfg/wificfg.c index 5a5c9c9..1fb8e57 100644 --- a/extras/wificfg/wificfg.c +++ b/extras/wificfg/wificfg.c @@ -58,7 +58,7 @@ const char *wificfg_default_ssid __attribute__ ((weak)) = "EOR_%02X%02X%02X"; const char *wificfg_default_password __attribute__ ((weak)) = "esp-open-rtos"; const char *wificfg_default_hostname __attribute__ ((weak)) = "eor-%02x%02x%02x"; -/* The http task stack allocates a single buffer to do much of it's work. */ +/* The http task stack allocates a single buffer to do much of its work. */ #define HTTP_BUFFER_SIZE 54 /*