diff --git a/.github/workflows/develop-ci.yml b/.github/workflows/develop-ci.yml
index bdf5e53..3f05c87 100644
--- a/.github/workflows/develop-ci.yml
+++ b/.github/workflows/develop-ci.yml
@@ -3,6 +3,7 @@ name: Develop Build
on:
workflow_dispatch:
pull_request:
+ branches: [ develop ]
push:
branches: [ develop ]
diff --git a/.github/workflows/main-ci.yml b/.github/workflows/main-ci.yml
index d6b94b9..093378e 100644
--- a/.github/workflows/main-ci.yml
+++ b/.github/workflows/main-ci.yml
@@ -3,6 +3,7 @@ name: Main Build
on:
workflow_dispatch:
pull_request:
+ branches: [ main ]
push:
branches: [ main ]
@@ -17,7 +18,6 @@ jobs:
uses: actions/checkout@v3
with:
path: GNSS_Sensor_Tracker
- ref: main
- name: Setup .NET SDK
uses: actions/setup-dotnet@v1
diff --git a/Source/GnssTracker/GnssTracker.csproj b/Source/GnssTracker/GnssTracker.csproj
index 738f27d..5bc9290 100644
--- a/Source/GnssTracker/GnssTracker.csproj
+++ b/Source/GnssTracker/GnssTracker.csproj
@@ -22,12 +22,12 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/Source/GnssTracker_Demo/Controllers/DisplayController.cs b/Source/GnssTracker_Demo/Controllers/DisplayController.cs
index 2070bcb..a1a3b69 100644
--- a/Source/GnssTracker_Demo/Controllers/DisplayController.cs
+++ b/Source/GnssTracker_Demo/Controllers/DisplayController.cs
@@ -4,6 +4,7 @@
using Meadow.Peripherals.Displays;
using Meadow.Peripherals.Sensors.Location.Gnss;
using Meadow.Units;
+using System;
namespace GnssTracker_Demo.Controllers;
@@ -196,22 +197,32 @@ public void UpdateDisplay(
co2LevelsLabel.Text = $"{Concentration?.PartsPerMillion:N1} PPM";
}
- string lat = locationInfo == null
- ? $"00 00' 0.00\""
- : $"" +
- $"{locationInfo?.Position?.Latitude?.Degrees:N2} " +
- $"{locationInfo?.Position?.Latitude?.Minutes:N2}'" +
- $"{locationInfo?.Position?.Latitude?.Seconds:N2}\"";
+ var geo = new GeoLocation(locationInfo?.Position?.Latitude ?? 0, locationInfo?.Position?.Longitude ?? 0);
+
+ string lat = ConvertToDMS(geo.Latitude);
latitudeLabel.Text = lat;
- string lon = locationInfo == null
- ? $"00 00' 0.00\""
- : $"" +
- $"{locationInfo?.Position?.Longitude?.Degrees:N2} " +
- $"{locationInfo?.Position?.Longitude?.Minutes:N2}'" +
- $"{locationInfo?.Position?.Longitude?.Seconds:N2}\"";
+ string lon = ConvertToDMS(geo.Longitude);
longitudeLabel.Text = lon;
displayScreen.EndUpdate();
}
+
+ public string ConvertToDMS(double decimalDegrees)
+ {
+ bool isNegative = decimalDegrees < 0;
+ decimalDegrees = Math.Abs(decimalDegrees);
+
+ int degrees = (int)decimalDegrees;
+
+ double fractionalPart = decimalDegrees - degrees;
+ double totalMinutes = fractionalPart * 60;
+ int minutes = (int)totalMinutes;
+
+ double seconds = (totalMinutes - minutes) * 60;
+
+ string dms = $"{degrees}° {minutes}' {seconds:F2}\"";
+
+ return isNegative ? "-" + dms : dms;
+ }
}
\ No newline at end of file
diff --git a/Source/GnssTracker_Demo/GnssTracker_Demo.csproj b/Source/GnssTracker_Demo/GnssTracker_Demo.csproj
index fde6ff8..bdc1038 100644
--- a/Source/GnssTracker_Demo/GnssTracker_Demo.csproj
+++ b/Source/GnssTracker_Demo/GnssTracker_Demo.csproj
@@ -13,7 +13,7 @@
-
+
diff --git a/Source/GnssTracker_Demo/MeadowApp.cs b/Source/GnssTracker_Demo/MeadowApp.cs
index 9b70b68..1ca2b36 100644
--- a/Source/GnssTracker_Demo/MeadowApp.cs
+++ b/Source/GnssTracker_Demo/MeadowApp.cs
@@ -147,7 +147,7 @@ private void SolarVoltageUpdated(object sender, IChangeResult e)
private void GnssRmcReceived(object sender, GnssPositionInfo e)
{
- if (e.Valid)
+ if (e.IsValid)
{
ReportGNSSPosition(e);
lastGNSSPosition = e;
@@ -156,7 +156,7 @@ private void GnssRmcReceived(object sender, GnssPositionInfo e)
private void GnssGllReceived(object sender, GnssPositionInfo e)
{
- if (e.Valid)
+ if (e.IsValid)
{
ReportGNSSPosition(e);
lastGNSSPosition = e;
@@ -165,7 +165,7 @@ private void GnssGllReceived(object sender, GnssPositionInfo e)
private void ReportGNSSPosition(GnssPositionInfo e)
{
- if (e.Valid)
+ if (e.IsValid)
{
if (DateTime.UtcNow - lastGNSSPositionReportTime >= GNSSPositionReportInterval)
{