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 2.0.1 #110

Closed
wants to merge 1 commit into from
Closed
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
Binary file added Hardware/v4.b/Schematic_v4b.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,5 @@ The enclosure was designed in Autodesk Fusion 360. The source file can be found
## Support

Having trouble building/running these projects?
* File an [issue](https://github.com/WildernessLabs/Meadow_Issues/issues) with a repro case to investigate, and/or
* Join our [public Slack](http://slackinvite.wildernesslabs.co/), where we have an awesome community helping, sharing and building amazing things using Meadow.
* File an [issue](https://github.com/WildernessLabs/Meadow.Desktop.Samples/issues) with a repro case to investigate, and/or
* Join our [public Slack](http://slackinvite.wildernesslabs.co/), where we have an awesome community helping, sharing and building amazing things using Meadow.
30 changes: 20 additions & 10 deletions Source/Meadow.ProjectLab/ConnectorProviderV3e.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Meadow.Devices;
internal class ConnectorProviderV3e : IConnectorProvider
{
private readonly Sc16is752 _uartExpander;
private ModbusRtuClient? _client;

public ConnectorProviderV3e(ProjectLabHardwareBase projLab, II2cBus i2CBus)
{
Expand All @@ -19,18 +20,27 @@ public ModbusRtuClient GetModbusRtuClient(ProjectLabHardwareBase projLab, int ba
{
if (Resolver.Device is not F7CoreComputeV2) throw new NotSupportedException();

try
lock (_uartExpander)
{
// v3.e+ uses an SC16is I2C UART expander for the RS485
var port = _uartExpander.PortB.CreateRs485SerialPort(baudRate, dataBits, parity, stopBits, false);
Resolver.Log.Trace($"485 port created");
return new ModbusRtuClient(port);
}
catch (Exception ex)
{
Resolver.Log.Warn($"Error creating 485 port: {ex.Message}");
throw new Exception("Unable to connect to UART expander");
if (_client == null)
{
try
{
Resolver.Log.Info($"Creating 485 port...", Constants.LogGroup);
// v3.e+ uses an SC16is I2C UART expander for the RS485
var port = _uartExpander.PortB.CreateRs485SerialPort(baudRate, dataBits, parity, stopBits, false);
Resolver.Log.Trace($"485 port created", Constants.LogGroup);
_client = new ModbusRtuClient(port);
}
catch (Exception ex)
{
Resolver.Log.Warn($"Error creating 485 port: {ex.Message}", Constants.LogGroup);
throw new Exception("Unable to connect to UART expander");
}
}
}

return _client;
}

public MikroBusConnector CreateMikroBus1(IF7CoreComputeMeadowDevice device, Mcp23008 mcp2)
Expand Down
6 changes: 6 additions & 0 deletions Source/Meadow.ProjectLab/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Meadow.Devices;

internal static class Constants
{
public const string LogGroup = "proj_lab";
}
5 changes: 5 additions & 0 deletions Source/Meadow.ProjectLab/IProjectLabHardware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public interface IProjectLabHardware : IMeadowAppEmbeddedHardware
/// </summary>
public ITemperatureSensor? TemperatureSensor { get; }

/// <summary>
/// Gets the second/alternate ITemperatureSensor on the Project Lab board.
/// </summary>
public ITemperatureSensor? TemperatureSensor2 { get; }

/// <summary>
/// Gets the IHumiditySensor on the Project Lab board.
/// </summary>
Expand Down
16 changes: 8 additions & 8 deletions Source/Meadow.ProjectLab/Meadow.ProjectLab.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
<None Include="icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.8" />
<PackageReference Include="Meadow.Foundation.Displays.TftSpi" Version="1.12.8" />
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Mcp23xxx" Version="1.12.8" />
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Sc16is7x2" Version="1.12.8" />
<PackageReference Include="Meadow.Foundation.Sensors.Atmospheric.Bme68x" Version="1.12.8" />
<PackageReference Include="Meadow.Foundation.Sensors.Hid.Xpt2046" Version="1.12.8" />
<PackageReference Include="Meadow.Foundation.Sensors.Light.Bh1750" Version="1.12.8" />
<PackageReference Include="Meadow.Foundation.Sensors.Motion.Bmi270" Version="1.12.8" />
<PackageReference Include="Meadow.F7" Version="2.0.1" />
<PackageReference Include="Meadow.Foundation.Displays.TftSpi" Version="2.0.1" />
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Mcp23xxx" Version="2.0.1" />
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Sc16is7x2" Version="2.0.1" />
<PackageReference Include="Meadow.Foundation.Sensors.Atmospheric.Bme68x" Version="2.0.1" />
<PackageReference Include="Meadow.Foundation.Sensors.Hid.Xpt2046" Version="2.0.1" />
<PackageReference Include="Meadow.Foundation.Sensors.Light.Bh1750" Version="2.0.1" />
<PackageReference Include="Meadow.Foundation.Sensors.Motion.Bmi270" Version="2.0.1" />
</ItemGroup>
</Project>
15 changes: 15 additions & 0 deletions Source/Meadow.ProjectLab/ProjectLabHardwareBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public abstract class ProjectLabHardwareBase : IProjectLabHardware
private IGyroscope? _gyroscope;
private IAccelerometer? _accelerometer;
private ITemperatureSensor? _temperatureSensor;
private ITemperatureSensor? _temperatureSensor2;
private IHumiditySensor? _humiditySensor;
private IBarometricPressureSensor? _barometricPressureSensor;
private IGasResistanceSensor? _gasResistanceSensor;
Expand Down Expand Up @@ -81,6 +82,9 @@ public abstract class ProjectLabHardwareBase : IProjectLabHardware
/// <inheritdoc/>
public ITemperatureSensor? TemperatureSensor => GetTemperatureSensor();

/// <inheritdoc/>
public ITemperatureSensor? TemperatureSensor2 => GetTemperatureSensor2();

/// <inheritdoc/>
public IHumiditySensor? HumiditySensor => GetHumiditySensor();

Expand Down Expand Up @@ -213,6 +217,16 @@ internal ProjectLabHardwareBase(IMeadowDevice compute, II2cBus peripheralI2cBus)
return _temperatureSensor;
}

private ITemperatureSensor? GetTemperatureSensor2()
{
if (_temperatureSensor2 == null)
{
InitializeBme688();
}

return _temperatureSensor2;
}

private void InitializeBmi270()
{
try
Expand Down Expand Up @@ -317,6 +331,7 @@ private void InitializeBme688()
_humiditySensor = bme;
_barometricPressureSensor = bme;
_gasResistanceSensor = bme;
_temperatureSensor2 = bme;
Resolver.SensorService.RegisterSensor(bme);
Logger?.Trace("Atmospheric sensor up");
}
Expand Down
30 changes: 19 additions & 11 deletions Source/Meadow.ProjectLab/ProjectLabHardwareV4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ internal ProjectLabHardwareV4(IF7CoreComputeMeadowDevice device, II2cBus i2cBus)
};

((Ili9341)_display).SetRotation(RotationType._270Degrees);
((Ili9341)_display).InvertDisplay(true);
((Ili9341)_display).InvertDisplayColor(true);

Logger?.Trace("Display up");
}
Expand Down Expand Up @@ -390,21 +390,29 @@ public override string RevisionString
}
}

private ModbusRtuClient? _client;

/// <inheritdoc/>
public override ModbusRtuClient GetModbusRtuClient(int baudRate = 19200, int dataBits = 8, Parity parity = Parity.None, StopBits stopBits = StopBits.One)
{
try
{
// v3.e+ uses an SC16is I2C UART expander for the RS485
var port = _uartExpander.PortB.CreateRs485SerialPort(baudRate, dataBits, parity, stopBits, false);
Resolver.Log.Trace($"485 port created");
return new ModbusRtuClient(port);
}
catch (Exception ex)
if (_client == null)
{
Resolver.Log.Warn($"Error creating 485 port: {ex.Message}");
throw new Exception("Unable to connect to UART expander");
try
{
Resolver.Log.Info($"Creating 485 port...", Constants.LogGroup);

// v3.e+ uses an SC16is I2C UART expander for the RS485
var port = _uartExpander.PortB.CreateRs485SerialPort(baudRate, dataBits, parity, stopBits, false);
Resolver.Log.Trace($"485 port created", Constants.LogGroup);
_client = new ModbusRtuClient(port);
}
catch (Exception ex)
{
Resolver.Log.Warn($"Error creating 485 port: {ex.Message}", Constants.LogGroup);
throw new Exception("Unable to connect to UART expander");
}
}
return _client;
}

/// <inheritdoc/>
Expand Down
4 changes: 2 additions & 2 deletions Source/ProjectLab_Demo/DisplayController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ private Label CreateRightLabel(string text, Color color, int left, int top, int
};
}

public void UpdateTemperatureValue(Temperature temperature)
public void UpdateTemperatureValue(Temperature temperature, Temperature temperature2)
{
this.temperature.Text = $"{temperature.Celsius:N1}ºC";
this.temperature.Text = $"{temperature2.Celsius:N1}ºC/{temperature.Celsius:N1}ºC";
}

public void UpdatePressureValue(Pressure pressure)
Expand Down
6 changes: 3 additions & 3 deletions Source/ProjectLab_Demo/MeadowApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace ProjectLab_Demo;

// Change F7FeatherV2 to F7FeatherV1 if using Feather V1 Meadow boards
// Change to F7CoreComputeV2 for Project Lab V3.x
// Change to ProjectLabFeatherApp for Project Lab V1 or V2
// Change to ProjectLabCoreComputeApp for Project Lab V3+
public class MeadowApp : ProjectLabCoreComputeApp
{
private DisplayController? displayController;
Expand Down Expand Up @@ -107,7 +107,7 @@ public override Task Initialize()
private void OnTemperatureSensorUpdated(object sender, IChangeResult<Temperature> e)
{
Resolver.Log.Info($"TEMPERATURE: {e.New.Celsius:N1}C");
displayController!.UpdateTemperatureValue(e.New);
displayController!.UpdateTemperatureValue(e.New, Hardware.TemperatureSensor2?.Temperature ?? new Temperature(0));
}

private void OnPressureSensorUpdated(object sender, IChangeResult<Pressure> e)
Expand Down
4 changes: 2 additions & 2 deletions Source/ProjectLab_Demo/ProjectLab_Demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.Foundation.Audio.MicroAudio" Version="1.12.8" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroLayout" Version="1.12.8" />
<PackageReference Include="Meadow.Foundation.Audio.MicroAudio" Version="2.0.1" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroLayout" Version="2.0.1" />
<ProjectReference Include="..\Meadow.ProjectLab\Meadow.ProjectLab.csproj" />
</ItemGroup>
</Project>
Loading