mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 12:44:58 +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;
|
_port = irPort;
|
||||||
|
|
||||||
|
if (_port == null)
|
||||||
|
{
|
||||||
|
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "IR Port is null, device will not function");
|
||||||
|
return;
|
||||||
|
}
|
||||||
DeviceManager.AddDevice(_port);
|
DeviceManager.AddDevice(_port);
|
||||||
|
|
||||||
_port.DriverLoaded.OutputChange += DriverLoadedOnOutputChange;
|
_port.DriverLoaded.OutputChange += DriverLoadedOnOutputChange;
|
||||||
@@ -35,6 +40,11 @@ namespace PepperDash_Essentials_Core.Devices
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_trilist == null || _bridge == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LinkToApi(_trilist, _joinStart, _joinMapKey, _bridge);
|
LinkToApi(_trilist, _joinStart, _joinMapKey, _bridge);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,22 +71,24 @@ namespace PepperDash_Essentials_Core.Devices
|
|||||||
|
|
||||||
for (uint i = 0; i < _port.IrFileCommands.Length; i++)
|
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
|
new JoinMetadata
|
||||||
{
|
{
|
||||||
Description = _port.IrFileCommands[i],
|
Description = cmd,
|
||||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||||
JoinType = eJoinType.Digital
|
JoinType = eJoinType.Digital
|
||||||
});
|
});
|
||||||
|
|
||||||
joinData.SetJoinOffset(joinStart);
|
joinData.SetJoinOffset(joinStart);
|
||||||
|
|
||||||
joinMap.Joins.Add(_port.IrFileCommands[i],joinData);
|
joinMap.Joins.Add(cmd,joinData);
|
||||||
|
|
||||||
var index = i;
|
trilist.SetBoolSigAction(joinData.JoinNumber, (b) => Press(cmd, b));
|
||||||
trilist.SetBoolSigAction(joinData.JoinNumber, (b) => Press(_port.IrFileCommands[index], b));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
joinMap.PrintJoinMapInfo();
|
||||||
|
|
||||||
if (bridge != null)
|
if (bridge != null)
|
||||||
{
|
{
|
||||||
bridge.AddJoinMap(Key, joinMap);
|
bridge.AddJoinMap(Key, joinMap);
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
DeviceConfig config)
|
DeviceConfig config)
|
||||||
: base(key)
|
: base(key)
|
||||||
{
|
{
|
||||||
|
DriverLoaded = new BoolFeedback(() => DriverIsLoaded);
|
||||||
AddPostActivationAction(() =>
|
AddPostActivationAction(() =>
|
||||||
{
|
{
|
||||||
IrPort = postActivationFunc(config);
|
IrPort = postActivationFunc(config);
|
||||||
@@ -63,7 +64,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
var filePath = Global.FilePathPrefix + "ir" + Global.DirectorySeparator + config.Properties["control"]["irFile"].Value<string>();
|
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);
|
LoadDriver(filePath);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user