mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-05 15:55:02 +00:00
move load file to end of postactivation action
and change to use the IrPortController's loadFile method add printing of available IR Commands in the loaded file.
This commit is contained in:
@@ -134,12 +134,9 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
var port = irDev.IROutputPorts[portNum];
|
||||
|
||||
var filePath = Global.FilePathPrefix + "ir" + Global.DirectorySeparator + control["irFile"].Value<string>();
|
||||
Debug.Console(1, "*************Attemting to load IR file: {0}***************", filePath);
|
||||
port.LoadIRDriver(filePath);
|
||||
|
||||
|
||||
return port;
|
||||
|
||||
}
|
||||
|
||||
public static IrOutputPortController GetIrOutputPortController(DeviceConfig config)
|
||||
|
||||
@@ -49,9 +49,22 @@ namespace PepperDash.Essentials.Core
|
||||
AddPostActivationAction(() =>
|
||||
{
|
||||
IrPort = postActivationFunc(config);
|
||||
if (IrPort != null)
|
||||
|
||||
if (IrPort == null)
|
||||
{
|
||||
DriverIsLoaded = true;
|
||||
Debug.Console(0, this, "WARNING No valid IR Port assigned to controller. IR will not function");
|
||||
return;
|
||||
}
|
||||
|
||||
var filePath = Global.FilePathPrefix + "ir" + Global.DirectorySeparator + config.Properties["control"]["irFile"].Value<string>();
|
||||
Debug.Console(1, "*************Attemting to load IR file: {0}***************", filePath);
|
||||
|
||||
LoadDriver(filePath);
|
||||
|
||||
Debug.Console(2, this, "Available IR Commands in IR File {0}",IrPortUid);
|
||||
foreach (var cmd in IrPort.AvailableIRCmds())
|
||||
{
|
||||
Debug.Console(2, this, "{0}", cmd);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -64,14 +77,15 @@ namespace PepperDash.Essentials.Core
|
||||
/// <param name="path"></param>
|
||||
public void LoadDriver(string path)
|
||||
{
|
||||
Debug.Console(2, this, "***Loading IR File***");
|
||||
if (string.IsNullOrEmpty(path)) path = DriverFilepath;
|
||||
try
|
||||
{
|
||||
IrPortUid = IrPort.LoadIRDriver(path);
|
||||
DriverFilepath = path;
|
||||
StandardIrPulseTime = 200;
|
||||
DriverIsLoaded = true;
|
||||
}
|
||||
try
|
||||
{
|
||||
IrPortUid = IrPort.LoadIRDriver(path);
|
||||
DriverFilepath = path;
|
||||
StandardIrPulseTime = 200;
|
||||
DriverIsLoaded = true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
DriverIsLoaded = false;
|
||||
|
||||
Reference in New Issue
Block a user