Work in progress to support a speed factor in SITL

These contains some rough changes trying to get SITL to speed up by a
SPEED_FACTOR.

This platform time code probably requires some more thought and refactor
but this gets a demo at 4x working.
This commit is contained in:
Julian Oes
2018-12-22 10:32:18 +01:00
parent 82a88d6a53
commit db6de38b19
6 changed files with 108 additions and 32 deletions
+6
View File
@@ -73,6 +73,12 @@
#define system_sleep sleep
#pragma GCC poison sleep
#include <pthread.h>
#define system_pthread_cond_timedwait pthread_cond_timedwait
// We can't poison pthread_cond_timedwait because it seems to be used in the
// <string> include.
#ifdef __cplusplus
#include <cstdlib>
#endif
+20
View File
@@ -2,6 +2,7 @@
#include <sys/types.h>
#include <time.h>
#include <pthread.h>
#if defined(__PX4_APPLE_LEGACY)
@@ -31,10 +32,29 @@ __END_DECLS
#else
#if 0
#define px4_clock_gettime clock_gettime
#define px4_clock_settime clock_settime
#define px4_usleep system_usleep
#define px4_sleep system_sleep
#define px4_pthread_cond_timedwait system_pthread_cond_timedwait
#else
__BEGIN_DECLS
__EXPORT int px4_clock_gettime(clockid_t clk_id, struct timespec *tp);
__EXPORT int px4_clock_settime(clockid_t clk_id, const struct timespec *tp);
__EXPORT int px4_usleep(useconds_t usec);
__EXPORT unsigned int px4_sleep(unsigned int seconds);
__EXPORT int px4_pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mutex,
const struct timespec *abstime);
__END_DECLS
#endif
#endif