Good afternoon, colleagues! Please tell me where to find an example of writing a spiffs file *.bin from http.
Thanks!
load spiffs from http
-
ESP_rrtandler
- Posts: 53
- Joined: Wed May 31, 2023 6:54 pm
Re: load spiffs from http
Hello Angorka,
If you are using ESP IDF, there is no combined example matching exactly what you need. But the basic building code blocks for your needs can be used.
As a starting point, you can look into ESP IDF examples folder. Pick and combine examples for filesystem and communication protocol. Example projects for spiffs are in (examples/storage/spiffs) and for HTTP communication protocol, for example esp_http_client, are in (examples/protocols).
If you are using ESP IDF, there is no combined example matching exactly what you need. But the basic building code blocks for your needs can be used.
As a starting point, you can look into ESP IDF examples folder. Pick and combine examples for filesystem and communication protocol. Example projects for spiffs are in (examples/storage/spiffs) and for HTTP communication protocol, for example esp_http_client, are in (examples/protocols).
Re: load spiffs from http
Thank you very much!
Yes, I'm trying to figure out esp_http_client right now.
Using esp_http_client_perform(), it seems to be possible to read the file, but I don't understand where it is being written? Next, I want to use esp_partition_write() to write it to spiffs.
static void http()
{
esp_http_client_config_t config = {
.url = "http://192.168.100.10:8070/spiffs1.bin",
.skip_cert_common_name_check = true;
};
esp_http_client_handle_t client = esp_http_client_init(&config);
esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) {
ESP_LOGI(TAG, "Status = %d, content_length = %d",
esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client));
}
esp_http_client_cleanup(client);
}
Yes, I'm trying to figure out esp_http_client right now.
Using esp_http_client_perform(), it seems to be possible to read the file, but I don't understand where it is being written? Next, I want to use esp_partition_write() to write it to spiffs.
static void http()
{
esp_http_client_config_t config = {
.url = "http://192.168.100.10:8070/spiffs1.bin",
.skip_cert_common_name_check = true;
};
esp_http_client_handle_t client = esp_http_client_init(&config);
esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) {
ESP_LOGI(TAG, "Status = %d, content_length = %d",
esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client));
}
esp_http_client_cleanup(client);
}
Who is online
Users browsing this forum: Baidu [Spider], Bing [Bot] and 3 guests