Here are two tutorials that use the SPIFFS file system:
https://randomnerdtutorials.com/esp32-w ... ile-system
https://microcontrollerslab.com/esp32-w ... tem-spiffs
Although, it seems like a WiFi network is required. Is there a way to use SPIFFS and an ESP as an access point (AP)?
https://randomnerdtutorials.com/esp32-a ... eb-server/
This problem stems with seemingly being limited on how many base64 images can be used: https://forum.arduino.cc/t/why-is-an-es ... ges/925861
Does the SPIFFS file system require a WiFi network, or can it be used with an ESP access point?
Re: Does the SPIFFS file system require a WiFi network, or can it be used with an ESP access point?
yes,it can work in AP mode.
like this:
#define CONFIG_AP_SSID "husky"
#define CONFIG_AP_PASSWORD "12345678" //配置AP的SSID 和password
esp_err_t esp32_create_ap(void) {
uint8_t ApMac[6];
tcpip_adapter_init();
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); //定义一个名为cfg的wifi_init_config_t结构体。wifi_init_config_t中的参数可由menuconfig配置
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_RAM)); //指示ESP32将这些设置记录到闪存
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_AP)); //模式设置为AP
esp_wifi_get_mac(ESP_IF_WIFI_AP, ApMac); //获取DHCP分配的IP接口的mac。
wifi_config_t ap_config = {
.ap = {
// .ssid = ssid,
.password = CONFIG_AP_PASSWORD,
.ssid_len = 0,
.max_connection = 4,
.authmode = WIFI_AUTH_WPA_PSK}}; // ap接入点参数配置。
sprintf((char*)ap_config.ap.ssid, "%s_%02X%02X", CONFIG_AP_SSID, ApMac[4], ApMac[5]);
esp_err_t err = esp_wifi_set_config(WIFI_IF_AP, &ap_config);
ESP_ERROR_CHECK(esp_wifi_start());
esp_wifi_connect();
return err;
}
Use a mobile phone to connect to your AP , try it.
like this:
#define CONFIG_AP_SSID "husky"
#define CONFIG_AP_PASSWORD "12345678" //配置AP的SSID 和password
esp_err_t esp32_create_ap(void) {
uint8_t ApMac[6];
tcpip_adapter_init();
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); //定义一个名为cfg的wifi_init_config_t结构体。wifi_init_config_t中的参数可由menuconfig配置
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_RAM)); //指示ESP32将这些设置记录到闪存
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_AP)); //模式设置为AP
esp_wifi_get_mac(ESP_IF_WIFI_AP, ApMac); //获取DHCP分配的IP接口的mac。
wifi_config_t ap_config = {
.ap = {
// .ssid = ssid,
.password = CONFIG_AP_PASSWORD,
.ssid_len = 0,
.max_connection = 4,
.authmode = WIFI_AUTH_WPA_PSK}}; // ap接入点参数配置。
sprintf((char*)ap_config.ap.ssid, "%s_%02X%02X", CONFIG_AP_SSID, ApMac[4], ApMac[5]);
esp_err_t err = esp_wifi_set_config(WIFI_IF_AP, &ap_config);
ESP_ERROR_CHECK(esp_wifi_start());
esp_wifi_connect();
return err;
}
Use a mobile phone to connect to your AP , try it.
Who is online
Users browsing this forum: Google [Bot] and 68 guests