Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
function Encode(fPort, obj) 
{
    var encoded = [];

    if ("Valve_Position_RCI_10_minutes" in obj) 
    {
        var new_vp_10min = obj.Valve_Position_RCI_10_minutes;
        encoded = [new_vp_10min,0x00,0x26,0x00,0x00,0x00];
    }
	
    if ("Valve_Position_RCI_5_minutes" in obj) 
    {
        var new_vp_5min = obj.Valve_Position_RCI_5_minutes;
        encoded = [new_vp_5min,0x00,0x26,0x10,0x00,0x00];
    }
	
    if ("Set_Point_Ambient_Temperature_RCI_10_Minutes" in obj)
    {
        var new_spt_10min = (obj.Set_Point_Ambient_Temperature_RCI_10_Minutes)*2;
        encoded = [new_spt_10min,0x00,0x26,0x08,0x00,0x00];
    }

    if ("Set_Point_Ambient_Temperature_RCI_5_Minutes" in obj)
    {
        var new_spt_5min = (obj.Set_Point_Ambient_Temperature_RCI_5_Minutes)*2;
        encoded = [new_spt_5min,0x00,0x26,0x18,0x00,0x00];
    }	

    return encoded;
}

Downlink example

Code Block
languagejson
{"Set_Point_Ambient_Temperature_RCI_10_Minutes":22}
{"Set_Point_Ambient_Temperature_RCI_5_Minutes":20}

{"Valve_Position_RCI_10_minutes":73}
{"Valve_Position_RCI_5_minutes":42}

Image ModifiedImage ModifiedImage Modified