Corrects issue where "new" GlsOdtCCn OccSensor needed to be assigned in GlsOdtOccupancySensorController constructor for adiditional feedbacks to work correctly and not throw null ref exceptions.

This commit is contained in:
Neil Dorin
2019-11-19 14:50:40 -07:00
parent 6c7bc1a24e
commit f44bde2d83
2 changed files with 7 additions and 5 deletions

View File

@@ -629,7 +629,7 @@ namespace PepperDash.Essentials.DM
} }
DMInput inCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput; DMInput inCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput;
DMOutput outCard = output == 0 ? null : Dmps.SwitcherOutputs[output] as Card.Dmps3OutputBase; DMOutput outCard = output == 0 ? null : Dmps.SwitcherOutputs[output] as DMOutput;
//if (inCard != null) //if (inCard != null)
//{ //{
@@ -638,25 +638,25 @@ namespace PepperDash.Essentials.DM
{ {
//SystemControl.VideoEnter.BoolValue = true; //SystemControl.VideoEnter.BoolValue = true;
if (outCard != null && outCard.VideoOut != null) if (outCard != null)
outCard.VideoOut = inCard; outCard.VideoOut = inCard;
} }
if ((sigType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) if ((sigType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
{ {
if (outCard != null && outCard.AudioOut != null) if (outCard != null)
outCard.AudioOut = inCard; outCard.AudioOut = inCard;
} }
if ((sigType | eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput) if ((sigType | eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput)
{ {
if (outCard != null && outCard.USBRoutedTo != null) if (outCard != null)
outCard.USBRoutedTo = inCard; outCard.USBRoutedTo = inCard;
} }
if ((sigType | eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) if ((sigType | eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput)
{ {
if (inCard != null && inCard.USBRoutedTo != null) if (inCard != null)
inCard.USBRoutedTo = outCard; inCard.USBRoutedTo = outCard;
} }
//} //}

View File

@@ -30,6 +30,8 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
public GlsOdtOccupancySensorController(string key, string name, GlsOdtCCn sensor) public GlsOdtOccupancySensorController(string key, string name, GlsOdtCCn sensor)
: base(key, name, sensor) : base(key, name, sensor)
{ {
OccSensor = sensor;
AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue); AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue);
OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue); OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue);