Merged in feature/pdc-34 (pull request #37)

Feature/pdc 34

Approved-by: Neil Dorin <ndorin@pepperdash.com>
This commit is contained in:
Trevor Payne
2019-11-13 20:11:50 +00:00
committed by Neil Dorin

View File

@@ -137,15 +137,14 @@ namespace PepperDash.Core.JsonToSimpl
// OnBoolChange(false, index, JsonToSimplConstants.BoolValueChange); // OnBoolChange(false, index, JsonToSimplConstants.BoolValueChange);
} }
// Processes the path to a ushort, converting to ushort if able, firing off UshrtChange event // Processes the path to a ushort, converting to ushort if able, twos complement if necessary, firing off UshrtChange event
void ProcessUshortPath(ushort index) void ProcessUshortPath(ushort index) {
{
string response; string response;
if (Process(UshortPaths[index], out response)) if (Process(UshortPaths[index], out response)) {
{
ushort val; ushort val;
try { val = Convert.ToUInt16(response); } try { val = Convert.ToInt32(response) < 0 ? (ushort)(Convert.ToInt16(response) + 65536) : Convert.ToUInt16(response); }
catch { val = 0; } catch { val = 0; }
OnUShortChange(val, index, JsonToSimplConstants.UshortValueChange); OnUShortChange(val, index, JsonToSimplConstants.UshortValueChange);
} }
else { } else { }