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.13.0 #1110

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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<LangVersion>10</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<ItemGroup>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ItemGroup>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ItemGroup>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<ItemGroup>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="1.12.0" />
<PackageReference Include="Meadow.Foundation" Version="1.12.0" />
<PackageReference Include="Meadow.F7" Version="1.13.0" />
<PackageReference Include="Meadow.Foundation" Version="1.13.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public virtual void ReadRegister(byte address, Span<byte> readBuffer)
}

/// <summary>
/// Reads a single byte from the specified address of the peripheral
/// Does a half-duplex read of a single byte from the specified address of the peripheral
/// </summary>
/// <param name="address">Address to read</param>
/// <returns>The byte read</returns>
Expand All @@ -116,8 +116,8 @@ public virtual byte ReadRegister(byte address)
AutoSetBusSpeedAndMode();

WriteBuffer.Span[0] = address;
Bus.Exchange(ChipSelect, WriteBuffer.Span[0..1], ReadBuffer.Span[0..1], chipSelectMode);
return ReadBuffer.Span[0];
Bus.Exchange(ChipSelect, WriteBuffer.Span[..2], ReadBuffer.Span[..2], chipSelectMode);
return ReadBuffer.Span[1];
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
<None Include="..\..\Source\icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.Contracts" Version="1.12.0" />
<PackageReference Include="Meadow.Contracts" Version="1.13.0" />
</ItemGroup>
</Project>
9 changes: 5 additions & 4 deletions Source/Meadow.Foundation.Core/ObservableBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ public Unsubscriber(List<IObserver<IChangeResult<UNIT>>> observers, IObserver<IC

public void Dispose()
{
if (!(observer == null)) { observers.Remove(observer); }
if (observer != null)
{
observers.Remove(observer);
}
}
}

Expand All @@ -75,9 +78,7 @@ public static FilterableChangeObserver<UNIT> CreateObserver(
Action<IChangeResult<UNIT>> handler,
Predicate<IChangeResult<UNIT>>? filter = null)
{
return new FilterableChangeObserver<UNIT>(
handler, filter);
return new FilterableChangeObserver<UNIT>(handler, filter);
}

}
}
31 changes: 22 additions & 9 deletions Source/Meadow.Foundation.Core/PollingSensorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ public abstract class PollingSensorBase<UNIT>
: SamplingSensorBase<UNIT>
where UNIT : struct
{
/// <summary>
/// Event raised when a bus communication error occurs
/// </summary>
public event EventHandler<Exception>? CommunicationError;

/// <summary>
/// Starts updating the sensor on the updateInterval frequency specified.
///
Expand Down Expand Up @@ -44,19 +49,27 @@ public override void StartUpdating(TimeSpan? updateInterval = null)
{
while (true)
{
if (ct.IsCancellationRequested)
try
{
observers.ForEach(x => x.OnCompleted());
IsSampling = false;
break;
}
oldConditions = Conditions;
if (ct.IsCancellationRequested)
{
observers.ForEach(x => x.OnCompleted());
IsSampling = false;
break;
}
oldConditions = Conditions;

Conditions = await Read();
Conditions = await Read();

result = new ChangeResult<UNIT>(Conditions, oldConditions);
result = new ChangeResult<UNIT>(Conditions, oldConditions);

RaiseEventsAndNotify(result);
RaiseEventsAndNotify(result);
}
catch (Exception ex)
{
Resolver.Log.Warn($"{this.GetType().Name} threw {ex.Message}");
CommunicationError?.Invoke(this, ex);
}

await Task.Delay(UpdateInterval);
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Meadow.Foundation.Core/SamplingSensorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected void RaiseUpdated(UNIT newValue)
/// </summary>
public UNIT Conditions
{
get => IsSampling ? _conditions : ReadSensor().Result;
get => IsSampling ? _conditions : Read().Result;
protected set => _conditions = value;
}

Expand Down
10 changes: 10 additions & 0 deletions Source/Meadow.Foundation.Core/Sensors/Buttons/PushButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,14 @@ private void DigitalInChanged(object sender, DigitalPortResult result)
{
UpdateEvents(GetNormalizedState(result.New.State));
}

/// <inheritdoc/>
protected override bool GetNormalizedState(bool state)
{
return DigitalIn.Resistor switch
{
ResistorMode.ExternalPullUp or ResistorMode.InternalPullUp => !state,
_ => state,
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected PushButtonBase(IDigitalInputPort inputPort)
/// Returns the sanitized state of the button
/// Inverts the state when using a pull-up resistor
/// </summary>
protected bool GetNormalizedState(bool state)
protected virtual bool GetNormalizedState(bool state)
{
return DigitalIn.Resistor switch
{
Expand Down
Loading