From 548dd344795ffe0b0696fb5a22b56651f3065e71 Mon Sep 17 00:00:00 2001 From: Michael Oborne Date: Fri, 4 Aug 2023 10:55:46 +1000 Subject: [PATCH] MovingBase: rename to Base --- Controls/MovingBase.cs | 2 +- ExtLibs/ArduPilot/CurrentState.cs | 20 +++++++++---------- .../ConfigSerialInjectGPS.cs | 18 ++++++++--------- GCSViews/FlightData.cs | 8 ++++---- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Controls/MovingBase.cs b/Controls/MovingBase.cs index 59fe946a9e..c0900acdb0 100644 --- a/Controls/MovingBase.cs +++ b/Controls/MovingBase.cs @@ -224,7 +224,7 @@ void mainloop() { } - MainV2.comPort.MAV.cs.MovingBase = gotolocation; + MainV2.comPort.MAV.cs.Base = gotolocation; // plane only if (updaterallypnt && DateTime.Now > nextrallypntupdate) diff --git a/ExtLibs/ArduPilot/CurrentState.cs b/ExtLibs/ArduPilot/CurrentState.cs index 57cb5e26ac..875641f478 100644 --- a/ExtLibs/ArduPilot/CurrentState.cs +++ b/ExtLibs/ArduPilot/CurrentState.cs @@ -80,7 +80,7 @@ public class CurrentState : ICloneable, IDisposable private uint _mode = 99999; - private PointLatLngAlt _movingbase = new PointLatLngAlt(); + private PointLatLngAlt _base = new PointLatLngAlt(); private float _remotesnrdb; private float _sonarrange; @@ -1382,17 +1382,17 @@ public PointLatLngAlt PlannedHomeLocation } [GroupText("Position")] - public PointLatLngAlt MovingBase + public PointLatLngAlt Base { - get => _movingbase; + get => _base; set { if (value == null) - _movingbase = new PointLatLngAlt(); + _base = new PointLatLngAlt(); - if (_movingbase.Lat != value.Lat || _movingbase.Lng != value.Lng || _movingbase.Alt + if (_base.Lat != value.Lat || _base.Lng != value.Lng || _base.Alt != value.Alt) - _movingbase = value; + _base = value; } } @@ -1580,17 +1580,17 @@ public float DistFromMovingBase { get { - if (lat == 0 && lng == 0 || MovingBase == null) + if (lat == 0 && lng == 0 || Base == null) return 0; // shrinking factor for longitude going to poles direction - var rads = Math.Abs(MovingBase.Lat) * 0.0174532925; + var rads = Math.Abs(Base.Lat) * 0.0174532925; var scaleLongDown = Math.Cos(rads); var scaleLongUp = 1.0f / Math.Cos(rads); //DST to Home - var dstlat = Math.Abs(MovingBase.Lat - lat) * 111319.5; - var dstlon = Math.Abs(MovingBase.Lng - lng) * 111319.5 * scaleLongDown; + var dstlat = Math.Abs(Base.Lat - lat) * 111319.5; + var dstlon = Math.Abs(Base.Lng - lng) * 111319.5 * scaleLongDown; return (float)Math.Sqrt(dstlat * dstlat + dstlon * dstlon) * multiplierdist; } } diff --git a/GCSViews/ConfigurationView/ConfigSerialInjectGPS.cs b/GCSViews/ConfigurationView/ConfigSerialInjectGPS.cs index b287cb1553..d7f1ee269d 100644 --- a/GCSViews/ConfigurationView/ConfigSerialInjectGPS.cs +++ b/GCSViews/ConfigurationView/ConfigSerialInjectGPS.cs @@ -787,7 +787,7 @@ private static void ProcessUBXMessage() var pvt = ubx_m8p.packet.ByteArrayToStructure(6); if (pvt.fix_type >= 0x3 && (pvt.flags & 1) > 0) { - MainV2.comPort.MAV.cs.MovingBase = new Utilities.PointLatLngAlt(pvt.lat / 1e7, pvt.lon / 1e7, pvt.height / 1000.0); + MainV2.comPort.MAV.cs.Base = new Utilities.PointLatLngAlt(pvt.lat / 1e7, pvt.lon / 1e7, pvt.height / 1000.0); } ubxpvt = pvt; } @@ -954,7 +954,7 @@ private static void ExtractBasePos(int seen) Utilities.rtcm3.ecef2pos(pos, ref baseposllh); - MainV2.comPort.MAV.cs.MovingBase = new Utilities.PointLatLngAlt(baseposllh[0] * Utilities.rtcm3.R2D, + MainV2.comPort.MAV.cs.Base = new Utilities.PointLatLngAlt(baseposllh[0] * Utilities.rtcm3.R2D, baseposllh[1] * Utilities.rtcm3.R2D, baseposllh[2]); status_line3 = @@ -975,7 +975,7 @@ private static void ExtractBasePos(int seen) Utilities.rtcm3.ecef2pos(pos, ref baseposllh); - MainV2.comPort.MAV.cs.MovingBase = new Utilities.PointLatLngAlt(baseposllh[0] * Utilities.rtcm3.R2D, baseposllh[1] * Utilities.rtcm3.R2D, + MainV2.comPort.MAV.cs.Base = new Utilities.PointLatLngAlt(baseposllh[0] * Utilities.rtcm3.R2D, baseposllh[1] * Utilities.rtcm3.R2D, baseposllh[2]); status_line3 = @@ -1064,18 +1064,18 @@ private void timer1_Tick(object sender, EventArgs e) myGMAP1.Overlays.Clear(); if(myGMAP1.Overlays.Count == 0) myGMAP1.Overlays.Add(new GMapOverlay("base")); - if (MainV2.comPort.MAV.cs.MovingBase != PointLatLng.Empty) + if (MainV2.comPort.MAV.cs.Base != PointLatLng.Empty) { if (myGMAP1.Overlays[0].Markers.Count == 0) { myGMAP1.Overlays[0].Markers - .Add(new GMarkerGoogle(MainV2.comPort.MAV.cs.MovingBase, GMarkerGoogleType.yellow_dot)); + .Add(new GMarkerGoogle(MainV2.comPort.MAV.cs.Base, GMarkerGoogleType.yellow_dot)); myGMAP1.ZoomAndCenterMarkers("base"); } - if (MainV2.comPort.MAV.cs.MovingBase != myGMAP1.Overlays[0].Markers[0].Position) + if (MainV2.comPort.MAV.cs.Base != myGMAP1.Overlays[0].Markers[0].Position) { - myGMAP1.Overlays[0].Markers[0].Position = MainV2.comPort.MAV.cs.MovingBase; + myGMAP1.Overlays[0].Markers[0].Position = MainV2.comPort.MAV.cs.Base; myGMAP1.ZoomAndCenterMarkers("base"); } } @@ -1139,7 +1139,7 @@ private void loadBasePOS() private void but_save_basepos_Click(object sender, EventArgs e) { - if (MainV2.comPort.MAV.cs.MovingBase == null) + if (MainV2.comPort.MAV.cs.Base == null) { CustomMessageBox.Show("No valid base position determined by gps yet", Strings.ERROR); return; @@ -1149,7 +1149,7 @@ private void but_save_basepos_Click(object sender, EventArgs e) if (InputBox.Show("Enter Location", "Enter a friendly name for this location.", ref location) == DialogResult.OK) { - var basepos = MainV2.comPort.MAV.cs.MovingBase; + var basepos = MainV2.comPort.MAV.cs.Base; Settings.Instance["base_pos"] = String.Format("{0},{1},{2},{3}", basepos.Lat.ToString(CultureInfo.InvariantCulture), basepos.Lng.ToString(CultureInfo.InvariantCulture), basepos.Alt.ToString(CultureInfo.InvariantCulture), location); diff --git a/GCSViews/FlightData.cs b/GCSViews/FlightData.cs index c5906d0f5d..218a0e3d57 100644 --- a/GCSViews/FlightData.cs +++ b/GCSViews/FlightData.cs @@ -3765,13 +3765,13 @@ private void mainloop() //updateClearRoutesMarkers(); // add this after the mav icons are drawn - if (MainV2.comPort.MAV.cs.MovingBase != null && - MainV2.comPort.MAV.cs.MovingBase != PointLatLngAlt.Zero) + if (MainV2.comPort.MAV.cs.Base != null && + MainV2.comPort.MAV.cs.Base != PointLatLngAlt.Zero) { addMissionRouteMarker(new GMarkerGoogle(currentloc, GMarkerGoogleType.blue_dot) { - Position = MainV2.comPort.MAV.cs.MovingBase, - ToolTipText = "Moving Base", + Position = MainV2.comPort.MAV.cs.Base, + ToolTipText = "Base", ToolTipMode = MarkerTooltipMode.OnMouseOver }); }