Sorry if this question for ESP8266Wifi library, but maybe smbd can helps me:
I need to initialise SSID and password when first turn on firmware. I try to read configuration from EEPROM and see nothing - I want to fill SSID & password that time.
As I see this is 'wifi_station_set_config' function in user_interface.h arduinoespressif8266 framework..
It helps to test devices faster. Thanks a lot!
Initialize for real, or to a var, or input?
Begin(ssid,pass) is all you gotta do. There might be a build flag, but I do not recall seeing one.
If you want to write directly to flash , I guess thats an option too but not easy.
Yes, write to flash.
first turn on:
ESP read ssid & password and connect to wifi.
I don"t want to turn on ConfigPortal for write default settings.
That is what begin(ssid,pass) does by default
In my task, I initialise settings and run. So I think that call:
WiFi.begin(VALUE(SSID_NAME), VALUE(SSID_PASS), 0, NULL, false);
beforeWiFi.begin(); is better than WiFi.begin(VALUE(SSID_NAME), VALUE(SSID_PASS));
VALUE macro to convert compile definition variable value to string:
#define VALUE_TO_STRING(x) #x
#define VALUE(x) VALUE_TO_STRING(x)
#define VAR_NAME_VALUE(var) #var "=" VALUE(var)
platfomio.ini piece:
src_build_flags = -D SSID_NAME=wifi-name
-D SSID_PASS=wifi-pass