| @@ -56,6 +56,7 @@ static void start_filesystem() { | |||||
| ESP_ERROR_CHECK(esp_vfs_spiffs_register(&conf)); | ESP_ERROR_CHECK(esp_vfs_spiffs_register(&conf)); | ||||
| } | } | ||||
| /* | |||||
| #include <string> | #include <string> | ||||
| #include <dirent.h> | #include <dirent.h> | ||||
| #include <sys/stat.h> | #include <sys/stat.h> | ||||
| @@ -83,7 +84,7 @@ static void log_dir(const std::string &path) { | |||||
| closedir(dir); | closedir(dir); | ||||
| } | } | ||||
| */ | |||||
| static std::string read_file(const char *path) { | static std::string read_file(const char *path) { | ||||
| std::string data; | std::string data; | ||||
| @@ -157,7 +158,7 @@ extern "C" void app_main(void) { | |||||
| // Dummy Filesystem | // Dummy Filesystem | ||||
| start_filesystem(); | start_filesystem(); | ||||
| // TODO: Scrape this out | // TODO: Scrape this out | ||||
| log_dir("/spiffs"); | |||||
| //log_dir("/spiffs"); | |||||
| Device device("blinky-jr"); | Device device("blinky-jr"); | ||||
| @@ -213,14 +214,16 @@ extern "C" void app_main(void) { | |||||
| int period_us = 1000000 / 60; | int period_us = 1000000 / 60; | ||||
| int64_t start = time_us(); | int64_t start = time_us(); | ||||
| int64_t target_us = start; | int64_t target_us = start; | ||||
| /* | |||||
| int64_t total_delay_us = 0; | int64_t total_delay_us = 0; | ||||
| int n_delays = 0; | int n_delays = 0; | ||||
| int64_t after_sleep_us = 0; | int64_t after_sleep_us = 0; | ||||
| int n_processes = 0; | int n_processes = 0; | ||||
| int64_t total_process_us = 0; | int64_t total_process_us = 0; | ||||
| */ | |||||
| while (true) { | while (true) { | ||||
| int64_t now = time_us(); | int64_t now = time_us(); | ||||
| /* | |||||
| if (after_sleep_us > 0) { | if (after_sleep_us > 0) { | ||||
| total_process_us += now - after_sleep_us; | total_process_us += now - after_sleep_us; | ||||
| ++n_processes; | ++n_processes; | ||||
| @@ -237,19 +240,19 @@ extern "C" void app_main(void) { | |||||
| start = now; | start = now; | ||||
| } | } | ||||
| */ | |||||
| int64_t delay_us = target_us - now; | int64_t delay_us = target_us - now; | ||||
| if (delay_us < 0) delay_us = 0; | if (delay_us < 0) delay_us = 0; | ||||
| if (device.wait(delay_us / 1000)) { | if (device.wait(delay_us / 1000)) { | ||||
| // If the semaphore is set, go back to top of outer loop | // If the semaphore is set, go back to top of outer loop | ||||
| break; | break; | ||||
| } | } | ||||
| /* | |||||
| after_sleep_us = time_us(); | after_sleep_us = time_us(); | ||||
| total_delay_us += (after_sleep_us - now); | total_delay_us += (after_sleep_us - now); | ||||
| ++n_delays; | ++n_delays; | ||||
| */ | |||||
| LEDs->step(); | LEDs->step(); | ||||
| LEDs->show(); | LEDs->show(); | ||||