Skip to content

Commit

Permalink
Limit visible traffic to 10 nm
Browse files Browse the repository at this point in the history
  • Loading branch information
apps4av committed Nov 3, 2024
1 parent 973ef31 commit eb5dcb7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lib/gdl90/traffic_cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import '../gps.dart';

const double _kDivBy180 = 1.0 / 180.0;
const double _kMinutesPerMillisecond = 1.0 / 60000.0;
const int _kTrafficAltDiffThresholdFt = 3000;
const int _kTrafficAltDiffThresholdFt = 2000;
const int _kTrafficDistanceDiffThresholdNm = 10;

enum TrafficAlertLevel { none, advisory, resolution }

Expand Down Expand Up @@ -131,10 +132,12 @@ class TrafficCache {
}
final Traffic trafficNew = Traffic(message);
// only display/alert traffic that isn't too far from ownship
if (trafficNew.verticalOwnshipDistanceFt.abs() > _kTrafficAltDiffThresholdFt) {
if (trafficNew.verticalOwnshipDistanceFt.abs() > _kTrafficAltDiffThresholdFt ||
trafficNew.horizontalOwnshipDistanceNmi > _kTrafficDistanceDiffThresholdNm) {
_traffic[i] = null;
return;
}

_traffic[i] = trafficNew;

// process any audible alerts from traffic (if enabled)
Expand All @@ -147,7 +150,8 @@ class TrafficCache {
// put it in the end
final Traffic trafficNew = Traffic(message);
// only display/alert traffic that isn't too far from ownship
if (trafficNew.verticalOwnshipDistanceFt.abs() > _kTrafficAltDiffThresholdFt) {
if (trafficNew.verticalOwnshipDistanceFt.abs() > _kTrafficAltDiffThresholdFt ||
trafficNew.horizontalOwnshipDistanceNmi > _kTrafficDistanceDiffThresholdNm) {
return;
}
_traffic[maxEntries] = trafficNew;
Expand Down
2 changes: 1 addition & 1 deletion lib/plan/plan_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class PlanScreenState extends State<PlanScreen> {
builder: (context, value, _) {
return ListTile( // header
key: Key(Storage().getKey()),
leading: GestureDetector(child: const Icon(Icons.summarize_outlined), onTap: () {
leading: GestureDetector(child: const Icon(Icons.summarize_outlined, color: Colors.green,), onTap: () {
Clipboard.setData(ClipboardData(text: Storage().route.toString()));
Toastification().show(context: context, title: const Text("Copied plan to Clipboard"), autoCloseDuration: const Duration(seconds: 3), icon: const Icon(Icons.info));
},),
Expand Down

0 comments on commit eb5dcb7

Please sign in to comment.