-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from WildernessLabs/jorge-updates
Update Samples
- Loading branch information
Showing
22 changed files
with
625 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
Source/Additional Samples/GnssTracker_SQLite_Demo/.vscode/launch.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Deploy", | ||
"type": "meadow", | ||
"request": "launch", | ||
"preLaunchTask": "meadow: Build" | ||
} | ||
] | ||
} |
10 changes: 5 additions & 5 deletions
10
...er_Demo/Controllers/DatabaseController.cs → ...te_Demo/Controllers/DatabaseController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
162 changes: 162 additions & 0 deletions
162
Source/Additional Samples/GnssTracker_SQLite_Demo/Controllers/DisplayController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
using GnssTracker_SQLite_Demo.Models.Logical; | ||
using Meadow; | ||
using Meadow.Foundation; | ||
using Meadow.Foundation.Graphics; | ||
using Meadow.Foundation.Graphics.MicroLayout; | ||
using Meadow.Logging; | ||
using System; | ||
|
||
namespace GnssTracker_SQLite_Demo.Controllers | ||
{ | ||
public class DisplayController | ||
{ | ||
protected int counter = 0; | ||
protected Logger Log { get => Resolver.Log; } | ||
protected DisplayScreen DisplayScreen { get; set; } | ||
|
||
protected Font12x20 largeFont { get; set; } | ||
protected Font4x8 smallFont { get; set; } | ||
|
||
protected DisplayLabel TempLabel { get; set; } | ||
protected DisplayLabel HumidityLabel { get; set; } | ||
protected DisplayLabel PressureLabel { get; set; } | ||
protected DisplayLabel LatitudeLabel { get; set; } | ||
protected DisplayLabel LongitudeLabel { get; set; } | ||
protected DisplayLabel CounterLabel { get; set; } | ||
|
||
public DisplayController(IGraphicsDisplay display) | ||
{ | ||
largeFont = new Font12x20(); | ||
smallFont = new Font4x8(); | ||
|
||
DisplayScreen = new DisplayScreen(display, RotationType._270Degrees); | ||
} | ||
|
||
public void ShowSplashScreen() | ||
{ | ||
var image = Image.LoadFromResource("GnssTracker_SQLite_Demo.gnss_tracker.bmp"); | ||
|
||
var displayImage = new DisplayImage(0, 0, 250, 122, image) | ||
{ | ||
BackColor = Color.FromHex("#23ABE3"), | ||
HorizontalAlignment = HorizontalAlignment.Center, | ||
VerticalAlignment = VerticalAlignment.Center, | ||
}; | ||
|
||
DisplayScreen.Controls.Add(displayImage); | ||
} | ||
|
||
public void LoadDataScreen() | ||
{ | ||
try | ||
{ | ||
DisplayScreen.Controls.Clear(); | ||
|
||
var box = new DisplayBox(0, 0, DisplayScreen.Width, DisplayScreen.Height) | ||
{ | ||
ForeColor = Color.White, | ||
Filled = true | ||
}; | ||
|
||
var frame = new DisplayBox(5, 5, 240, 112) | ||
{ | ||
ForeColor = Color.Black, | ||
Filled = false | ||
}; | ||
|
||
TempLabel = new DisplayLabel(10, 10, DisplayScreen.Width - 20, largeFont.Height) | ||
{ | ||
Text = $"Temp: 0.00°C", | ||
TextColor = Color.Black, | ||
BackColor = Color.White, | ||
Font = largeFont, | ||
VerticalAlignment = VerticalAlignment.Center, | ||
HorizontalAlignment = HorizontalAlignment.Left | ||
}; | ||
|
||
HumidityLabel = new DisplayLabel(10, 30, DisplayScreen.Width - 20, largeFont.Height) | ||
{ | ||
Text = $"Humidity: 0.00%", | ||
TextColor = Color.Black, | ||
BackColor = Color.White, | ||
Font = largeFont, | ||
VerticalAlignment = VerticalAlignment.Center, | ||
HorizontalAlignment = HorizontalAlignment.Left | ||
}; | ||
|
||
PressureLabel = new DisplayLabel(10, 50, DisplayScreen.Width - 20, largeFont.Height) | ||
{ | ||
Text = $"Pressure: 0.00atm", | ||
TextColor = Color.Black, | ||
BackColor = Color.White, | ||
Font = largeFont, | ||
VerticalAlignment = VerticalAlignment.Center, | ||
HorizontalAlignment = HorizontalAlignment.Left | ||
}; | ||
|
||
LatitudeLabel = new DisplayLabel(10, 72, DisplayScreen.Width - 20, largeFont.Height) | ||
{ | ||
Text = $"Lat: 0°0'0.0\"", | ||
TextColor = Color.White, | ||
BackColor = Color.Red, | ||
Font = largeFont, | ||
VerticalAlignment = VerticalAlignment.Center, | ||
HorizontalAlignment = HorizontalAlignment.Left | ||
}; | ||
|
||
LongitudeLabel = new DisplayLabel(10, 92, DisplayScreen.Width - 20, largeFont.Height) | ||
{ | ||
Text = $"Lon: 0°0'0.0\"", | ||
TextColor = Color.White, | ||
BackColor = Color.Red, | ||
Font = largeFont, | ||
VerticalAlignment = VerticalAlignment.Center, | ||
HorizontalAlignment = HorizontalAlignment.Left | ||
}; | ||
|
||
counter++; | ||
CounterLabel = new DisplayLabel(222, 113, 20, 8) | ||
{ | ||
Text = $"{counter.ToString("D4")}", | ||
TextColor = Color.Black, | ||
BackColor = Color.White, | ||
Font = smallFont, | ||
VerticalAlignment = VerticalAlignment.Center, | ||
HorizontalAlignment = HorizontalAlignment.Center | ||
}; | ||
|
||
DisplayScreen.Controls.Add(box, frame, TempLabel, HumidityLabel, PressureLabel, LatitudeLabel, LongitudeLabel, CounterLabel); | ||
} | ||
catch (Exception e) | ||
{ | ||
Log?.Error($"err while rendering: {e.Message}"); | ||
} | ||
} | ||
|
||
public void UpdateDisplay(AtmosphericModel conditions, LocationModel locationInfo) | ||
{ | ||
TempLabel.Text = $"Temp: {conditions.Temperature?.Celsius:n2}°C"; | ||
HumidityLabel.Text = $"Humidity: {conditions.RelativeHumidity?.Percent:n2}%"; | ||
PressureLabel.Text = $"Pressure: {conditions.Pressure?.StandardAtmosphere:n2}atm"; | ||
|
||
string lat = locationInfo.PositionInformation == null | ||
? $"Lat: 0°0'0.0\"" | ||
: $"Lat: " + | ||
$"{locationInfo.PositionInformation?.Position?.Latitude?.Degrees}°" + | ||
$"{locationInfo.PositionInformation?.Position?.Latitude?.Minutes:n2}'" + | ||
$"{locationInfo.PositionInformation?.Position?.Latitude?.seconds}\""; | ||
LatitudeLabel.Text = lat; | ||
|
||
string lon = locationInfo.PositionInformation == null | ||
? $"Lon: 0°0'0.0\"" | ||
: $"Lon: " + | ||
$"{locationInfo.PositionInformation?.Position?.Longitude?.Degrees}°" + | ||
$"{locationInfo.PositionInformation?.Position?.Longitude?.Minutes:n2}'" + | ||
$"{locationInfo.PositionInformation?.Position?.Longitude?.seconds}\""; | ||
LongitudeLabel.Text = lon; | ||
|
||
counter++; | ||
CounterLabel.Text = $"{counter.ToString("D4")}"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Source/Additional Samples/GnssTracker_SQLite_Demo/GnssTracker_SQLite_Demo.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Project Sdk="Meadow.Sdk/1.1.0"> | ||
<PropertyGroup> | ||
<TargetFramework>netstandard2.1</TargetFramework> | ||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> | ||
<OutputType>Library</OutputType> | ||
<AssemblyName>App</AssemblyName> | ||
</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="SimpleJpegDecoder" Version="*" /> | ||
<PackageReference Include="sqlite-net-static" Version="1.8.116" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\..\Meadow.Foundation\Source\Meadow.Foundation.Libraries_and_Frameworks\Graphics.MicroLayout\Driver\Graphics.MicroLayout.csproj" /> | ||
<ProjectReference Include="..\..\GnssTracker\GnssTracker.csproj" /> | ||
</ItemGroup> | ||
</Project> |
46 changes: 46 additions & 0 deletions
46
Source/Additional Samples/GnssTracker_SQLite_Demo/MeadowApp.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using GnssTracker_SQLite_Demo.Controllers; | ||
using Meadow; | ||
using Meadow.Devices; | ||
using System; | ||
using System.Threading.Tasks; | ||
using WildernessLabs.Hardware.GnssTracker; | ||
|
||
namespace GnssTracker_SQLite_Demo | ||
{ | ||
public class MeadowApp : App<F7CoreComputeV2> | ||
{ | ||
protected MainTrackerController MainController { get; set; } | ||
|
||
public override async Task Initialize() | ||
{ | ||
Resolver.Log.Info("Initialize hardware..."); | ||
|
||
var gnssTracker = GnssTracker.Create(); | ||
|
||
try | ||
{ | ||
DatabaseController.ConfigureDatabase(); | ||
} | ||
catch (Exception e) | ||
{ | ||
Resolver.Log.Info($"Err bringing up database: {e.Message}"); | ||
} | ||
|
||
//await Task.Delay(TimeSpan.FromSeconds(10)); | ||
|
||
GnssController.Initialize(gnssTracker.Gnss); | ||
|
||
MainController = new MainTrackerController(); | ||
await MainController.Initialize(gnssTracker); | ||
} | ||
|
||
public override Task Run() | ||
{ | ||
Resolver.Log.Info("Running"); | ||
|
||
MainController.Start(); | ||
|
||
return base.Run(); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...acker_Demo/Models/Data/SensorDataModel.cs → ...QLite_Demo/Models/Data/SensorDataModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...r_Demo/Models/Logical/AtmosphericModel.cs → ...e_Demo/Models/Logical/AtmosphericModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.