WiFi Examples: Load SSID & password from a common local.h file instead
of coding into program
This commit is contained in:
parent
1b0124cf05
commit
f0db6f2b98
5 changed files with 22 additions and 10 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -7,3 +7,4 @@ build
|
||||||
firmware
|
firmware
|
||||||
.gdb_history
|
.gdb_history
|
||||||
local.mk
|
local.mk
|
||||||
|
local.h
|
||||||
|
|
|
@ -21,6 +21,12 @@ git clone --recursive https://github.com/Superhouse/esp-open-rtos.git
|
||||||
cd esp-open-rtos
|
cd esp-open-rtos
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* To build any examples that use WiFi, create a file "local.h" in the top-level directory and add two macro defines to it:
|
||||||
|
```c
|
||||||
|
#define WIFI_SSID "mywifissid"
|
||||||
|
#define WIFI_PASS "my secret password"
|
||||||
|
```
|
||||||
|
|
||||||
* Build an example project (found in the 'examples' directory) and flash it to a serial port:
|
* Build an example project (found in the 'examples' directory) and flash it to a serial port:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -194,7 +194,7 @@ SDK_PROCESSED_LIBS = $(addsuffix .a,$(addprefix $(BUILD_DIR)sdklib/lib,$(SDK_LIB
|
||||||
|
|
||||||
# Make rule for preprocessing each SDK library
|
# Make rule for preprocessing each SDK library
|
||||||
#
|
#
|
||||||
$(BUILD_DIR)sdklib/%.a: $(ROOT)lib/%.a $(BUILD_DIR)sdklib/allsymbols.rename
|
$(BUILD_DIR)sdklib/%.a: $(ROOT)lib/%.a $(BUILD_DIR)sdklib/allsymbols.rename $(ROOT)common.mk
|
||||||
$(vecho) "Pre-processing SDK library $< -> $@"
|
$(vecho) "Pre-processing SDK library $< -> $@"
|
||||||
$(Q) $(OBJCOPY) --redefine-syms $(word 2,$^) --weaken $< $@
|
$(Q) $(OBJCOPY) --redefine-syms $(word 2,$^) --weaken $< $@
|
||||||
|
|
||||||
|
@ -219,6 +219,12 @@ $(BUILD_DIR)sdklib/allsymbols.rename: $(patsubst %.a,%.rename,$(SDK_PROCESSED_LI
|
||||||
PROGRAM_SRC_DIR ?= $(PROGRAM_DIR)
|
PROGRAM_SRC_DIR ?= $(PROGRAM_DIR)
|
||||||
PROGRAM_ROOT ?= $(PROGRAM_DIR)
|
PROGRAM_ROOT ?= $(PROGRAM_DIR)
|
||||||
PROGRAM_MAKEFILE = $(firstword $(MAKEFILE_LIST))
|
PROGRAM_MAKEFILE = $(firstword $(MAKEFILE_LIST))
|
||||||
|
# if there's a local.h file in either the program dir or the
|
||||||
|
# root dir, load macros from it (for WIFI_SSID,WIFI_PASS, etc.)
|
||||||
|
PROGRAM_LOCAL_H = $(lastword $(wildcard $(ROOT)local.h $(PROGRAM_DIR)local.h))
|
||||||
|
ifneq ($(PROGRAM_LOCAL_H),)
|
||||||
|
PROGRAM_CFLAGS = $(CFLAGS) -imacros $(PROGRAM_LOCAL_H)
|
||||||
|
endif
|
||||||
$(eval $(call component_compile_rules,PROGRAM))
|
$(eval $(call component_compile_rules,PROGRAM))
|
||||||
|
|
||||||
## Include other components (this is where the actual compiler sections are generated)
|
## Include other components (this is where the actual compiler sections are generated)
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
#define WEB_PORT 80
|
#define WEB_PORT 80
|
||||||
#define WEB_URL "http://chainxor.org/"
|
#define WEB_URL "http://chainxor.org/"
|
||||||
|
|
||||||
/* FILL THESE IN!!!!!!!!!! */
|
#if !defined(WIFI_SSID) || !defined(WIFI_PASS)
|
||||||
#define WIFI_SSID "SSID Name Here"
|
#error "Please define macros WIFI_SSID & WIFI_PASS (here, or better in a local.h file at root level or in program dir."
|
||||||
#define WIFI_PASS "Wifi Password Here"
|
#endif
|
||||||
|
|
||||||
void http_get_task(void *pvParameters)
|
void http_get_task(void *pvParameters)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,14 +20,13 @@
|
||||||
|
|
||||||
#include "ssl.h"
|
#include "ssl.h"
|
||||||
|
|
||||||
|
#define WEB_SERVER "192.168.0.18"
|
||||||
#define WEB_SERVER "10.10.10.1"
|
|
||||||
#define WEB_PORT "8000"
|
#define WEB_PORT "8000"
|
||||||
#define WEB_URL "https://chainxor.org/"
|
#define WEB_URL "/test"
|
||||||
|
|
||||||
/* FILL THESE IN!!!!!!!!!! */
|
#if !defined(WIFI_SSID) || !defined(WIFI_PASS)
|
||||||
#define WIFI_SSID "esptest"
|
#error "Please define macros WIFI_SSID & WIFI_PASS (here, or better in a local.h file at root level or in program dir."
|
||||||
#define WIFI_PASS "secret passphrase"
|
#endif
|
||||||
|
|
||||||
static void display_cipher(SSL *ssl);
|
static void display_cipher(SSL *ssl);
|
||||||
static void display_session_id(SSL *ssl);
|
static void display_session_id(SSL *ssl);
|
||||||
|
|
Loading…
Reference in a new issue