diff --git a/ion/src/blackbox/ion.cpp b/ion/src/blackbox/ion.cpp index ba42d685a..59c3edb86 100644 --- a/ion/src/blackbox/ion.cpp +++ b/ion/src/blackbox/ion.cpp @@ -3,3 +3,6 @@ void Ion::mssleep(long ms) { } + +void Ion::ussleep(long us) { +} diff --git a/ion/src/simulator/init.cpp b/ion/src/simulator/init.cpp index 61650c045..c09202f95 100644 --- a/ion/src/simulator/init.cpp +++ b/ion/src/simulator/init.cpp @@ -116,3 +116,16 @@ void Ion::mssleep(long ms) { } } } + +void Ion::ussleep(long us) { + auto start = std::chrono::high_resolution_clock::now(); + while (true) { + sDisplay->redraw(); + Fl::wait(0); + auto elapsed = std::chrono::high_resolution_clock::now() - start; + long long microseconds = std::chrono::duration_cast(elapsed).count(); + if (microseconds >= us) { + break; + } + } +}