Skip to content

Commit

Permalink
Merge pull request #47 from WildernessLabs/v1.6.0
Browse files Browse the repository at this point in the history
Release 1.6.0
  • Loading branch information
jorgedevs authored Dec 7, 2023
2 parents a08b916 + a0ebf82 commit 33f5c2e
Show file tree
Hide file tree
Showing 23 changed files with 100 additions and 58 deletions.
2 changes: 1 addition & 1 deletion Source/CharlieWing/Driver/CharlieWing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Is31fl3731" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Is31fl3731" Version="1.6.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroGraphics" Version="1.5.0" />
<PackageReference Include="Meadow.F7" Version="1.6.0" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroGraphics" Version="1.6.0" />
<ProjectReference Include="..\..\Driver\CharlieWing.csproj" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Source/DotstarWing/Driver/DotstarWing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.Foundation.Leds.Apa102" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Leds.Apa102" Version="1.6.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroGraphics" Version="1.5.0" />
<PackageReference Include="Meadow.F7" Version="1.6.0" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroGraphics" Version="1.6.0" />
<ProjectReference Include="..\..\Driver\DotstarWing.csproj" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Source/GPSWing/Driver/GPSWing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.Foundation.Sensors.Gnss.Mt3339" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Gnss.Mt3339" Version="1.6.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.5.0" />
<PackageReference Include="Meadow.F7" Version="1.6.0" />
<ProjectReference Include="..\..\Driver\GPSWing.csproj" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions Source/KeyboardWing/Driver/KeyboardWing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.Foundation.Displays.TftSpi" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Hid.Bbq10Keyboard" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Hid.Tsc2004" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Displays.TftSpi" Version="1.6.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Hid.Bbq10Keyboard" Version="1.6.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Hid.Tsc2004" Version="1.6.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.5.0" />
<PackageReference Include="Meadow.F7" Version="1.6.0" />
<ProjectReference Include="..\..\Driver\KeyboardWing.csproj" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Source/LedMatrix8x16Wing/Driver/LedMatrix8x16Wing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Ht16k33" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Ht16k33" Version="1.6.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroGraphics" Version="1.5.0" />
<PackageReference Include="Meadow.F7" Version="1.6.0" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroGraphics" Version="1.6.0" />
<ProjectReference Include="..\..\Driver\LedMatrix8x16Wing.csproj" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Source/MotorWing/Driver/MotorWing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Pca9685" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Pca9685" Version="1.6.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.5.0" />
<PackageReference Include="Meadow.F7" Version="1.6.0" />
<ProjectReference Include="..\..\Driver\MotorWing.csproj" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions Source/NeoPixelWing/Driver/NeoPixelWing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.Foundation.Graphics.MicroGraphics" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Leds.Ws2812" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroGraphics" Version="1.6.0" />
<PackageReference Include="Meadow.Foundation.Leds.Ws2812" Version="1.6.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.5.0" />
<PackageReference Include="Meadow.F7" Version="1.6.0" />
<ProjectReference Include="..\..\Driver\NeoPixelWing.csproj" />
</ItemGroup>
</Project>
92 changes: 72 additions & 20 deletions Source/NineDofImuWing/Driver/NineDofImuWing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,63 @@ public class NineDofImuWing :
PollingSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D, MagneticField3D? MagneticField3D)>,
IAccelerometer, IGyroscope, IMagnetometer
{
/// <summary>
/// The LIS3MDL Magnetometer
/// </summary>
public Lis3mdl Lis3mdl { get; private set; }

/// <summary>
/// The LSM6DSOX Accelerometer/Gyroscope
/// </summary>
public Lsm6dsox Lsm6dsox { get; private set; }

/// <summary>
/// The sampling interval
/// </summary>
public override TimeSpan UpdateInterval => ((ISamplingSensor<Acceleration3D>)Lsm6dsox).UpdateInterval;

/// <summary>
/// Is the sensor currently sampling
/// </summary>
public new bool IsSampling => Lsm6dsox.IsSampling && Lis3mdl.IsSampling;

/// <summary>
/// The current acceleration
/// </summary>
public Acceleration3D? Acceleration3D => ((IAccelerometer)Lsm6dsox).Acceleration3D;

/// <summary>
/// The current angular velocity
/// </summary>
public AngularVelocity3D? AngularVelocity3D => ((IGyroscope)Lsm6dsox).AngularVelocity3D;

/// <summary>
/// The current magnetic field
/// </summary>
public MagneticField3D? MagneticField3D => ((IMagnetometer)Lis3mdl).MagneticField3D;

private event EventHandler<IChangeResult<Acceleration3D>>? acceleration3dHander;
private event EventHandler<IChangeResult<AngularVelocity3D>>? angularVelocity3dHandler;
private event EventHandler<IChangeResult<MagneticField3D>>? magneticField3dHander;

event EventHandler<IChangeResult<Acceleration3D>> ISamplingSensor<Acceleration3D>.Updated
{
add => acceleration3dHander += value;
remove => acceleration3dHander -= value;
}

event EventHandler<IChangeResult<AngularVelocity3D>> ISamplingSensor<AngularVelocity3D>.Updated
{
add => angularVelocity3dHandler += value;
remove => angularVelocity3dHandler -= value;
}

event EventHandler<IChangeResult<MagneticField3D>> ISamplingSensor<MagneticField3D>.Updated
{
add => magneticField3dHander += value;
remove => magneticField3dHander -= value;
}

/// <summary>
/// Represents Adafruit's 9-DOF IMU FeatherWing with an <see cref="Lsm6dsox"/> Accelerometer/Gyroscope and an <see cref="Lis3mdl"/> Magnetometer.
/// </summary>
Expand All @@ -50,50 +96,56 @@ public NineDofImuWing(II2cBus i2cBus, bool alternateAccelAddress = false, bool a

private void Lsm6dsox_Updated(object sender, IChangeResult<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)> e)
{
var oldValue = (e.Old.Value.Acceleration3D, e.Old.Value.AngularVelocity3D, MagneticField3D);
var oldValue = (e.Old?.Acceleration3D ?? null, e.Old?.AngularVelocity3D ?? null, MagneticField3D);
var newValue = (e.New.Acceleration3D, e.New.AngularVelocity3D, MagneticField3D);
var newChangeResult = new ChangeResult<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D, MagneticField3D? MagneticField3D)>(newValue, oldValue);
RaiseEventsAndNotify(newChangeResult);
}

private void Lis3mdl_Updated(object sender, IChangeResult<MagneticField3D> e)
{
var oldValue = (Acceleration3D, AngularVelocity3D, e.Old.Value);
var oldValue = (Acceleration3D, AngularVelocity3D, e.Old ?? null);
var newValue = (Acceleration3D, AngularVelocity3D, e.New);
var newChangeResult = new ChangeResult<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D, MagneticField3D? MagneticField3D)>(newValue, oldValue);
RaiseEventsAndNotify(newChangeResult);
}

public event EventHandler<IChangeResult<Acceleration3D>> Acceleration3DUpdated
{
add => ((IAccelerometer)Lsm6dsox).Acceleration3DUpdated += value;
remove => ((IAccelerometer)Lsm6dsox).Acceleration3DUpdated -= value;
}

public event EventHandler<IChangeResult<AngularVelocity3D>> AngularVelocity3DUpdated
{
add => ((IGyroscope)Lsm6dsox).AngularVelocity3DUpdated += value;
remove => ((IGyroscope)Lsm6dsox).AngularVelocity3DUpdated -= value;
}

public event EventHandler<IChangeResult<MagneticField3D>> MagneticField3DUpdated
{
add => ((IMagnetometer)Lis3mdl).MagneticField3DUpdated += value;
remove => ((IMagnetometer)Lis3mdl).MagneticField3DUpdated -= value;
}

/// <inheritdoc/>
public override void StartUpdating(TimeSpan? updateInterval = null)
{
Lsm6dsox.StartUpdating(updateInterval);
Lis3mdl.StartUpdating(updateInterval);
}

/// <inheritdoc/>
public override void StopUpdating()
{
Lsm6dsox.StopUpdating();
Lis3mdl.StopUpdating();
}

/// <inheritdoc/>
protected override void RaiseEventsAndNotify(IChangeResult<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D, MagneticField3D? MagneticField3D)> changeResult)
{
if (changeResult.New.Acceleration3D is { } a3d)
{
acceleration3dHander?.Invoke(this, new ChangeResult<Acceleration3D>(a3d, changeResult.Old?.Acceleration3D));
}

if (changeResult.New.AngularVelocity3D is { } av3d)
{
angularVelocity3dHandler?.Invoke(this, new ChangeResult<AngularVelocity3D>(av3d, changeResult.Old?.AngularVelocity3D));
}

if (changeResult.New.MagneticField3D is { } m3d)
{
magneticField3dHander?.Invoke(this, new ChangeResult<MagneticField3D>(m3d, changeResult.Old?.MagneticField3D));
}

base.RaiseEventsAndNotify(changeResult);
}

/// <inheritdoc/>
protected override Task<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D, MagneticField3D? MagneticField3D)> ReadSensor()
{
(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D, MagneticField3D? MagneticField3D) conditions;
Expand Down
4 changes: 2 additions & 2 deletions Source/NineDofImuWing/Driver/NineDofImuWing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.Foundation.Sensors.Motion.Lis3mdl" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Motion.Lsm6dsox" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Motion.Lis3mdl" Version="1.6.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Motion.Lsm6dsox" Version="1.6.0" />
</ItemGroup>
</Project>
5 changes: 0 additions & 5 deletions Source/NineDofImuWing/Driver/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ public override Task Initialize()
// classical .NET events can also be used for all sensors
nineDofImuWing.Updated += HandleResult;

// or for individual sensors
nineDofImuWing.Acceleration3DUpdated += HandleResult;
nineDofImuWing.AngularVelocity3DUpdated += HandleResult;
nineDofImuWing.MagneticField3DUpdated += HandleResult;

nineDofImuWing.StartUpdating(TimeSpan.FromSeconds(1));

return Task.CompletedTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ public override Task Initialize()
// classical .NET events can also be used for all sensors
nineDofImuWing.Updated += HandleResult;

// or for individual sensors
nineDofImuWing.Acceleration3DUpdated += HandleResult;
nineDofImuWing.AngularVelocity3DUpdated += HandleResult;
nineDofImuWing.MagneticField3DUpdated += HandleResult;

nineDofImuWing.StartUpdating(TimeSpan.FromSeconds(1));

return Task.CompletedTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.5.0" />
<PackageReference Include="Meadow.F7" Version="1.6.0" />
<ProjectReference Include="..\..\Driver\NineDofImuWing.csproj" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Source/OLED128x32Wing/Driver/OLED128x32Wing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.Foundation.Displays.Ssd130x" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Displays.Ssd130x" Version="1.6.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.5.0" />
<PackageReference Include="Meadow.F7" Version="1.6.0" />
<ProjectReference Include="..\..\Driver\OLED128x32Wing.csproj" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions Source/ServoWing/Driver/ServoWing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Pca9685" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Servos.ServoCore" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Pca9685" Version="1.6.0" />
<PackageReference Include="Meadow.Foundation.Servos.ServoCore" Version="1.6.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.5.0" />
<PackageReference Include="Meadow.F7" Version="1.6.0" />
<ProjectReference Include="..\..\Driver\ServoWing.csproj" />
</ItemGroup>
</Project>

0 comments on commit 33f5c2e

Please sign in to comment.