mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-02 22:34:57 +00:00
Added ability to disable pull up resistor on versiports from config.
This commit is contained in:
@@ -213,7 +213,9 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
var regSuccess = vp.Register();
|
||||
if (regSuccess == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
return new GenericVersiportInputDevice(key, vp);
|
||||
if (props.DisablePullUpResistor)
|
||||
vp.DisablePullUpResistor = true;
|
||||
return new GenericVersiportDigitalInputDevice(key, vp);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -243,14 +245,14 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
var cs = (portDevice as CrestronControlSystem);
|
||||
|
||||
if(cs != null)
|
||||
if (cs != null)
|
||||
if (cs.SupportsRelay && props.PortNumber <= cs.NumberOfRelayPorts)
|
||||
{
|
||||
Relay relay = cs.RelayPorts[props.PortNumber];
|
||||
|
||||
if (!relay.Registered)
|
||||
{
|
||||
if(relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
if (relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
return new GenericRelayDevice(key, relay);
|
||||
else
|
||||
Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey);
|
||||
@@ -290,7 +292,7 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
else if (typeName == "occsensor")
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject<GlsOccupancySensorConfigurationProperties>(properties.ToString());
|
||||
|
||||
|
||||
uint id = 0x00;
|
||||
GlsOccupancySensorBase occSensor = null;
|
||||
|
||||
@@ -300,7 +302,7 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, "ERROR:Unable to convert Crestnet ID: {0} to hex. Error:\n{1}", props.CresnetId, e);
|
||||
Debug.Console(0, "ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", props.CresnetId, e);
|
||||
}
|
||||
|
||||
switch (props.Model.ToLower())
|
||||
|
||||
@@ -16,11 +16,16 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
|
||||
|
||||
public BoolFeedback RoomIsOccupiedFeedback { get; private set; }
|
||||
|
||||
// Debug properties
|
||||
public bool InTestMode { get; private set; }
|
||||
|
||||
public bool TestRoomIsOccupiedFeedback { get; private set; }
|
||||
|
||||
public Func<bool> RoomIsOccupiedFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () => OccSensor.OccupancyDetectedFeedback.BoolValue;
|
||||
return () => InTestMode ? TestRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +42,25 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
|
||||
{
|
||||
RoomIsOccupiedFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
public void SetTestMode(bool mode)
|
||||
{
|
||||
InTestMode = mode;
|
||||
|
||||
Debug.Console(1, this, "In Mock Mode: '{0}'", InTestMode);
|
||||
}
|
||||
|
||||
public void SetTestState(bool state)
|
||||
{
|
||||
if (!InTestMode)
|
||||
Debug.Console(1, "Mock mode not enabled");
|
||||
else
|
||||
{
|
||||
TestRoomIsOccupiedFeedback = state;
|
||||
|
||||
RoomIsOccupiedFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user