Пример #1
0
        public void WaveDetect_ReturnsFalseWhenSameDirectionsNegative()
        {
            var bankHistory = new List <(DateTimeOffset, double)>()
            {
                (DateTimeOffset.Now, -20),
                (DateTimeOffset.Now, 0),
                (DateTimeOffset.Now, -20),
                (DateTimeOffset.Now, 0),
                (DateTimeOffset.Now, -20),
                (DateTimeOffset.Now, 0),
            };

            Assert.False(SearchPatrolMain.DetectWingWave(bankHistory, 15));
        }
Пример #2
0
        public void WaveDetect_WorksReverse()
        {
            var bankHistory = new List <(DateTimeOffset, double)>()
            {
                (DateTimeOffset.Now, 20),
                (DateTimeOffset.Now, 0),
                (DateTimeOffset.Now, -20),
                (DateTimeOffset.Now, 0),
                (DateTimeOffset.Now, 20),
                (DateTimeOffset.Now, 0),
            };

            Assert.True(SearchPatrolMain.DetectWingWave(bankHistory, 15));
        }
Пример #3
0
        public void WaveDetect_ReturnsFalseWhenLowAngles()
        {
            var bankHistory = new List <(DateTimeOffset, double)>()
            {
                (DateTimeOffset.Now, -20),
                (DateTimeOffset.Now, 0),
                (DateTimeOffset.Now, 14),
                (DateTimeOffset.Now, 0),
                (DateTimeOffset.Now, -20),
                (DateTimeOffset.Now, 0),
            };

            Assert.False(SearchPatrolMain.DetectWingWave(bankHistory, 15));
        }
Пример #4
0
        public void WaveDetect_ReturnsFalseWhenSameDirections()
        {
            var minAngle    = 15 * Math.PI / 180;
            var angle       = minAngle + .1;
            var bankHistory = new List <(DateTimeOffset, double)>()
            {
                (DateTimeOffset.Now, angle),
                (DateTimeOffset.Now, angle),
                (DateTimeOffset.Now, angle),
                (DateTimeOffset.Now, -angle),
                (DateTimeOffset.Now, -angle),
                (DateTimeOffset.Now, -angle),
            };

            Assert.False(SearchPatrolMain.DetectWingWave(bankHistory, minAngle));
        }
Пример #5
0
        // May not be the best way to achive regular requests.
        // See SimConnect.RequestDataOnSimObject
        private void OnTick(object sender, EventArgs e)
        {
            if (searchPatrol.Connected)
            {
                OddTick = !OddTick;
            }
            else
            {
                OddTick = false;
            }

            TryConnect();

            var text = $"User: {searchPatrol.UserLat:0.000}, {searchPatrol.UserLng:0.000}\n";

            text            += $"Heading: {searchPatrol.TargetBearing:0}, Distance: {searchPatrol.TargetDistance:0.0}\n";
            text            += $"Target is about {searchPatrol.TargetFuzzedDistance} km {searchPatrol.TargetFuzzedDirection}";
            StatusText.Value = text;

            WingWave.Value = searchPatrol.DetectWingWave();

            TargetInfoExists.Value            = searchPatrol.TargetInfo != null;
            ClipboardHasValidTargetInfo.Value = DoesClipboardHasValidTargetInfo();
        }