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