Commit 1eb708b0 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 9947e081
......@@ -55,6 +55,7 @@ static const float DEFAULT_SPEED = 16;
static float last_override_altitude;
static float last_override_speed;
static bool first_coordinate_entered = false;
static bool do_projection = false;
// Logs functions
......@@ -228,6 +229,7 @@ void updateLogAndProjection(void) {
<< metrics.airspeed_m_s << ";" << metrics.climb_rate_m_s;
log(oss.str());
if (first_coordinate_entered) {
if (do_projection) {
updateProjection(current_position[0], current_position[1]);
} else {
......@@ -239,6 +241,7 @@ void updateLogAndProjection(void) {
);
}
}
}
}
// Connexion management functions
......@@ -384,6 +387,10 @@ int triggerParachute(void) {
// Flight management functions
void loiter(double la, double lo, float a, float radius) {
if (!first_coordinate_entered) {
first_coordinate_entered = true;
}
targeted_destination.latitude = la;
targeted_destination.longitude = lo;
targeted_radius = radius;
......@@ -409,6 +416,10 @@ void setTargetCoordinates(double la, double lo, float a) {
return;
}
if (!first_coordinate_entered) {
first_coordinate_entered = true;
}
targeted_destination.latitude = la;
targeted_destination.longitude = lo;
do_projection = true;
......
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