Backport buildtime wifi config ability to v1.0

pull/56/head
Ivan Susanin 9 years ago
parent d7f519fff0
commit 04082a1661
  1. 12
      Makefile
  2. 6
      include/espmissingincludes.h
  3. 8
      user/user_main.c

@ -27,6 +27,10 @@ ESPTOOL ?= $(abspath ../esp-open-sdk/esptool/esptool.py)
ESPPORT ?= /dev/ttyUSB0 ESPPORT ?= /dev/ttyUSB0
ESPBAUD ?= 460800 ESPBAUD ?= 460800
# Build time Wifi Cfg
# STA_SSID ?=
# STA_PASS ?=
# --------------- chipset configuration --------------- # --------------- chipset configuration ---------------
# Pick your flash size: "512KB", "1MB", or "4MB" # Pick your flash size: "512KB", "1MB", or "4MB"
@ -212,6 +216,14 @@ Q := @
vecho := @echo vecho := @echo
endif 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") ifeq ("$(GZIP_COMPRESSION)","yes")
CFLAGS += -DGZIP_COMPRESSION CFLAGS += -DGZIP_COMPRESSION
endif endif

@ -37,6 +37,12 @@ void ets_timer_setfn(ETSTimer *t, ETSTimerFunc *fn, void *parg);
void ets_update_cpu_frequency(int freqmhz); 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_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_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))); int os_printf_plus(const char *format, ...) __attribute__ ((format (printf, 1, 2)));

@ -105,6 +105,14 @@ static void ICACHE_FLASH_ATTR prHeapTimerCb(void *arg) {
#endif #endif
void user_rf_pre_init(void) { 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 // address of espfs binary blob

Loading…
Cancel
Save