diff --git a/Essentials Core/PepperDashEssentialsBase/Shades/Shade Interfaces.cs b/Essentials Core/PepperDashEssentialsBase/Shades/Shade Interfaces.cs index c19e2da7..f8887e40 100644 --- a/Essentials Core/PepperDashEssentialsBase/Shades/Shade Interfaces.cs +++ b/Essentials Core/PepperDashEssentialsBase/Shades/Shade Interfaces.cs @@ -23,11 +23,11 @@ namespace PepperDash.Essentials.Core.Shades } /// - /// Requirements for a device that implements basic Open/Close/Stop shade control + /// Requirements for a device that implements basic Open/Close/Stop shade control (Uses 3 relays) /// public interface IShadesOpenCloseStop : IShadesOpenClose { - void Stop(); + void StopOrPreset(); } /// diff --git a/Essentials Core/PepperDashEssentialsBase/Shades/ShadeBase.cs b/Essentials Core/PepperDashEssentialsBase/Shades/ShadeBase.cs index 2021a381..5fbede52 100644 --- a/Essentials Core/PepperDashEssentialsBase/Shades/ShadeBase.cs +++ b/Essentials Core/PepperDashEssentialsBase/Shades/ShadeBase.cs @@ -23,6 +23,7 @@ namespace PepperDash.Essentials.Core.Shades #region iShadesOpenClose Members public abstract void Open(); + public abstract void StopOrPreset(); public abstract void Close(); #endregion diff --git a/Essentials Devices Common/Essentials Devices Common/Environment/Somfy/RelayControlledShade.cs b/Essentials Devices Common/Essentials Devices Common/Environment/Somfy/RelayControlledShade.cs index 297a29fe..d2d2041d 100644 --- a/Essentials Devices Common/Essentials Devices Common/Environment/Somfy/RelayControlledShade.cs +++ b/Essentials Devices Common/Essentials Devices Common/Environment/Somfy/RelayControlledShade.cs @@ -19,11 +19,13 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Somfy RelayControlledShadeConfigProperties Config; ISwitchedOutput OpenRelay; - ISwitchedOutput StopRelay; + ISwitchedOutput StopOrPresetRelay; ISwitchedOutput CloseRelay; int RelayPulseTime; + public string StopOrPresetButtonLabel { get; set; } + public RelayControlledShade(string key, string name, RelayControlledShadeConfigProperties config) : base(key, name) { @@ -31,13 +33,15 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Somfy RelayPulseTime = Config.RelayPulseTime; + StopOrPresetButtonLabel = Config.StopOrPresetLabel; + } public override bool CustomActivate() { //Create ISwitchedOutput objects based on props OpenRelay = GetSwitchedOutputFromDevice(Config.Relays.Open); - StopRelay = GetSwitchedOutputFromDevice(Config.Relays.Stop); + StopOrPresetRelay = GetSwitchedOutputFromDevice(Config.Relays.StopOrPreset); CloseRelay = GetSwitchedOutputFromDevice(Config.Relays.Close); @@ -47,29 +51,28 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Somfy public override void Open() { Debug.Console(1, this, "Opening Shade: '{0}'", this.Name); - StopRelay.Off(); - CloseRelay.Off(); - OpenRelay.On(); + PulseOutput(OpenRelay, RelayPulseTime); } - public void Stop() + public override void StopOrPreset() { - Debug.Console(1, this, "Stopping Shade: '{0}'", this.Name); - OpenRelay.Off(); - CloseRelay.Off(); + Debug.Console(1, this, "Stopping or recalling preset on Shade: '{0}'", this.Name); - StopRelay.On(); - CTimer stopTimer = new CTimer(new CTimerCallbackFunction((o) => StopRelay.Off()), RelayPulseTime); + PulseOutput(StopOrPresetRelay, RelayPulseTime); } public override void Close() { Debug.Console(1, this, "Closing Shade: '{0}'", this.Name); - OpenRelay.Off(); - StopRelay.Off(); - CloseRelay.On(); + PulseOutput(CloseRelay, RelayPulseTime); + } + + void PulseOutput(ISwitchedOutput output, int pulseTime) + { + output.On(); + CTimer pulseTimer = new CTimer(new CTimerCallbackFunction((o) => output.Off()), pulseTime); } /// @@ -98,11 +101,12 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Somfy { public int RelayPulseTime { get; set; } public ShadeRelaysConfig Relays { get; set; } + public string StopOrPresetLabel { get; set; } public class ShadeRelaysConfig { public IOPortConfig Open { get; set; } - public IOPortConfig Stop { get; set; } + public IOPortConfig StopOrPreset { get; set; } public IOPortConfig Close { get; set; } } } diff --git a/Essentials/PepperDashEssentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs b/Essentials/PepperDashEssentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs index 490abd2a..41f9be6a 100644 --- a/Essentials/PepperDashEssentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs +++ b/Essentials/PepperDashEssentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs @@ -8,6 +8,7 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Shades; +using PepperDash.Essentials.Devices.Common.Environment.Somfy; namespace PepperDash.Essentials { @@ -88,7 +89,7 @@ namespace PepperDash.Essentials { if(DeviceType == eShadeDeviceType.OpenClose) { - TriList.SetSigFalseAction(ButtonPressJoinBase + 1, ShadeDevice.Open); + TriList.SetSigTrueAction(ButtonPressJoinBase + 1, ShadeDevice.Open); TriList.SetSigFalseAction(ButtonPressJoinBase + 2, ShadeDevice.Close); } @@ -96,8 +97,11 @@ namespace PepperDash.Essentials { TriList.SetSigFalseAction(ButtonPressJoinBase + 1, ShadeDevice.Open); - TriList.SetSigFalseAction(ButtonPressJoinBase + 2, (ShadeDevice as IShadesOpenCloseStop).Stop); + TriList.SetSigFalseAction(ButtonPressJoinBase + 2, (ShadeDevice as IShadesOpenCloseStop).StopOrPreset); + if(ShadeDevice is RelayControlledShade) + TriList.SetString(StringJoinBase + 2, (ShadeDevice as RelayControlledShade).StopOrPresetButtonLabel); + TriList.SetSigFalseAction(ButtonPressJoinBase + 3, ShadeDevice.Close); } } diff --git a/Essentials/PepperDashEssentials/UIDrivers/JoinedSigInterlock.cs b/Essentials/PepperDashEssentials/UIDrivers/JoinedSigInterlock.cs index fbd77614..69494263 100644 --- a/Essentials/PepperDashEssentials/UIDrivers/JoinedSigInterlock.cs +++ b/Essentials/PepperDashEssentials/UIDrivers/JoinedSigInterlock.cs @@ -1,19 +1,19 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; - -using PepperDash.Core; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials -{ - public class JoinedSigInterlock - { - public uint CurrentJoin { get; private set; } - +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; + +using PepperDash.Core; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials +{ + public class JoinedSigInterlock + { + public uint CurrentJoin { get; private set; } + BasicTriList TriList; public BoolFeedback IsShownFeedback; @@ -33,97 +33,97 @@ namespace PepperDash.Essentials } } - //public BoolFeedback ShownFeedback { get; private set; } - - public JoinedSigInterlock(BasicTriList triList) - { - TriList = triList; - - IsShownFeedback = new BoolFeedback(new Func( () => _IsShown)); - } - - /// - /// Hides CurrentJoin and shows join. Will check and re-set signal if join - /// equals CurrentJoin - /// - public void ShowInterlocked(uint join) - { - Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join); - if (CurrentJoin == join && TriList.BooleanInput[join].BoolValue) - return; - SetButDontShow(join); + //public BoolFeedback ShownFeedback { get; private set; } + + public JoinedSigInterlock(BasicTriList triList) + { + TriList = triList; + + IsShownFeedback = new BoolFeedback(new Func( () => _IsShown)); + } + + /// + /// Hides CurrentJoin and shows join. Will check and re-set signal if join + /// equals CurrentJoin + /// + public void ShowInterlocked(uint join) + { + Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join); + if (CurrentJoin == join && TriList.BooleanInput[join].BoolValue) + return; + SetButDontShow(join); TriList.SetBool(CurrentJoin, true); - IsShown = true; - } - - /// - /// - /// - /// - public void ShowInterlockedWithToggle(uint join) - { - Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join); - if (CurrentJoin == join) - HideAndClear(); - else - { - if (CurrentJoin > 0) - TriList.BooleanInput[CurrentJoin].BoolValue = false; - CurrentJoin = join; + IsShown = true; + } + + /// + /// + /// + /// + public void ShowInterlockedWithToggle(uint join) + { + Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join); + if (CurrentJoin == join) + HideAndClear(); + else + { + if (CurrentJoin > 0) + TriList.BooleanInput[CurrentJoin].BoolValue = false; + CurrentJoin = join; TriList.BooleanInput[CurrentJoin].BoolValue = true; - IsShown = true; - } - } - /// - /// Hides current join and clears CurrentJoin - /// - public void HideAndClear() - { - Debug.Console(2, "Trilist {0:X2}, interlock hiding {1}", TriList.ID, CurrentJoin); - Hide(); - CurrentJoin = 0; - } - - /// - /// Hides the current join but does not clear the selected join in case - /// it needs to be reshown - /// - public void Hide() - { + IsShown = true; + } + } + /// + /// Hides current join and clears CurrentJoin + /// + public void HideAndClear() + { + Debug.Console(2, "Trilist {0:X2}, interlock hiding {1}", TriList.ID, CurrentJoin); + Hide(); + CurrentJoin = 0; + } + + /// + /// Hides the current join but does not clear the selected join in case + /// it needs to be reshown + /// + public void Hide() + { Debug.Console(2, "Trilist {0:X2}, interlock hiding {1}", TriList.ID, CurrentJoin); if (CurrentJoin > 0) { TriList.BooleanInput[CurrentJoin].BoolValue = false; IsShown = false; - } - } - - /// - /// If CurrentJoin is set, it restores that join - /// - public void Show() - { + } + } + + /// + /// If CurrentJoin is set, it restores that join + /// + public void Show() + { Debug.Console(2, "Trilist {0:X2}, interlock showing {1}", TriList.ID, CurrentJoin); if (CurrentJoin > 0) { TriList.BooleanInput[CurrentJoin].BoolValue = true; IsShown = true; - } - } - - /// - /// Useful for pre-setting the interlock but not enabling it. Sets CurrentJoin - /// - /// - public void SetButDontShow(uint join) + } + } + + /// + /// Useful for pre-setting the interlock but not enabling it. Sets CurrentJoin + /// + /// + public void SetButDontShow(uint join) { if (CurrentJoin > 0) { TriList.BooleanInput[CurrentJoin].BoolValue = false; IsShown = false; - } - CurrentJoin = join; - } - - } + } + CurrentJoin = join; + } + + } } \ No newline at end of file diff --git a/Release Package/PepperDashEssentials.cpz b/Release Package/PepperDashEssentials.cpz index 24d5bdb9..925f8c98 100644 Binary files a/Release Package/PepperDashEssentials.cpz and b/Release Package/PepperDashEssentials.cpz differ diff --git a/Release Package/PepperDashEssentials.dll b/Release Package/PepperDashEssentials.dll index 23ab1960..03625e26 100644 Binary files a/Release Package/PepperDashEssentials.dll and b/Release Package/PepperDashEssentials.dll differ