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.12.8 #68

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/develop-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Develop Build
on:
workflow_dispatch:
pull_request:
branches: [ develop ]
push:
branches: [ develop ]

Expand Down Expand Up @@ -69,7 +70,6 @@ jobs:
uses: actions/checkout@v3
with:
path: Meadow.Foundation.FeatherWings
ref: develop

- name: Setup .NET SDK
uses: actions/setup-dotnet@v1
Expand Down
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.12.0" />
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Is31fl3731" Version="1.12.8" />
</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.12.0" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroGraphics" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.12.8" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroGraphics" Version="1.12.8" />
<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.12.0" />
<PackageReference Include="Meadow.Foundation.Leds.Apa102" Version="1.12.8" />
</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.12.0" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroGraphics" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.12.8" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroGraphics" Version="1.12.8" />
<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.12.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Gnss.Mt3339" Version="1.12.8" />
</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.12.0" />
<PackageReference Include="Meadow.F7" Version="1.12.8" />
<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.12.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Hid.Bbq10Keyboard" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Hid.Tsc2004" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation.Displays.TftSpi" Version="1.12.8" />
<PackageReference Include="Meadow.Foundation.Sensors.Hid.Bbq10Keyboard" Version="1.12.8" />
<PackageReference Include="Meadow.Foundation.Sensors.Hid.Tsc2004" Version="1.12.8" />
</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.12.0" />
<PackageReference Include="Meadow.F7" Version="1.12.8" />
<ProjectReference Include="..\..\Driver\KeyboardWing.csproj" />
</ItemGroup>
</Project>
7 changes: 5 additions & 2 deletions Source/LedMatrix8x16Wing/Driver/LedMatrix8x16Wing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ public void Fill(Color fillColor, bool updateDisplay = false)
{
Fill(0, 0, Width, Height, fillColor);

if (updateDisplay) Show();
if (updateDisplay)
{
Show();
}
}

/// <summary>
Expand All @@ -174,7 +177,7 @@ public void Fill(int x, int y, int width, int height, Color fillColor)
{
for (int j = 0; j < height; j++)
{
DrawPixel(i, j, isColored);
DrawPixel(x + i, y + j, isColored);
}
}
}
Expand Down
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.12.0" />
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Ht16k33" Version="1.12.8" />
</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.12.0" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroGraphics" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.12.8" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroGraphics" Version="1.12.8" />
<ProjectReference Include="..\..\Driver\LedMatrix8x16Wing.csproj" />
</ItemGroup>
</Project>
137 changes: 43 additions & 94 deletions Source/MotorWing/Driver/DCMotor.cs
Original file line number Diff line number Diff line change
@@ -1,145 +1,94 @@
using Meadow.Foundation.ICs.IOExpanders;
using System;
using Meadow.Hardware;
using static Meadow.Foundation.FeatherWings.MotorWing;

namespace Meadow.Foundation.FeatherWings
{
/// <summary>
/// Motor commands
/// </summary>
public enum Commmand
{
/// <summary>
/// Move forward
/// </summary>
FORWARD,
/// <summary>
/// Move backwards
/// </summary>
BACKWARD,
/// <summary>
/// Release
/// </summary>
RELEASE
}

/// <summary>
/// Represents a DC Motor
/// </summary>
public class DCMotor : Motor
public class DCMotor
{
readonly byte _pwmPin;
readonly byte _in1;
readonly byte _in2;
private readonly IPwmPort pwmPort;
private readonly IDigitalOutputPort in1;
private readonly IDigitalOutputPort in2;

readonly Pca9685 controller;

/// <summary>
/// Creates a DCMotor driver
/// </summary>
/// <param name="num"></param>
/// <param name="pca9685"></param>
/// <exception cref="ArgumentException"></exception>
public DCMotor(short num, Pca9685 pca9685) : base(pca9685)
public DCMotor(DCMotorIndex motorIndex, Pca9685 pca9685)

Check warning on line 21 in Source/MotorWing/Driver/DCMotor.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable field 'pwmPort' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 21 in Source/MotorWing/Driver/DCMotor.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable field 'in1' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 21 in Source/MotorWing/Driver/DCMotor.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable field 'in2' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
{
controller = pca9685;

if (num < 0 || num > 3)
switch (motorIndex)
{
throw new ArgumentException("Motor must be between 0 and 3");
}

switch (num)
{
case 0:
_pwmPin = 8;
_in2 = 9;
_in1 = 10;
case DCMotorIndex.Motor1:
pwmPort = controller.Pins.LED8.CreatePwmPort(pca9685.Frequency);
in1 = controller.Pins.LED10.CreateDigitalOutputPort();
in2 = controller.Pins.LED9.CreateDigitalOutputPort();
break;
case 1:
_pwmPin = 13;
_in2 = 12;
_in1 = 11;
case DCMotorIndex.Motor2:
pwmPort = controller.Pins.LED13.CreatePwmPort(pca9685.Frequency);
in1 = controller.Pins.LED11.CreateDigitalOutputPort();
in2 = controller.Pins.LED12.CreateDigitalOutputPort();
break;
case 2:
_pwmPin = 2;
_in2 = 3;
_in1 = 4;
case DCMotorIndex.Motor3:
pwmPort = controller.Pins.LED2.CreatePwmPort(pca9685.Frequency);
in1 = controller.Pins.LED4.CreateDigitalOutputPort();
in2 = controller.Pins.LED3.CreateDigitalOutputPort();
break;
case 3:
_pwmPin = 7;
_in2 = 6;
_in1 = 5;
case DCMotorIndex.Motor4:
pwmPort = controller.Pins.LED7.CreatePwmPort(pca9685.Frequency);
in1 = controller.Pins.LED5.CreateDigitalOutputPort();
in2 = controller.Pins.LED6.CreateDigitalOutputPort();
break;

}

Run(Commmand.RELEASE);

Run(Direction.Release);
}

/// <summary>
/// Controls the motor direction/action
/// </summary>
/// <param name="command">The action</param>
public virtual void Run(Commmand command)
public virtual void Run(Direction command)
{
if (command == Commmand.FORWARD)
{
pca9685.SetPin(_in2, false);
pca9685.SetPin(_in1, true);
}

if (command == Commmand.BACKWARD)
if (command == Direction.Forward)
{
pca9685.SetPin(_in2, true);
pca9685.SetPin(_in1, false);
in1.State = true;
in2.State = false;
}

if (command == Commmand.RELEASE)
{
pca9685.SetPin(_in1, false);
pca9685.SetPin(_in2, false);
}
}

/// <summary>
/// Control the DC Motor speed/throttle
/// </summary>
/// <param name="speed">The 8-bit PWM value, 0 is off, 255 is on</param>
public override void SetSpeed(short speed)
{
if (speed < 0)
else if (command == Direction.Reverse)
{
speed = 0;
in1.State = false;
in2.State = true;
}

if (speed > 255)
if (command == Direction.Release)
{
speed = 255;
in1.State = false;
in2.State = false;
}

pca9685.SetPwm(_pwmPin, 0, speed * 16);
}

/// <summary>
/// Control the DC Motor speed/throttle
/// </summary>
/// <param name="speed">The 12-bit PWM value, 0 is off, 4096 is on</param>
public void PreciseSpeed(short speed)
/// <param name="speed">0 is off, 1 is on</param>
public void SetSpeed(double speed)
{
if (speed > 4096)
speed = 4096;

if (speed < 0)
speed = 0;

pca9685.SetPwm(_pwmPin, 0, speed);
pwmPort.DutyCycle = speed;
}

/// <summary>
/// Stops the motor
/// </summary>
public void Stop()
{
Run(Commmand.RELEASE);
pca9685.SetPwm(_pwmPin, 0, 0);
Run(Direction.Release);
pwmPort.DutyCycle = 0;
}
}
}
30 changes: 0 additions & 30 deletions Source/MotorWing/Driver/Motor.cs

This file was deleted.

Loading
Loading