Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.8.0.1 #39

Merged
merged 1 commit into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PackageReference Include="sqlite-net-static" Version="1.8.116" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.Foundation.Graphics.MicroLayout" Version="1.8.0" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroLayout" Version="1.8.0.1" />
<ProjectReference Include="..\..\GnssTracker\GnssTracker.csproj" />
</ItemGroup>
</Project>
3 changes: 1 addition & 2 deletions Source/GnssTracker/DisplayConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,5 @@ internal DisplayConnectorPinDefinitions(PinMapping mapping)
/// <param name="mapping">The mappings to the host controller</param>
public DisplayConnector(string name, PinMapping mapping)
: base(name, new DisplayConnectorPinDefinitions(mapping))
{
}
{ }
}
6 changes: 3 additions & 3 deletions Source/GnssTracker/GnssTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

namespace WildernessLabs.Hardware.GnssTracker
{
/// <summary>

Check warning on line 8 in Source/GnssTracker/GnssTracker.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'GnssTracker'
/// Represents a Gnss Tracker IoT acclerator
/// </summary>
public class GnssTracker
{
private GnssTracker() { }
Expand Down Expand Up @@ -60,9 +63,6 @@
logger?.Info("Instantiating GnssTracker v1 hardware");
hardware = new GnssTrackerHardwareV1(ccm, i2cBus);
}



}
else
{
Expand Down
14 changes: 7 additions & 7 deletions Source/GnssTracker/GnssTracker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
<None Include="icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.8.0" />
<PackageReference Include="Meadow.Foundation" Version="1.8.0" />
<PackageReference Include="Meadow.Foundation.Displays.ePaper" Version="1.8.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Atmospheric.Bme68x" Version="1.8.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Environmental.Scd4x" Version="1.8.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Gnss.NeoM8" Version="1.8.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Motion.Bmi270" Version="1.8.0" />
<PackageReference Include="Meadow.F7" Version="1.8.0.1" />
<PackageReference Include="Meadow.Foundation" Version="1.8.0.1" />
<PackageReference Include="Meadow.Foundation.Displays.ePaper" Version="1.8.0.1" />
<PackageReference Include="Meadow.Foundation.Sensors.Atmospheric.Bme68x" Version="1.8.0.1" />
<PackageReference Include="Meadow.Foundation.Sensors.Environmental.Scd4x" Version="1.8.0.1" />
<PackageReference Include="Meadow.Foundation.Sensors.Gnss.NeoM8" Version="1.8.0.1" />
<PackageReference Include="Meadow.Foundation.Sensors.Motion.Bmi270" Version="1.8.0.1" />
</ItemGroup>
</Project>
22 changes: 12 additions & 10 deletions Source/GnssTracker/GnssTrackerHardareBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

/// <inheritdoc/>
public I2cConnector I2cHeader => (I2cConnector)Connectors[1]!;

/// <inheritdoc/>
public UartConnector UartHeader => (UartConnector)Connectors[0]!;

Expand Down Expand Up @@ -89,8 +90,8 @@
{
new PinMapping.PinAlias(UartConnector.PinNames.RX, _device.Pins.PI9),
new PinMapping.PinAlias(UartConnector.PinNames.TX, _device.Pins.PH13),
},

Check warning on line 93 in Source/GnssTracker/GnssTrackerHardareBase.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'hostSerialPort' in 'UartConnector.UartConnector(string name, PinMapping mapping, SerialPortName hostSerialPort)'.
_device.PlatformOS.GetSerialPortName("com4"));
_device.PlatformOS.GetSerialPortName("com4")!);
}

internal I2cConnector CreateI2cConnector()
Expand Down Expand Up @@ -128,7 +129,8 @@
/// <summary>
/// Create a new GnssTrackerHardware base object
/// </summary>
/// <param name="device"></param>
/// <param name="device">The Meadow device</param>

Check warning on line 132 in Source/GnssTracker/GnssTrackerHardareBase.cs

View workflow job for this annotation

GitHub Actions / build

Parameter 'i2cBus' has no matching param tag in the XML comment for 'GnssTrackerHardwareBase.GnssTrackerHardwareBase(IF7CoreComputeMeadowDevice, II2cBus)' (but other parameters do)
/// <param name="i2cBus">The I2C bus</param>
public GnssTrackerHardwareBase(IF7CoreComputeMeadowDevice device, II2cBus i2cBus)
{
Log.Debug("Initialize hardware...");
Expand All @@ -150,28 +152,28 @@

try
{
Log.Debug("Initializing BME688");
Resolver.Log.Debug("Initializing GNSS");

AtmosphericSensor = new Bme688(I2cBus, (byte)Bme688.Addresses.Address_0x76);
Gnss = new NeoM8(device, device.PlatformOS.GetSerialPortName("COM4")!, device.Pins.D09, device.Pins.D11);

Log.Debug("BME688 initialized");
Resolver.Log.Debug("GNSS initialized");
}
catch (Exception e)
{
Log.Error($"Err initializing BME688: {e.Message}");
Resolver.Log.Error($"Err initializing GNSS: {e.Message}");
}

try
{
Resolver.Log.Debug("Initializing GNSS");
Log.Debug("Initializing BME688");

Check warning on line 168 in Source/GnssTracker/GnssTrackerHardareBase.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'serialPortName' in 'NeoM8.NeoM8(IMeadowDevice device, SerialPortName serialPortName, IPin? resetPin, IPin? ppsPin = null)'.

Gnss = new NeoM8(device, device.PlatformOS.GetSerialPortName("COM4"), device.Pins.D09, device.Pins.D11);
AtmosphericSensor = new Bme688(I2cBus, (byte)Bme688.Addresses.Address_0x76);

Resolver.Log.Debug("GNSS initialized");
Log.Debug("BME688 initialized");
}
catch (Exception e)
{
Resolver.Log.Error($"Err initializing GNSS: {e.Message}");
Log.Error($"Err initializing BME688: {e.Message}");
}

try
Expand Down
3 changes: 1 addition & 2 deletions Source/GnssTracker/GnssTrackerHardwareV1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class GnssTrackerHardwareV1 : GnssTrackerHardwareBase
/// <param name="device">The Meadow device</param>
/// <param name="i2cBus">The I2C bus</param>
public GnssTrackerHardwareV1(IF7CoreComputeMeadowDevice device, II2cBus i2cBus) : base(device, i2cBus)
{
}
{ }
}
}
21 changes: 1 addition & 20 deletions Source/GnssTracker_Demo/Controllers/DisplayController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Meadow;
using Meadow.Foundation;
using Meadow.Foundation.Graphics;
using Meadow.Foundation.Graphics.MicroLayout;
using Meadow.Logging;
Expand All @@ -14,7 +13,6 @@ public class DisplayController
protected Logger Log { get => Resolver.Log; }
protected DisplayScreen DisplayScreen { get; set; }

protected AbsoluteLayout SplashLayout { get; set; }
protected AbsoluteLayout DataLayout { get; set; }

protected Font12x20 LargeFont { get; set; }
Expand All @@ -34,18 +32,6 @@ public DisplayController(IGraphicsDisplay display)

DisplayScreen = new DisplayScreen(display, RotationType._270Degrees);

SplashLayout = new AbsoluteLayout(DisplayScreen, 0, 0, DisplayScreen.Width, DisplayScreen.Height);

var image = Image.LoadFromResource("GnssTracker_Demo.gnss_tracker.bmp");
var displayImage = new Picture(0, 0, 250, 122, image)
{
BackColor = Color.FromHex("#23ABE3"),
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
};

SplashLayout.Controls.Add(displayImage);

DataLayout = new AbsoluteLayout(DisplayScreen, 0, 0, DisplayScreen.Width, DisplayScreen.Height);

var box = new Box(0, 0, DisplayScreen.Width, DisplayScreen.Height)
Expand Down Expand Up @@ -116,16 +102,11 @@ public DisplayController(IGraphicsDisplay display)

DataLayout.Controls.Add(box, frame, TemperatureLabel, HumidityLabel, PressureLabel, LatitudeLabel, LongitudeLabel, CounterLabel);

DisplayScreen.Controls.Add(SplashLayout, DataLayout);

DataLayout.IsVisible = false;
DisplayScreen.Controls.Add(DataLayout);
}

public void UpdateDisplay((Temperature? Temperature, RelativeHumidity? Humidity, Pressure? Pressure, Resistance? GasResistance) conditions, GnssPositionInfo locationInfo)
{
SplashLayout.IsVisible = false;
DataLayout.IsVisible = true;

TemperatureLabel.Text = $"Temp: {conditions.Temperature?.Celsius:n1}°C";
HumidityLabel.Text = $"Humidity: {conditions.Humidity?.Percent:n1}%";
PressureLabel.Text = $"Pressure: {conditions.Pressure?.StandardAtmosphere:n2}atm";
Expand Down
10 changes: 3 additions & 7 deletions Source/GnssTracker_Demo/GnssTracker_Demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<OutputType>Library</OutputType>
<AssemblyName>App</AssemblyName>
<RootNamespace>GnssTracker_Demo</RootNamespace>
<LangVersion>10.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<None Remove="gnss_tracker.bmp" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="gnss_tracker.bmp" />
</ItemGroup>
<ItemGroup>
<None Update="app.config.yaml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.Foundation.Graphics.MicroLayout" Version="1.8.0" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroLayout" Version="1.8.0.1" />
<ProjectReference Include="..\GnssTracker\GnssTracker.csproj" />
</ItemGroup>
</Project>
46 changes: 33 additions & 13 deletions Source/GnssTracker_Demo/MeadowApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@
{
public class MeadowApp : App<F7CoreComputeV2>
{
GnssPositionInfo? _positionInfo;
protected DisplayController DisplayController { get; set; }

Check warning on line 14 in Source/GnssTracker_Demo/MeadowApp.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

protected IGnssTrackerHardware gnssTracker { get; set; }

protected DisplayController DisplayController { get; set; }
GnssPositionInfo lastGNSSPosition;
DateTime lastGNSSPositionReportTime = DateTime.MinValue;
readonly TimeSpan GNSSPositionReportInterval = TimeSpan.FromSeconds(15);

public override async Task Initialize()
readonly TimeSpan sensorUpdateInterval = TimeSpan.FromSeconds(90);

public override Task Initialize()
{
Resolver.Log.Info("Initialize hardware...");

Expand Down Expand Up @@ -51,7 +56,6 @@
if (gnssTracker.Display is { } display)
{
DisplayController = new DisplayController(display);
await Task.Delay(TimeSpan.FromSeconds(20));
}

if (gnssTracker.OnboardLed is { } onboardLed)
Expand All @@ -60,6 +64,8 @@
}

Resolver.Log.Info("Initialization complete");

return Task.CompletedTask;
}

private void Bmi270_Updated(object sender, IChangeResult<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D, Temperature? Temperature)> e)
Expand All @@ -76,23 +82,24 @@
{
Resolver.Log.Info($"BME688: {(int)e.New.Temperature?.Celsius:0.0}C, {(int)e.New.Humidity?.Percent:0.#}%, {(int)e.New.Pressure?.Millibar:0.#}mbar");

DisplayController.UpdateDisplay(e.New, _positionInfo);
DisplayController.UpdateDisplay(e.New, lastGNSSPosition);
}

private void GnssRmcReceived(object sender, GnssPositionInfo e)
{
if (e.Valid)
{
Resolver.Log.Info($"GNSS Position: lat: [{e.Position.Latitude}], long: [{e.Position.Longitude}]");
_positionInfo = e;
ReportGNSSPosition(e);
lastGNSSPosition = e;
}
}

private void GnssGllReceived(object sender, GnssPositionInfo e)
{
if (e.Valid)
{
Resolver.Log.Info($"GNSS Position: lat: [{e.Position.Latitude}], long: [{e.Position.Longitude}]");
ReportGNSSPosition(e);
lastGNSSPosition = e;
}
}

Expand All @@ -107,30 +114,43 @@

if (gnssTracker.AtmosphericSensor is { } bme688)
{
bme688.StartUpdating(TimeSpan.FromSeconds(30));
bme688.StartUpdating(sensorUpdateInterval);
}

if (gnssTracker.EnvironmentalSensor is { } scd40)
{
scd40.StartUpdating(TimeSpan.FromSeconds(30));
scd40.StartUpdating(sensorUpdateInterval);
}

if (gnssTracker.MotionSensor is { } bmi270)
{
bmi270.StartUpdating(TimeSpan.FromSeconds(30));
bmi270.StartUpdating(sensorUpdateInterval);
}

if (gnssTracker.SolarVoltageInput is { } solarVoltage)
{
solarVoltage.StartUpdating(TimeSpan.FromSeconds(30));
solarVoltage.StartUpdating(sensorUpdateInterval);
}

if (gnssTracker.Gnss is { } gnss)
{
gnss.StartUpdating();
}

return base.Run();
return Task.CompletedTask;
}

private void ReportGNSSPosition(GnssPositionInfo e)
{
if (e.Valid)
{
if (DateTime.UtcNow - lastGNSSPositionReportTime >= GNSSPositionReportInterval)
{
Resolver.Log.Info($"GNSS Position: lat: [{e.Position.Latitude}], long: [{e.Position.Longitude}]");

lastGNSSPositionReportTime = DateTime.UtcNow;
}
}
}
}
}
Binary file removed Source/GnssTracker_Demo/gnss_tracker.bmp
Binary file not shown.
Loading