Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discard updates from pilots above 5000ft and distance > 10nm #55

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/core/DataManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,14 @@ DataManager::MessageType DataManager::deltaEuroscopeToBackend(const std::array<t
Json::Value& message) {
message.clear();

// Do not push updates to server if simulated update or either of the conditions is met:
// - Above 5000ft
// - More than 10nm away from origin
if (!data[EuroscopeData].isSimulated &&
((data[EuroscopeData].trueAltitude > 5000) || (data[EuroscopeData].distanceFromOrigin > 10.0))) {
return DataManager::MessageType::None;
}

if (data[ServerData].callsign == "" && data[EuroscopeData].callsign != "") {
return DataManager::MessageType::Post;
} else {
Expand Down Expand Up @@ -516,6 +524,9 @@ types::Pilot DataManager::CFlightPlanToPilot(const EuroScopePlugIn::CFlightPlan
// position data
pilot.latitude = flightplan.GetFPTrackPosition().GetPosition().m_Latitude;
pilot.longitude = flightplan.GetFPTrackPosition().GetPosition().m_Longitude;
pilot.trueAltitude = flightplan.GetFPTrackPosition().GetPressureAltitude();
pilot.distanceFromOrigin = flightplan.GetDistanceFromOrigin();
pilot.isSimulated = flightplan.GetSimulated();

// flightplan & clearance data
pilot.origin = flightplan.GetFlightPlanData().GetOrigin();
Expand Down
5 changes: 5 additions & 0 deletions src/types/Pilot.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ typedef struct Pilot_t {

double latitude = 0.0;
double longitude = 0.0;

double trueAltitude = 0.0;
double distanceFromOrigin = 0.0;

bool taxizoneIsTaxiout = false;
bool isSimulated = false;

// flightplan & clearance data

Expand Down