diff --git a/Makefile b/Makefile index 709a0a1..e7f34fa 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,10 @@ ESPTOOL ?= $(abspath ../esp-open-sdk/esptool/esptool.py) ESPPORT ?= /dev/ttyUSB0 ESPBAUD ?= 460800 +# Build time Wifi Cfg +# STA_SSID ?= +# STA_PASS ?= + # --------------- chipset configuration --------------- # Pick your flash size: "512KB", "1MB", or "4MB" @@ -212,6 +216,14 @@ Q := @ vecho := @echo endif +ifneq ($(strip $(STA_SSID)),) +CFLAGS+= -DSTA_SSID="$(STA_SSID)" +endif + +ifneq ($(strip $(STA_PASS)),) +CFLAGS+= -DSTA_PASS="$(STA_PASS)" +endif + ifeq ("$(GZIP_COMPRESSION)","yes") CFLAGS += -DGZIP_COMPRESSION endif diff --git a/include/espmissingincludes.h b/include/espmissingincludes.h index c69b9fc..86128ff 100644 --- a/include/espmissingincludes.h +++ b/include/espmissingincludes.h @@ -37,6 +37,12 @@ void ets_timer_setfn(ETSTimer *t, ETSTimerFunc *fn, void *parg); void ets_update_cpu_frequency(int freqmhz); +#ifdef SDK_DBG +#define DEBUG_SDK true +#else +#define DEBUG_SDK false +#endif + int os_printf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); int os_snprintf(char *str, size_t size, const char *format, ...) __attribute__ ((format (printf, 3, 4))); int os_printf_plus(const char *format, ...) __attribute__ ((format (printf, 1, 2))); diff --git a/user/user_main.c b/user/user_main.c index f454c17..a52c971 100644 --- a/user/user_main.c +++ b/user/user_main.c @@ -105,6 +105,14 @@ static void ICACHE_FLASH_ATTR prHeapTimerCb(void *arg) { #endif void user_rf_pre_init(void) { + system_set_os_print(DEBUG_SDK); +#if defined(STA_SSID) && defined(STA_PASS) + struct station_config stconf; + os_strncpy((char*)stconf.ssid, VERS_STR(STA_SSID), 32); + os_strncpy((char*)stconf.password, VERS_STR(STA_PASS), 64); + stconf.bssid_set = 0; + wifi_station_set_config_current(&stconf); +#endif } // address of espfs binary blob