Skip to content

Commit

Permalink
Update SamplingSensorBase.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianstevens committed Dec 6, 2023
1 parent d1ca37d commit 47281b3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Source/Meadow.Foundation.Core/SamplingSensorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ namespace Meadow.Foundation
/// Base class for sensors and other updating classes that want to support
/// having their updates consumed by observers that can optionally use filters
/// </summary>
/// <typeparam name="UNIT"></typeparam>
/// <typeparam name="UNIT">The generic sensor data type</typeparam>
public abstract class SamplingSensorBase<UNIT> : ObservableBase<UNIT>, ISamplingSensor<UNIT>
where UNIT : struct
{
private UNIT? _lastEventValue;

/// <summary>
/// Raised when the sensor has new data
/// </summary>
/// <param name="newValue">The new sensor value as a generic</param>
protected void RaiseUpdated(UNIT newValue)
{
var changeResult = new ChangeResult<UNIT>(newValue, _lastEventValue);
Expand All @@ -25,7 +29,7 @@ protected void RaiseUpdated(UNIT newValue)
/// <summary>
/// Lock for sampling
/// </summary>
protected object samplingLock = new object();
protected object samplingLock = new();

/// <summary>
/// Event handler for updated values
Expand Down

0 comments on commit 47281b3

Please sign in to comment.