mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 05:05:00 +00:00
fix: implement copilot suggestions
This commit is contained in:
@@ -21,7 +21,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
public class GenericDigitalInputDevice : EssentialsBridgeableDevice, IDigitalInput, IHasFeedback
|
public class GenericDigitalInputDevice : EssentialsBridgeableDevice, IDigitalInput, IHasFeedback
|
||||||
{
|
{
|
||||||
private DigitalInput inputPort;
|
private DigitalInput inputPort;
|
||||||
private bool invertState;
|
private readonly bool invertState;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the InputStateFeedback
|
/// Gets or sets the InputStateFeedback
|
||||||
@@ -42,8 +42,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
IOPortConfig config)
|
IOPortConfig config)
|
||||||
: base(key, name)
|
: base(key, name)
|
||||||
{
|
{
|
||||||
invertState = !string.IsNullOrEmpty(config.CircuitType) &&
|
invertState = string.Equals(config.CircuitType, "NC", StringComparison.OrdinalIgnoreCase);
|
||||||
config.CircuitType.Equals("NC", StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
InputStateFeedback = new BoolFeedback("inputState", () => invertState ? !inputPort.State : inputPort.State);
|
InputStateFeedback = new BoolFeedback("inputState", () => invertState ? !inputPort.State : inputPort.State);
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
public class GenericVersiportDigitalInputDevice : EssentialsBridgeableDevice, IDigitalInput, IPartitionStateProvider, IHasFeedback
|
public class GenericVersiportDigitalInputDevice : EssentialsBridgeableDevice, IDigitalInput, IPartitionStateProvider, IHasFeedback
|
||||||
{
|
{
|
||||||
private Versiport inputPort;
|
private Versiport inputPort;
|
||||||
private bool invertState;
|
private readonly bool invertState;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the InputStateFeedback
|
/// Gets or sets the InputStateFeedback
|
||||||
@@ -48,8 +48,8 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
public GenericVersiportDigitalInputDevice(string key, string name, Func<IOPortConfig, Versiport> postActivationFunc, IOPortConfig config) :
|
public GenericVersiportDigitalInputDevice(string key, string name, Func<IOPortConfig, Versiport> postActivationFunc, IOPortConfig config) :
|
||||||
base(key, name)
|
base(key, name)
|
||||||
{
|
{
|
||||||
invertState = !string.IsNullOrEmpty(config.CircuitType) &&
|
var circuitType = string.IsNullOrEmpty(config.CircuitType) ? "NO" : config.CircuitType;
|
||||||
config.CircuitType.Equals("NC", StringComparison.OrdinalIgnoreCase);
|
invertState = circuitType.Equals("NC", StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
InputStateFeedback = new BoolFeedback("inputState", () => invertState ? !inputPort.DigitalIn : inputPort.DigitalIn);
|
InputStateFeedback = new BoolFeedback("inputState", () => invertState ? !inputPort.DigitalIn : inputPort.DigitalIn);
|
||||||
PartitionPresentFeedback = new BoolFeedback("partitionPresent", () => !inputPort.DigitalIn);
|
PartitionPresentFeedback = new BoolFeedback("partitionPresent", () => !inputPort.DigitalIn);
|
||||||
|
|||||||
Reference in New Issue
Block a user