mirror of
https://github.com/okalachev/flix.git
synced 2025-08-17 09:06:11 +00:00
Improve pause function work
Fix disconnecting from qgc while pausing in the simulation. Consider total delay time in micros() in simulation to increase t while delaying. Simplify and get rid of ARDUINO macro check.
This commit is contained in:
@@ -156,8 +156,11 @@ public:
|
||||
void restart() { Serial.println("Ignore reboot in simulation"); }
|
||||
} ESP;
|
||||
|
||||
unsigned long __delayTime = 0;
|
||||
|
||||
void delay(uint32_t ms) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
|
||||
__delayTime += ms * 1000;
|
||||
}
|
||||
|
||||
bool ledcAttach(uint8_t pin, uint32_t freq, uint8_t resolution) { return true; }
|
||||
@@ -167,5 +170,5 @@ unsigned long __micros;
|
||||
unsigned long __resetTime = 0;
|
||||
|
||||
unsigned long micros() {
|
||||
return __micros + __resetTime; // keep the time monotonic
|
||||
return __micros + __resetTime + __delayTime; // keep the time monotonic
|
||||
}
|
||||
|
Reference in New Issue
Block a user