From fec6b0d385f9c6de70644de64be28fdc65512208 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 8 Jul 2024 08:41:03 -0500 Subject: [PATCH] fix: change source for PartitionPresent depending on mode Added `FireUpdate` calls for feedback on mode change in order to get correct values when changing modes. --- .../EssentialsPartitionController.cs | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/PepperDash.Essentials.Core/PartitionSensor/EssentialsPartitionController.cs b/src/PepperDash.Essentials.Core/PartitionSensor/EssentialsPartitionController.cs index 800299b8..56d09aee 100644 --- a/src/PepperDash.Essentials.Core/PartitionSensor/EssentialsPartitionController.cs +++ b/src/PepperDash.Essentials.Core/PartitionSensor/EssentialsPartitionController.cs @@ -1,9 +1,5 @@ -using System; +using PepperDash.Core; using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Core; namespace PepperDash.Essentials.Core { @@ -26,6 +22,11 @@ namespace PepperDash.Essentials.Core { get { + if (IsInAutoMode) + { + return _partitionSensor.PartitionPresentFeedback.BoolValue; + } + return _partitionPresent; } set @@ -73,18 +74,11 @@ namespace PepperDash.Essentials.Core PartitionPresentFeedback.FireUpdate(); } - void PartitionPresentFeedback_OutputChange(object sender, FeedbackEventArgs e) + private void PartitionPresentFeedback_OutputChange(object sender, FeedbackEventArgs e) { if (IsInAutoMode) { - if(e.BoolValue) - { - PartitionPresent = true; - } - else - { - PartitionPresent = false; - } + PartitionPresent = e.BoolValue; } } @@ -111,6 +105,8 @@ namespace PepperDash.Essentials.Core _partitionSensor.PartitionPresentFeedback.OutputChange -= PartitionPresentFeedback_OutputChange; _partitionSensor.PartitionPresentFeedback.OutputChange += PartitionPresentFeedback_OutputChange; } + + PartitionPresentFeedback.FireUpdate(); } public void SetManualMode() @@ -131,6 +127,8 @@ namespace PepperDash.Essentials.Core { _partitionSensor.PartitionPresentFeedback.OutputChange -= PartitionPresentFeedback_OutputChange; } + + PartitionPresentFeedback.FireUpdate(); }