Skip to content

Commit

Permalink
fix: implemented lamp hour polling and feedback ([LSHS?])
Browse files Browse the repository at this point in the history
  • Loading branch information
jkdevito committed Aug 8, 2022
1 parent 3a8dac1 commit f469f05
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
14 changes: 14 additions & 0 deletions epi-barco-g60/BarcoG60BridgeJoinMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,20 @@ public class BarcoG60BridgeJoinMap : DisplayControllerJoinMap
// JoinType = eJoinType.Analog
// });

[JoinName("LampHours")]
public JoinDataComplete LampHours = new JoinDataComplete(
new JoinData
{
JoinNumber = 6,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Reports current lamp hours",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Analog
});

#endregion


Expand Down
45 changes: 44 additions & 1 deletion epi-barco-g60/BarcoG60Device.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public BarcoG60Controller(string key, string name, BarcoG60PropertiesConfig conf

ResetDebugLevels();

LampHoursFeedback = new IntFeedback(() => LampHours);

Communication = comms;

_receiveQueue = new GenericQueue(key + "-queue");
Expand Down Expand Up @@ -161,6 +163,9 @@ public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, E
CurrentInputFeedback.OutputChange +=
(sender, args) => Debug.Console(DebugNotice, this, "CurrentInputFeedback: {0}", args.StringValue);

// lamp hours feeback
LampHoursFeedback.LinkInputSig(trilist.UShortInput[joinMap.LampHours.JoinNumber]);


// bridge online change
trilist.OnlineStatusChange += (sender, args) =>
Expand All @@ -183,6 +188,8 @@ public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, E
var inputIndex = i;
InputFeedback[inputIndex].FireUpdate();
}
LampHoursFeedback.FireUpdate();
};
}

Expand Down Expand Up @@ -276,6 +283,12 @@ private void ProcessResponse(string response)

Debug.Console(DebugNotice, this, "ProcessResponse: {0}", response);

if (!response.Contains("!") || response.Contains("ERR"))
{
Debug.Console(DebugVerbose, this, "ProcessResponse: '{0}' is not tracked", response);
return;
}

var responseData = response.Trim('[').Split('!');
var responseType = string.IsNullOrEmpty(responseData[0]) ? "" : responseData[0];
var responseValue = string.IsNullOrEmpty(responseData[1]) ? "" : responseData[1];
Expand Down Expand Up @@ -311,7 +324,7 @@ private void ProcessResponse(string response)
}
case "LSHS":
{
Debug.Console(DebugVerbose, this, "ProcessRespopnse: light source response '{0}' not tracked", responseType);
LampHours = Convert.ToInt16(responseValue);
break;
}
default:
Expand Down Expand Up @@ -863,10 +876,40 @@ public void StatusGet()
PowerGet();
CrestronEnvironment.Sleep(2000);
InputGet();
CrestronEnvironment.Sleep(2000);
LampGet();
});
}


/// <summary>
/// Lamp hours feedback
/// </summary>
public IntFeedback LampHoursFeedback { get; set; }

private int _lampHours;

/// <summary>
/// Lamp hours property
/// </summary>
public int LampHours
{
get { return _lampHours; }
set
{
_lampHours = value;
LampHoursFeedback.FireUpdate();
}
}

/// <summary>
/// Polls for lamp hours/laser runtime
/// </summary>
public void LampGet()
{
SendText("LSHS", "?");
}


#region DebugLevels

Expand Down

0 comments on commit f469f05

Please sign in to comment.