mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-30 12:54:54 +00:00
fixed some null refs and got join map being created correctly
This commit is contained in:
@@ -23,6 +23,11 @@ namespace PepperDash_Essentials_Core.Devices
|
||||
{
|
||||
_port = irPort;
|
||||
|
||||
if (_port == null)
|
||||
{
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "IR Port is null, device will not function");
|
||||
return;
|
||||
}
|
||||
DeviceManager.AddDevice(_port);
|
||||
|
||||
_port.DriverLoaded.OutputChange += DriverLoadedOnOutputChange;
|
||||
@@ -35,6 +40,11 @@ namespace PepperDash_Essentials_Core.Devices
|
||||
return;
|
||||
}
|
||||
|
||||
if (_trilist == null || _bridge == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LinkToApi(_trilist, _joinStart, _joinMapKey, _bridge);
|
||||
}
|
||||
|
||||
@@ -61,22 +71,24 @@ namespace PepperDash_Essentials_Core.Devices
|
||||
|
||||
for (uint i = 0; i < _port.IrFileCommands.Length; i++)
|
||||
{
|
||||
var joinData = new JoinDataComplete(new JoinData {JoinNumber = i + joinStart, JoinSpan = 1},
|
||||
var cmd = _port.IrFileCommands[i];
|
||||
var joinData = new JoinDataComplete(new JoinData {JoinNumber = i, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = _port.IrFileCommands[i],
|
||||
Description = cmd,
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
joinData.SetJoinOffset(joinStart);
|
||||
|
||||
joinMap.Joins.Add(_port.IrFileCommands[i],joinData);
|
||||
joinMap.Joins.Add(cmd,joinData);
|
||||
|
||||
var index = i;
|
||||
trilist.SetBoolSigAction(joinData.JoinNumber, (b) => Press(_port.IrFileCommands[index], b));
|
||||
trilist.SetBoolSigAction(joinData.JoinNumber, (b) => Press(cmd, b));
|
||||
}
|
||||
|
||||
joinMap.PrintJoinMapInfo();
|
||||
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
|
||||
@@ -52,6 +52,7 @@ namespace PepperDash.Essentials.Core
|
||||
DeviceConfig config)
|
||||
: base(key)
|
||||
{
|
||||
DriverLoaded = new BoolFeedback(() => DriverIsLoaded);
|
||||
AddPostActivationAction(() =>
|
||||
{
|
||||
IrPort = postActivationFunc(config);
|
||||
@@ -63,7 +64,7 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
|
||||
var filePath = Global.FilePathPrefix + "ir" + Global.DirectorySeparator + config.Properties["control"]["irFile"].Value<string>();
|
||||
Debug.Console(1, "*************Attemting to load IR file: {0}***************", filePath);
|
||||
Debug.Console(1, "*************Attempting to load IR file: {0}***************", filePath);
|
||||
|
||||
LoadDriver(filePath);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user