Skip to content

Commit

Permalink
fix: adds in compiler directive for 3-series support and removes TX/R…
Browse files Browse the repository at this point in the history
…X console print messages
  • Loading branch information
ndorin committed Jun 28, 2024
1 parent 8395a55 commit 8378321
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 6 deletions.
32 changes: 28 additions & 4 deletions src/TesiraDsp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@

namespace Tesira_DSP_EPI
{
public class TesiraDsp : EssentialsBridgeableDevice, IDspPresets, ICommunicationMonitor, IDeviceInfoProvider
public class TesiraDsp : EssentialsBridgeableDevice,
#if SERIES4
IDspPresets,
#else
IHasDspPresets,
#endif
ICommunicationMonitor,
IDeviceInfoProvider
{
/// <summary>
/// Collection of all Device Feedbacks
Expand Down Expand Up @@ -96,10 +103,15 @@ public bool IsSubscribed {
private Dictionary<string, TesiraDspMeter> Meters { get; set; }
private Dictionary<string, TesiraDspCrosspointState> CrosspointStates { get; set; }
private Dictionary<string, TesiraDspRoomCombiner> RoomCombiners { get; set; }
public Dictionary<string, IKeyName> Presets { get; private set; }
public List<TesiraPreset> TesiraPresets { get; private set; }
private List<ISubscribedComponent> ControlPointList { get; set; }

#if SERIES4
public Dictionary<string, IKeyName> Presets { get; private set; }
#else
public List<IDspPreset> Presets { get; private set; }
#endif

private TesiraExpanderTracker ExpanderTracker { get; set; }

private bool _initalSubscription = true;
Expand Down Expand Up @@ -688,7 +700,7 @@ public void SendLine(string s)
if (string.IsNullOrEmpty(s))
return;

Debug.Console(1, this, "TX: '{0}'", s);
//Debug.Console(1, this, "TX: '{0}'", s);

Communication.SendText(s + "\x0D");
}
Expand Down Expand Up @@ -721,7 +733,7 @@ private void Port_LineReceived(object dev, GenericCommMethodReceiveTextArgs args
try
{

Debug.Console(1, this, "RX: '{0}'", ShowHexResponse ? ComTextHelper.GetEscapedText(args.Text) : args.Text);
//Debug.Console(1, this, "RX: '{0}'", ShowHexResponse ? ComTextHelper.GetEscapedText(args.Text) : args.Text);

DeviceRx = args.Text;

Expand Down Expand Up @@ -858,6 +870,8 @@ public void RunPreset(int id)
//CommandQueue.EnqueueCommand(string.Format("DEVICE recallPreset {0}", id));
}


#if SERIES4
public void RecallPreset(string key)
{
var preset = Presets[key] as TesiraPreset;
Expand All @@ -881,6 +895,16 @@ public void RecallPreset(string key)
RunPreset(preset.PresetData.PresetId);
}
}
#else
public void RecallPreset(IDspPreset preset)
{
if (preset == null) return;

Debug.Console(2, this, "Running preset {0}", preset.Name);

RunPreset(preset.Name);
}
#endif

#endregion

Expand Down
23 changes: 21 additions & 2 deletions src/TesiraDspPreset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@

namespace Tesira_DSP_EPI
{
public class TesiraDspPresetDevice : TesiraDspControlPoint, IDspPresets
public class TesiraDspPresetDevice : TesiraDspControlPoint,
#if SERIES4
IDspPresets
#else
IHasDspPresets
#endif
{
private const string KeyFormatter = "{0}--{1}";

Expand All @@ -24,8 +29,11 @@ public TesiraDspPresetDevice(TesiraDsp parent)

#region IHasDspPresets Members

#if SERIES4
public Dictionary<string, IKeyName> Presets { get; private set; }

#else
public List<IDspPreset> Presets { get; set; }
#endif

#endregion

Expand Down Expand Up @@ -115,10 +123,21 @@ public void RunPreset(int id)
//CommandQueue.EnqueueCommand(string.Format("DEVICE recallPreset {0}", id));
}


#if SERIES4
public void RecallPreset(string key)
{
Parent.RecallPreset(key);
}
#else
public void RecallPreset(IDspPreset preset)
{
Parent.RecallPreset(preset);
}
#endif




#endregion

Expand Down

0 comments on commit 8378321

Please sign in to comment.