mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 12:14:32 +02:00
Merge branch 'bugfix/sdcard_example_format_timeout' into 'release/v4.3'
CI: [Examples/Storage] provide sufficient timeout for SD card formatting See merge request espressif/esp-idf!14883
This commit is contained in:
@@ -84,7 +84,7 @@ void app_main(void)
|
|||||||
.max_files = 5,
|
.max_files = 5,
|
||||||
.allocation_unit_size = 16 * 1024
|
.allocation_unit_size = 16 * 1024
|
||||||
};
|
};
|
||||||
sdmmc_card_t* card;
|
sdmmc_card_t *card;
|
||||||
const char mount_point[] = MOUNT_POINT;
|
const char mount_point[] = MOUNT_POINT;
|
||||||
ESP_LOGI(TAG, "Initializing SD card");
|
ESP_LOGI(TAG, "Initializing SD card");
|
||||||
|
|
||||||
@@ -112,6 +112,7 @@ void app_main(void)
|
|||||||
gpio_set_pull_mode(12, GPIO_PULLUP_ONLY); // D2, needed in 4-line mode only
|
gpio_set_pull_mode(12, GPIO_PULLUP_ONLY); // D2, needed in 4-line mode only
|
||||||
gpio_set_pull_mode(13, GPIO_PULLUP_ONLY); // D3, needed in 4- and 1-line modes
|
gpio_set_pull_mode(13, GPIO_PULLUP_ONLY); // D3, needed in 4- and 1-line modes
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "Mounting filesystem");
|
||||||
ret = esp_vfs_fat_sdmmc_mount(mount_point, &host, &slot_config, &mount_config, &card);
|
ret = esp_vfs_fat_sdmmc_mount(mount_point, &host, &slot_config, &mount_config, &card);
|
||||||
#else
|
#else
|
||||||
ESP_LOGI(TAG, "Using SPI peripheral");
|
ESP_LOGI(TAG, "Using SPI peripheral");
|
||||||
@@ -150,6 +151,7 @@ void app_main(void)
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ESP_LOGI(TAG, "Filesystem mounted");
|
||||||
|
|
||||||
// Card has been initialized, print its properties
|
// Card has been initialized, print its properties
|
||||||
sdmmc_card_print_info(stdout, card);
|
sdmmc_card_print_info(stdout, card);
|
||||||
@@ -157,7 +159,7 @@ void app_main(void)
|
|||||||
// Use POSIX and C standard library functions to work with files.
|
// Use POSIX and C standard library functions to work with files.
|
||||||
// First create a file.
|
// First create a file.
|
||||||
ESP_LOGI(TAG, "Opening file");
|
ESP_LOGI(TAG, "Opening file");
|
||||||
FILE* f = fopen(MOUNT_POINT"/hello.txt", "w");
|
FILE *f = fopen(MOUNT_POINT"/hello.txt", "w");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
ESP_LOGE(TAG, "Failed to open file for writing");
|
ESP_LOGE(TAG, "Failed to open file for writing");
|
||||||
return;
|
return;
|
||||||
@@ -191,7 +193,7 @@ void app_main(void)
|
|||||||
fgets(line, sizeof(line), f);
|
fgets(line, sizeof(line), f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
// strip newline
|
// strip newline
|
||||||
char* pos = strchr(line, '\n');
|
char *pos = strchr(line, '\n');
|
||||||
if (pos) {
|
if (pos) {
|
||||||
*pos = '\0';
|
*pos = '\0';
|
||||||
}
|
}
|
||||||
|
@@ -14,6 +14,9 @@ def test_examples_sd_card(env, extra_data):
|
|||||||
Utility.console_log('peripheral {} detected'.format(peripheral))
|
Utility.console_log('peripheral {} detected'.format(peripheral))
|
||||||
assert peripheral in ('SDMMC', 'SPI')
|
assert peripheral in ('SDMMC', 'SPI')
|
||||||
|
|
||||||
|
# Provide enough time for possible SD card formatting
|
||||||
|
dut.expect('Filesystem mounted', timeout=60)
|
||||||
|
|
||||||
# These lines are matched separately because of ASCII color codes in the output
|
# These lines are matched separately because of ASCII color codes in the output
|
||||||
name = dut.expect(re.compile(r'Name: (\w+)'), timeout=5)[0]
|
name = dut.expect(re.compile(r'Name: (\w+)'), timeout=5)[0]
|
||||||
_type = dut.expect(re.compile(r'Type: (\S+)'), timeout=5)[0]
|
_type = dut.expect(re.compile(r'Type: (\S+)'), timeout=5)[0]
|
||||||
|
Reference in New Issue
Block a user