|
@@ -1,5 +1,78 @@
|
|
|
#include <unity.h>
|
|
#include <unity.h>
|
|
|
#include "components/jomjol-flowcontroll/test_cnnflowcontroll.cpp"
|
|
#include "components/jomjol-flowcontroll/test_cnnflowcontroll.cpp"
|
|
|
|
|
+#include "components/jomjol-flowcontroll/test_flowpostprocessing.cpp"
|
|
|
|
|
+// SD-Card ////////////////////
|
|
|
|
|
+#include "nvs_flash.h"
|
|
|
|
|
+#include "esp_vfs_fat.h"
|
|
|
|
|
+#include "sdmmc_cmd.h"
|
|
|
|
|
+#include "driver/sdmmc_host.h"
|
|
|
|
|
+#include "driver/sdmmc_defs.h"
|
|
|
|
|
+static const char *TAGMAIN = "main";
|
|
|
|
|
+
|
|
|
|
|
+bool Init_NVS_SDCard()
|
|
|
|
|
+{
|
|
|
|
|
+ esp_err_t ret = nvs_flash_init();
|
|
|
|
|
+ if (ret == ESP_ERR_NVS_NO_FREE_PAGES) {
|
|
|
|
|
+ ESP_ERROR_CHECK(nvs_flash_erase());
|
|
|
|
|
+ ret = nvs_flash_init();
|
|
|
|
|
+ }
|
|
|
|
|
+////////////////////////////////////////////////
|
|
|
|
|
+
|
|
|
|
|
+ ESP_LOGI(TAGMAIN, "Using SDMMC peripheral");
|
|
|
|
|
+ sdmmc_host_t host = SDMMC_HOST_DEFAULT();
|
|
|
|
|
+
|
|
|
|
|
+ // This initializes the slot without card detect (CD) and write protect (WP) signals.
|
|
|
|
|
+ // Modify slot_config.gpio_cd and slot_config.gpio_wp if your board has these signals.
|
|
|
|
|
+ sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
|
|
|
|
|
+
|
|
|
|
|
+ // To use 1-line SD mode, uncomment the following line:
|
|
|
|
|
+
|
|
|
|
|
+#ifdef __SD_USE_ONE_LINE_MODE__
|
|
|
|
|
+ slot_config.width = 1;
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+ // GPIOs 15, 2, 4, 12, 13 should have external 10k pull-ups.
|
|
|
|
|
+ // Internal pull-ups are not sufficient. However, enabling internal pull-ups
|
|
|
|
|
+ // does make a difference some boards, so we do that here.
|
|
|
|
|
+ gpio_set_pull_mode(GPIO_NUM_15, GPIO_PULLUP_ONLY); // CMD, needed in 4- and 1- line modes
|
|
|
|
|
+ gpio_set_pull_mode(GPIO_NUM_2, GPIO_PULLUP_ONLY); // D0, needed in 4- and 1-line modes
|
|
|
|
|
+#ifndef __SD_USE_ONE_LINE_MODE__
|
|
|
|
|
+ gpio_set_pull_mode(GPIO_NUM_4, GPIO_PULLUP_ONLY); // D1, needed in 4-line mode only
|
|
|
|
|
+ gpio_set_pull_mode(GPIO_NUM_12, GPIO_PULLUP_ONLY); // D2, needed in 4-line mode only
|
|
|
|
|
+#endif
|
|
|
|
|
+ gpio_set_pull_mode(GPIO_NUM_13, GPIO_PULLUP_ONLY); // D3, needed in 4- and 1-line modes
|
|
|
|
|
+
|
|
|
|
|
+ // Options for mounting the filesystem.
|
|
|
|
|
+ // If format_if_mount_failed is set to true, SD card will be partitioned and
|
|
|
|
|
+ // formatted in case when mounting fails.
|
|
|
|
|
+ esp_vfs_fat_sdmmc_mount_config_t mount_config = {
|
|
|
|
|
+ .format_if_mount_failed = false,
|
|
|
|
|
+ .max_files = 5,
|
|
|
|
|
+ .allocation_unit_size = 16 * 1024
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // Use settings defined above to initialize SD card and mount FAT filesystem.
|
|
|
|
|
+ // Note: esp_vfs_fat_sdmmc_mount is an all-in-one convenience function.
|
|
|
|
|
+ // Please check its source code and implement error recovery when developing
|
|
|
|
|
+ // production applications.
|
|
|
|
|
+ sdmmc_card_t* card;
|
|
|
|
|
+ ret = esp_vfs_fat_sdmmc_mount("/sdcard", &host, &slot_config, &mount_config, &card);
|
|
|
|
|
+
|
|
|
|
|
+ if (ret != ESP_OK) {
|
|
|
|
|
+ if (ret == ESP_FAIL) {
|
|
|
|
|
+ ESP_LOGE(TAGMAIN, "Failed to mount filesystem. "
|
|
|
|
|
+ "If you want the card to be formatted, set format_if_mount_failed = true.");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ESP_LOGE(TAGMAIN, "Failed to initialize the card (%s). "
|
|
|
|
|
+ "Make sure SD card lines have pull-up resistors in place.", esp_err_to_name(ret));
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ sdmmc_card_print_info(stdout, card);
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @brief startup the test. Like a test-suite
|
|
* @brief startup the test. Like a test-suite
|
|
@@ -7,10 +80,12 @@
|
|
|
*/
|
|
*/
|
|
|
extern "C" void app_main()
|
|
extern "C" void app_main()
|
|
|
{
|
|
{
|
|
|
|
|
+ Init_NVS_SDCard();
|
|
|
UNITY_BEGIN();
|
|
UNITY_BEGIN();
|
|
|
|
|
|
|
|
RUN_TEST(test_ZeigerEval);
|
|
RUN_TEST(test_ZeigerEval);
|
|
|
RUN_TEST(test_ZeigerEvalHybrid);
|
|
RUN_TEST(test_ZeigerEvalHybrid);
|
|
|
|
|
+ RUN_TEST(test_doFlow);
|
|
|
|
|
|
|
|
UNITY_END();
|
|
UNITY_END();
|
|
|
}
|
|
}
|