Skip to content

Commit

Permalink
MovingBase: rename to Base
Browse files Browse the repository at this point in the history
  • Loading branch information
meee1 committed Aug 4, 2023
1 parent bd6d475 commit 548dd34
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Controls/MovingBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
20 changes: 10 additions & 10 deletions ExtLibs/ArduPilot/CurrentState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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;
}
}
Expand Down
18 changes: 9 additions & 9 deletions GCSViews/ConfigurationView/ConfigSerialInjectGPS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ private static void ProcessUBXMessage()
var pvt = ubx_m8p.packet.ByteArrayToStructure<Utilities.Ubx.ubx_nav_pvt>(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;
}
Expand Down Expand Up @@ -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 =
Expand All @@ -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 =
Expand Down Expand Up @@ -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");
}
}
Expand Down Expand Up @@ -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;
Expand All @@ -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);

Expand Down
8 changes: 4 additions & 4 deletions GCSViews/FlightData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}
Expand Down

0 comments on commit 548dd34

Please sign in to comment.