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.7.0 #42

Merged
merged 1 commit into from
Jan 10, 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
2 changes: 0 additions & 2 deletions .github/workflows/develop-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Develop Build
on:
workflow_dispatch:
pull_request:
push:
branches: [ develop ]

jobs:
Expand Down Expand Up @@ -65,7 +64,6 @@ jobs:
uses: actions/checkout@v3
with:
path: Juego
ref: develop

- name: Setup .NET SDK
uses: actions/setup-dotnet@v1
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/main-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Main Build
on:
workflow_dispatch:
pull_request:
push:
branches: [ main ]

jobs:
Expand All @@ -16,6 +17,7 @@ jobs:
uses: actions/checkout@v3
with:
path: Juego
ref: main

- name: Setup .NET SDK
uses: actions/setup-dotnet@v1
Expand Down
65 changes: 45 additions & 20 deletions Source/Juego/Juego.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Meadow;
using Meadow.Foundation.Audio;
using Meadow.Foundation.ICs.IOExpanders;
using Meadow.Hardware;
using Meadow.Logging;
using System;

Expand All @@ -18,7 +19,7 @@ private Juego() { }
/// </summary>
public static IJuegoHardware? Create()
{
IJuegoHardware? hardware;
IJuegoHardware? hardware = null;
Logger? logger = Resolver.Log;

logger?.Debug("Initializing Juego...");
Expand All @@ -40,23 +41,52 @@ private Juego() { }
}
else if (device is IF7CoreComputeMeadowDevice { } ccm)
{
II2cBus i2cBus;
Mcp23008? mcpVersion = null;
byte version = 0;

PiezoSpeaker? leftSpeaker = null;
PiezoSpeaker? rightSpeaker = null;

try
{
logger?.Info("Instantiating speakers");
// hack for PWM init bug .... move back into the hardware classes once it's fixed
var leftSpeaker = new PiezoSpeaker(ccm.Pins.PB8);
var rightSpeaker = new PiezoSpeaker(ccm.Pins.PB9);

var i2cBus = ccm.CreateI2cBus(busSpeed: Meadow.Hardware.I2cBusSpeed.FastPlus);
logger?.Info("I2C Bus instantiated");

var mcpVersion = new Mcp23008(i2cBus, address: 0x23);
leftSpeaker = new PiezoSpeaker(ccm.Pins.PB8);
rightSpeaker = new PiezoSpeaker(ccm.Pins.PB9);
}
catch
{
logger?.Info("Failed to instantiate speakers");
}

logger?.Trace("McpVersion up");
var version = mcpVersion.ReadFromPorts();
try
{
logger?.Info("Intantiating I2C Bus");
i2cBus = ccm.CreateI2cBus(busSpeed: I2cBusSpeed.FastPlus);
}
catch
{
logger?.Info("Failed to instantiate I2C Bus");
logger?.Info("Cannot instantiate Juego hardware");
return null;
}

logger?.Info($"Hardware version is {version}");
try
{
logger?.Info("Intantiating version MCP23008");
mcpVersion = new Mcp23008(i2cBus, address: 0x23);
version = mcpVersion.ReadFromPorts();
}
catch
{
logger?.Info("Failed to instantiate version MCP23008");
}

if (version >= JuegoHardwareV3.MinimumHardareVersion)
try
{
if (mcpVersion != null &&
version >= JuegoHardwareV3.MinimumHardareVersion)
{
logger?.Info("Instantiating Juego v3 hardware");
hardware = new JuegoHardwareV3(ccm, i2cBus)
Expand All @@ -71,22 +101,17 @@ private Juego() { }
logger?.Info("Instantiating Juego v2 hardware");
hardware = new JuegoHardwareV2(ccm, i2cBus)
{
Mcp_VersionInfo = mcpVersion,
Mcp_VersionInfo = mcpVersion!,
LeftSpeaker = leftSpeaker,
RightSpeaker = rightSpeaker,
};
}
}
catch (Exception e)
catch
{
logger?.Debug($"Failed to create McpVersion: {e.Message}");
hardware = null;
logger?.Info("Failed to instantiate Juego hardware");
}
}
else
{
throw new NotSupportedException();
}

return hardware;
}
Expand Down
12 changes: 6 additions & 6 deletions Source/Juego/Juego.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageId>Meadow.Juego</PackageId>
<RepositoryUrl>https://github.com/WildernessLabs/Meadow.ProjectLab</RepositoryUrl>
<PackageTags>Meadow.Juego, Meadow, Juego</PackageTags>
<Version>0.96.0</Version>
<Version>1.7.0</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>Convenience library for the Meadow Juego family of boards</Description>
<Nullable>enable</Nullable>
Expand All @@ -24,10 +24,10 @@
<None Include="icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.6.0" />
<PackageReference Include="Meadow.Foundation.Audio.MicroAudio" Version="1.6.0" />
<PackageReference Include="Meadow.Foundation.Displays.TftSpi" Version="1.6.0" />
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Mcp23xxx" Version="1.6.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Motion.Bmi270" Version="1.6.0" />
<PackageReference Include="Meadow.F7" Version="1.7.0" />
<PackageReference Include="Meadow.Foundation.Audio.MicroAudio" Version="1.7.0" />
<PackageReference Include="Meadow.Foundation.Displays.TftSpi" Version="1.7.0" />
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Mcp23xxx" Version="1.7.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Motion.Bmi270" Version="1.7.0" />
</ItemGroup>
</Project>
31 changes: 0 additions & 31 deletions Source/Juego/JuegoHardwareV3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@
public Bmi270? MotionSensor { get; protected set; }

/// <inheritdoc/>
public DisplayConnector DisplayHeader => (DisplayConnector)Connectors[0];

Check warning on line 78 in Source/Juego/JuegoHardwareV3.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.

Check warning on line 78 in Source/Juego/JuegoHardwareV3.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference return.

/// <inheritdoc/>
public I2cConnector? Qwiic => (I2cConnector)Connectors[1];

Check warning on line 81 in Source/Juego/JuegoHardwareV3.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.

/// <summary>
/// Collection of connectors on the Juego board
Expand All @@ -103,44 +103,13 @@
/// <summary>
/// Create a new Juego hardware v3 object
/// </summary>
public JuegoHardwareV3(IF7CoreComputeMeadowDevice device, II2cBus i2cBus)

Check warning on line 106 in Source/Juego/JuegoHardwareV3.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'McpInterrupt_1' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
{
Device = device;
I2cBus = i2cBus;

Resolver.Log.Info("Initialize hardware...");

// DEV NOTE: **ALWAYS** Set up PWMs first - Nuttx PWM driver will step on pin configs otherwise
/* try // code left intentionally, restore once the PWM bug is fixed
{
LeftSpeaker = new PiezoSpeaker(device.Pins.PB8); //D03
}
catch (Exception e)
{
Resolver.Log.Error($"Err Left Speaker: {e.Message}");
}

try
{
RightSpeaker = new PiezoSpeaker(device.Pins.PB9); //D04
}
catch (Exception e)
{
Resolver.Log.Error($"Err Right Speaker: {e.Message}");
} */

/*
try
{
I2cBus = Device.CreateI2cBus(busSpeed: I2cBusSpeed.FastPlus);
Resolver.Log.Info("I2C initialized");
}
catch (Exception e)
{
Resolver.Log.Error($"Err initializing I2C Bus: {e.Message}");
}
*/

try
{
Mcp_Reset = Device.CreateDigitalOutputPort(Device.Pins.PA10, true);
Expand Down Expand Up @@ -226,7 +195,7 @@
var rightPort = Mcp_1.CreateDigitalInterruptPort(Mcp_1.Pins.GP2, InterruptMode.EdgeBoth, ResistorMode.InternalPullUp);
var downPort = Mcp_1.CreateDigitalInterruptPort(Mcp_1.Pins.GP3, InterruptMode.EdgeBoth, ResistorMode.InternalPullUp);
var leftPort = Mcp_1.CreateDigitalInterruptPort(Mcp_1.Pins.GP4, InterruptMode.EdgeBoth, ResistorMode.InternalPullUp);

Check warning on line 198 in Source/Juego/JuegoHardwareV3.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'spiBus' in 'Ili9341.Ili9341(ISpiBus spiBus, IDigitalOutputPort chipSelectPort, IDigitalOutputPort dataCommandPort, IDigitalOutputPort resetPort, int width, int height, ColorMode colorMode = ColorMode.Format12bppRgb444)'.
Left_UpButton = new PushButton(upPort);
Left_RightButton = new PushButton(rightPort);
Left_DownButton = new PushButton(downPort);
Expand Down
3 changes: 2 additions & 1 deletion Source/Juego_Demo/DisplayController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Meadow.Foundation;
using Meadow;
using Meadow.Foundation;
using Meadow.Foundation.Graphics;
using Meadow.Units;

Expand Down
5 changes: 5 additions & 0 deletions Source/Juego_Demo/MeadowApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ public override Task Initialize()

juego = Juego.Create();

if (juego == null)
{
return Task.FromException(new Exception("Juego hardware not found"));
}

if (juego.Display is { } display)
{
displayController = new DisplayController(display);
Expand Down
10 changes: 4 additions & 6 deletions Source/Juego_Prototype/Games/Lander/LanderGame.Renderer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using Meadow.Foundation;
using Meadow.Foundation.Audio;
using Meadow;
using Meadow.Foundation.Graphics;

namespace Juego.Games
Expand All @@ -9,9 +7,9 @@
{
readonly byte cellSize = 8;

DrawPixelDel DrawPixel;
readonly DrawPixelDel DrawPixel;

Check warning on line 10 in Source/Juego_Prototype/Games/Lander/LanderGame.Renderer.cs

View workflow job for this annotation

GitHub Actions / build

The field 'LanderGame.cellSize' is assigned but its value is never used

public void Init(MicroGraphics gl)

Check warning on line 12 in Source/Juego_Prototype/Games/Lander/LanderGame.Renderer.cs

View workflow job for this annotation

GitHub Actions / build

Field 'LanderGame.DrawPixel' is never assigned to, and will always have its default value null
{
gl.Clear();
gl.DrawText(0, 0, "Meadow Lander");
Expand All @@ -34,7 +32,7 @@

void DrawBackground(MicroGraphics graphics)
{

}

void DrawLives(MicroGraphics graphics)
Expand All @@ -46,7 +44,7 @@

void DrawPixel1x(int x, int y, bool colored, MicroGraphics graphics, Color color)
{
graphics.DrawPixel(x, y, colored?color:Color.Black);
graphics.DrawPixel(x, y, colored ? color : Color.Black);
}

void DrawPixel2x(int x, int y, bool colored, MicroGraphics graphics)
Expand Down
12 changes: 6 additions & 6 deletions Source/Juego_Prototype/Juego_Prototype.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
<EmbeddedResource Include="menu.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.6.0" />
<PackageReference Include="Meadow.Foundation" Version="1.6.0" />
<PackageReference Include="Meadow.Foundation.Displays.TextDisplayMenu" Version="1.6.0" />
<PackageReference Include="Meadow.Foundation.Displays.Sh1106" Version="1.6.0" />
<PackageReference Include="Meadow.Foundation.Displays.Ssd130x" Version="1.6.0" />
<PackageReference Include="Meadow.Foundation.Displays.TftSpi" Version="1.6.0" />
<PackageReference Include="Meadow.F7" Version="1.7.0" />
<PackageReference Include="Meadow.Foundation" Version="1.7.0" />
<PackageReference Include="Meadow.Foundation.Displays.TextDisplayMenu" Version="1.7.0" />
<PackageReference Include="Meadow.Foundation.Displays.Sh1106" Version="1.7.0" />
<PackageReference Include="Meadow.Foundation.Displays.Ssd130x" Version="1.7.0" />
<PackageReference Include="Meadow.Foundation.Displays.TftSpi" Version="1.7.0" />
</ItemGroup>
<ItemGroup>
<None Update="meadow.config.yaml">
Expand Down
Loading