From 42960efe8055ddbb86cec3cf7fbc0965af191be1 Mon Sep 17 00:00:00 2001 From: Michael Oborne Date: Thu, 15 Mar 2012 08:16:50 +0800 Subject: [PATCH] sitl cygwin mods --- libraries/Desktop/support/main.cpp | 6 ++++++ libraries/Desktop/support/sitl.cpp | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/libraries/Desktop/support/main.cpp b/libraries/Desktop/support/main.cpp index 6207bdd38b..57dc7d618d 100644 --- a/libraries/Desktop/support/main.cpp +++ b/libraries/Desktop/support/main.cpp @@ -83,6 +83,12 @@ int main(int argc, char * const argv[]) struct timeval tv; fd_set fds; int fd_high = 0; + +#ifdef __CYGWIN__ + // under windows if this loop is using alot of cpu, + // the alarm gets called at a slower rate. + sleep(5); +#endif FD_ZERO(&fds); loop(); diff --git a/libraries/Desktop/support/sitl.cpp b/libraries/Desktop/support/sitl.cpp index bea1f18fd2..7e0976620a 100644 --- a/libraries/Desktop/support/sitl.cpp +++ b/libraries/Desktop/support/sitl.cpp @@ -231,6 +231,17 @@ static void timer_handler(int signum) if (kill(parent_pid, 0) != 0) { exit(1); } +#else + + static uint16_t count = 0; + static uint32_t last_report; + + count++; + if (millis() - last_report > 1000) { + printf("TH %u cps\n", count); + count = 0; + last_report = millis(); + } #endif /* check for packet from flight sim */