mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-14 04:04:58 +00:00
Added ability to disable pull up resistor on versiports from config.
This commit is contained in:
@@ -10,6 +10,6 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
{
|
{
|
||||||
public string PortDeviceKey { get; set; }
|
public string PortDeviceKey { get; set; }
|
||||||
public uint PortNumber { get; set; }
|
public uint PortNumber { get; set; }
|
||||||
|
public bool DisablePullUpResistor { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a generic digital input deviced tied to a versiport
|
/// Represents a generic digital input deviced tied to a versiport
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericVersiportInputDevice : Device, IDigitalInput
|
public class GenericVersiportDigitalInputDevice : Device, IDigitalInput
|
||||||
{
|
{
|
||||||
public Versiport InputPort { get; private set; }
|
public Versiport InputPort { get; private set; }
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericVersiportInputDevice(string key, Versiport inputPort):
|
public GenericVersiportDigitalInputDevice(string key, Versiport inputPort):
|
||||||
base(key)
|
base(key)
|
||||||
{
|
{
|
||||||
InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);
|
InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);
|
||||||
@@ -42,9 +42,39 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GenericVersiportInputDeviceConfigProperties
|
public class GenericVersibportAnalogInputDevice : Device, IDigitalInput
|
||||||
{
|
{
|
||||||
|
public Versiport InputPort { get; private set; }
|
||||||
|
|
||||||
|
public BoolFeedback InputStateFeedback { get; private set; }
|
||||||
|
|
||||||
|
public uint MinAnalogChange { get; private set; }
|
||||||
|
|
||||||
|
Func<bool> InputStateFeedbackFunc
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return () => InputPort.AnalogIn > MinAnalogChange ? true : false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public GenericVersibportAnalogInputDevice(string key, Versiport inputPort, uint minAnalogChange) :
|
||||||
|
base(key)
|
||||||
|
{
|
||||||
|
InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);
|
||||||
|
MinAnalogChange = minAnalogChange;
|
||||||
|
InputPort = inputPort;
|
||||||
|
InputPort.SetVersiportConfiguration(eVersiportConfiguration.AnalogInput);
|
||||||
|
InputPort.VersiportChange += new VersiportEventHandler(InputPort_VersiportChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InputPort_VersiportChange(Versiport port, VersiportEventArgs args)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Versiport change: {0}", args.Event);
|
||||||
|
InputStateFeedback.FireUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -213,7 +213,9 @@ namespace PepperDash.Essentials.Devices.Common
|
|||||||
var regSuccess = vp.Register();
|
var regSuccess = vp.Register();
|
||||||
if (regSuccess == eDeviceRegistrationUnRegistrationResponse.Success)
|
if (regSuccess == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||||
{
|
{
|
||||||
return new GenericVersiportInputDevice(key, vp);
|
if (props.DisablePullUpResistor)
|
||||||
|
vp.DisablePullUpResistor = true;
|
||||||
|
return new GenericVersiportDigitalInputDevice(key, vp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -243,14 +245,14 @@ namespace PepperDash.Essentials.Devices.Common
|
|||||||
{
|
{
|
||||||
var cs = (portDevice as CrestronControlSystem);
|
var cs = (portDevice as CrestronControlSystem);
|
||||||
|
|
||||||
if(cs != null)
|
if (cs != null)
|
||||||
if (cs.SupportsRelay && props.PortNumber <= cs.NumberOfRelayPorts)
|
if (cs.SupportsRelay && props.PortNumber <= cs.NumberOfRelayPorts)
|
||||||
{
|
{
|
||||||
Relay relay = cs.RelayPorts[props.PortNumber];
|
Relay relay = cs.RelayPorts[props.PortNumber];
|
||||||
|
|
||||||
if (!relay.Registered)
|
if (!relay.Registered)
|
||||||
{
|
{
|
||||||
if(relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
|
if (relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||||
return new GenericRelayDevice(key, relay);
|
return new GenericRelayDevice(key, relay);
|
||||||
else
|
else
|
||||||
Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey);
|
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")
|
else if (typeName == "occsensor")
|
||||||
{
|
{
|
||||||
var props = JsonConvert.DeserializeObject<GlsOccupancySensorConfigurationProperties>(properties.ToString());
|
var props = JsonConvert.DeserializeObject<GlsOccupancySensorConfigurationProperties>(properties.ToString());
|
||||||
|
|
||||||
uint id = 0x00;
|
uint id = 0x00;
|
||||||
GlsOccupancySensorBase occSensor = null;
|
GlsOccupancySensorBase occSensor = null;
|
||||||
|
|
||||||
@@ -300,7 +302,7 @@ namespace PepperDash.Essentials.Devices.Common
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
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())
|
switch (props.Model.ToLower())
|
||||||
|
|||||||
@@ -16,11 +16,16 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
|
|||||||
|
|
||||||
public BoolFeedback RoomIsOccupiedFeedback { get; private set; }
|
public BoolFeedback RoomIsOccupiedFeedback { get; private set; }
|
||||||
|
|
||||||
|
// Debug properties
|
||||||
|
public bool InTestMode { get; private set; }
|
||||||
|
|
||||||
|
public bool TestRoomIsOccupiedFeedback { get; private set; }
|
||||||
|
|
||||||
public Func<bool> RoomIsOccupiedFeedbackFunc
|
public Func<bool> RoomIsOccupiedFeedbackFunc
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return () => OccSensor.OccupancyDetectedFeedback.BoolValue;
|
return () => InTestMode ? TestRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,6 +42,25 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
|
|||||||
{
|
{
|
||||||
RoomIsOccupiedFeedback.FireUpdate();
|
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>
|
/// <summary>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace PepperDash.Essentials
|
|||||||
public override void InitializeSystem()
|
public override void InitializeSystem()
|
||||||
{
|
{
|
||||||
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Reloads configuration file",
|
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Reloads configuration file",
|
||||||
// ConsoleAccessLevelEnum.AccessOperator);
|
//ConsoleAccessLevelEnum.AccessOperator);
|
||||||
//CrestronConsole.AddNewConsoleCommand(s => TearDown(), "ungo", "Unloads configuration file",
|
//CrestronConsole.AddNewConsoleCommand(s => TearDown(), "ungo", "Unloads configuration file",
|
||||||
// ConsoleAccessLevelEnum.AccessOperator);
|
// ConsoleAccessLevelEnum.AccessOperator);
|
||||||
CrestronConsole.AddNewConsoleCommand(s =>
|
CrestronConsole.AddNewConsoleCommand(s =>
|
||||||
|
|||||||
@@ -130,11 +130,6 @@
|
|||||||
<Compile Include="OTHER\Fusion\FusionEventHandlers.cs" />
|
<Compile Include="OTHER\Fusion\FusionEventHandlers.cs" />
|
||||||
<Compile Include="OTHER\Fusion\FusionProcessorQueries.cs" />
|
<Compile Include="OTHER\Fusion\FusionProcessorQueries.cs" />
|
||||||
<Compile Include="OTHER\Fusion\FusionRviDataClasses.cs" />
|
<Compile Include="OTHER\Fusion\FusionRviDataClasses.cs" />
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="REMOVE EssentialsApp.cs" />
|
<Compile Include="REMOVE EssentialsApp.cs" />
|
||||||
<Compile Include="OTHER\Fusion\EssentialsHuddleSpaceFusionSystemControllerBase.cs" />
|
<Compile Include="OTHER\Fusion\EssentialsHuddleSpaceFusionSystemControllerBase.cs" />
|
||||||
<Compile Include="HttpApiHandler.cs" />
|
<Compile Include="HttpApiHandler.cs" />
|
||||||
@@ -198,15 +193,6 @@
|
|||||||
<Compile Include="UI\SubpageReferenceListSourceItem.cs" />
|
<Compile Include="UI\SubpageReferenceListSourceItem.cs" />
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
<None Include="Properties\ControlSystem.cfg" />
|
<None Include="Properties\ControlSystem.cfg" />
|
||||||
<None Include="Resources\PepperDash Essentials iPad.sgd">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="Resources\PepperDash Essentials TSW-560.sgd">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="Resources\PepperDash Essentials TSW-760.sgd">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\Essentials Core\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj">
|
<ProjectReference Include="..\..\Essentials Core\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj">
|
||||||
@@ -218,12 +204,6 @@
|
|||||||
<Name>Essentials Devices Common</Name>
|
<Name>Essentials Devices Common</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<VisualStudio>
|
<VisualStudio>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -207,13 +207,13 @@ namespace PepperDash.Essentials
|
|||||||
{
|
{
|
||||||
if ((sender as IOccupancyStatusProvider).RoomIsOccupiedFeedback.BoolValue == false)
|
if ((sender as IOccupancyStatusProvider).RoomIsOccupiedFeedback.BoolValue == false)
|
||||||
{
|
{
|
||||||
Debug.Console(0, this, "Vacancy Detected");
|
Debug.Console(1, this, "Notice: Vacancy Detected");
|
||||||
// Trigger the timer when the room is vacant
|
// Trigger the timer when the room is vacant
|
||||||
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
|
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Console(0, this, "Occupancy Detected");
|
Debug.Console(1, this, "Notice: Occupancy Detected");
|
||||||
// Reset the timer when the room is occupied
|
// Reset the timer when the room is occupied
|
||||||
|
|
||||||
RoomVacancyShutdownTimer.Cancel();
|
RoomVacancyShutdownTimer.Cancel();
|
||||||
|
|||||||
Reference in New Issue
Block a user