Thanks....I'm on testing both Impementations.
a) the original Arduino
and
b) Earle F. Philhower's
both are using WiFiNINA Lib.
My Question was about the non-dokumentet implemantation of the FS on the ESP32.
There is a WiFiNINA-Exemple "WifiStorage" that use those functions.
Is there any official docu, or have we to analyse the
Arduino NINA-W102 firmware
As we know that, since years, about the FS on ESP's
#define CONFIG_LEN 120
union conf
{
char buf[CONFIG_LEN];
struct {
uint8_t valid; // 0=no configuration, 1=valid configuration
char ee_SSID[20]; // SSID of WiFi
char ee_password[20]; // Password of WiFi
uint8_t ee_ip[4]; // fixe ip adr der Station und damit des Websocket-Servers
uint8_t ee_gatewayByte4; // 4ter teil der Gateway adr. Die ersten drei sind wie bei der ee_ip
char ende[10]; // test
};
};
conf cfg;
bool ini_eeprom(void){
//---------------------
// #define CONFIG_LEN 120 siehe config2.h
uint8_t config_ok =0;
if (WiFi.status() == WL_NO_SHIELD) {
HsPrintln("WiFi shield not present");
return false;
}
WiFiStorageFile cfg_file = WiFiStorage.open("/fs/config");
if (cfg_file) {
cfg_file.seek(0);
int ret = cfg_file.read(cfg.buf, CONFIG_LEN);
cfg_file.close();
// damit ist die struct cfg.xxx geladen !!!
// offenhs temp einlesen, prüfen und erst dann setzen
if (ret < CONFIG_LEN || cfg.valid != 1){
//HsPrintln("Config ev. nicht umfassend!");
}else{
config_ok = 1;
}
}else{
//HsPrintln("Config ev. nicht umfassend!");
}
if (!config_ok) HsPrintln("Config ev. nicht umfassend!");
check_config(); // prüfen und sicherheits halber min max setzen.
return true;
}
bool saveConfig(void) {
//-------------------------------
WiFiStorageFile cfg_file = WiFiStorage.open("/fs/config");
if (! cfg_file) return false;
cfg_file.erase();
cfg_file.seek(0);
cfg_file.write(cfg.buf, CONFIG_LEN);
cfg_file.close();
return true;
}