mirror of
https://github.com/okalachev/flix.git
synced 2025-08-18 09:36:10 +00:00
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:
16
flix/cli.ino
16
flix/cli.ino
@@ -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;
|
||||
|
Reference in New Issue
Block a user