Commit 62fa10be authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

Fix projection

Do not do any projection before target coordinates have been set.
parent d036ffe3
...@@ -56,6 +56,7 @@ static const float DEFAULT_SPEED = 16; ...@@ -56,6 +56,7 @@ static const float DEFAULT_SPEED = 16;
static float last_override_altitude; static float last_override_altitude;
static float last_override_speed; static float last_override_speed;
static bool first_coordinate_entered = false;
static bool do_projection = false; static bool do_projection = false;
// Logs functions // Logs functions
...@@ -164,6 +165,9 @@ static int doReposition(float la, float lo, float radius, float y) { ...@@ -164,6 +165,9 @@ static int doReposition(float la, float lo, float radius, float y) {
} }
static void doReposition_async(float la, float lo, float radius, float y) { static void doReposition_async(float la, float lo, float radius, float y) {
if (!first_coordinate_entered) {
first_coordinate_entered = true;
}
std::thread(doReposition, la, lo, radius, y).detach(); std::thread(doReposition, la, lo, radius, y).detach();
} }
...@@ -223,6 +227,7 @@ void updateLogAndProjection(void) { ...@@ -223,6 +227,7 @@ void updateLogAndProjection(void) {
<< metrics.airspeed_m_s << ";" << metrics.climb_rate_m_s; << metrics.airspeed_m_s << ";" << metrics.climb_rate_m_s;
log(oss.str()); log(oss.str());
if (first_coordinate_entered) {
if (do_projection) { if (do_projection) {
updateProjection(current_position[0], current_position[1]); updateProjection(current_position[0], current_position[1]);
} else { } else {
...@@ -234,6 +239,7 @@ void updateLogAndProjection(void) { ...@@ -234,6 +239,7 @@ void updateLogAndProjection(void) {
); );
} }
} }
}
} }
// Connexion management functions // Connexion management functions
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment