Fix mavlink disconnection in pauses in cli commands

Implement pause function that proceeds processing mavlink.
Use temporal workaround for simulation, as micros function gives the same result on the same simulation step.
This commit is contained in:
Oleg Kalachev
2025-02-28 19:25:41 +03:00
parent 5bf2e06c5a
commit 3fdebf39d8
5 changed files with 34 additions and 12 deletions

View File

@@ -52,6 +52,22 @@ void print(const char* format, ...) {
#endif
}
void pause(float duration) {
#if ARDUINO
double start = t;
while (t - start < duration) {
step();
handleInput();
#if WIFI_ENABLED
processMavlink();
#endif
}
#else
// Code above won't work in the simulation
delay(duration * 1000);
#endif
}
void doCommand(String str, bool echo = false) {
// parse command
String command, arg0, arg1;