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.
This commit is contained in:
Andrew Welker
2024-07-08 08:41:03 -05:00
parent f3b4c0aa02
commit fec6b0d385

View File

@@ -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();
}