mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 05:13:34 +08:00
Adjustements and improvements in the simulation interface
This commit is contained in:
@@ -165,6 +165,10 @@ static void restore_term(void)
|
||||
tcsetattr(0, TCSANOW, &orig_term);
|
||||
}
|
||||
|
||||
bool px4_exit_requested(void) {
|
||||
return _ExitFlag;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
bool daemon_mode = false;
|
||||
@@ -237,6 +241,10 @@ int main(int argc, char **argv)
|
||||
|
||||
if (infile.is_open()) {
|
||||
for (string line; getline(infile, line, '\n');) {
|
||||
|
||||
if (px4_exit_requested()) {
|
||||
break;
|
||||
}
|
||||
// TODO: this should be true but for that we have to check all startup files
|
||||
process_line(line, false);
|
||||
}
|
||||
|
||||
@@ -130,6 +130,16 @@ int px4_clock_gettime(clockid_t clk_id, struct timespec *tp)
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Get system time in us
|
||||
*/
|
||||
unsigned long long hrt_system_time(void)
|
||||
{
|
||||
struct timespec ts;
|
||||
px4_clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return ts_to_abstime(&ts) - px4_timestart;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get absolute time.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user