Keep the t variable monotonic in the simulation

Otherwise it causes stopping sending MAVLink and other bugs
This commit is contained in:
Oleg Kalachev 2024-10-23 06:15:18 +03:00
parent abcc9b96de
commit a94687bd56
2 changed files with 3 additions and 1 deletions

View File

@ -134,7 +134,8 @@ void delay(uint32_t ms) {
}
unsigned long __micros;
unsigned long __resetTime = 0;
unsigned long micros() {
return __micros;
return __micros + __resetTime; // keep the time monotonic
}

View File

@ -55,6 +55,7 @@ public:
void OnReset() {
attitude = Quaternion(); // reset estimated attitude
__resetTime += __micros;
gzmsg << "Flix plugin reset" << endl;
}