I'm hoping you will put out a version that can read the analog input values. I have temperature sensors on my Secu16 and read them with a script. I had this working since last year in a modified version of the open source by exposing GetAnalogInput. I believe I had to modify something from Int16 to Int32 to prevent errors in the plugin.
I purchased a license since you had done so much work on the plugin. I had figured out the poll thread processor usage issue, gBusy not declared, the send_IR and the analog inputs, but you already had the PED issue worked out and did a lot more with the plugin.
I use a script like this which worked fine.
sub main
dim v
v = hs.PluginFunction("Applied Digital Ocelot", "", "GetAnalogInput", array(2,0))
if v>10 and v<250 then hs.setdevicevalue "T1",round(100*v/256,1)
End sub
The plugin code I'm sure you have looks like this.
Public Function GetAnalogInput(ByRef unit As Short, ByRef point As Short) As Short
'Dim snd(7) As Byte
Dim i As Short
Dim rcv(6) As Byte
Dim buf(256) As Byte
On Error Resume Next
If Not gIOEnabled Then Exit Function
gbusy = 1
SendToCPUXA(FrameGenerator.InitiateGetUnitParameters(point + 10))
WaitForChar(gTimeOut, 3, 0)
Wait(1)
gbusy = 1
SendToCPUXA(FrameGenerator.GetUnitParameters)
If (WaitForChar(gTimeOut, 6 + 256 + 2, 42)) Then
For i = 0 To 5
rcv(i) = rbuffer(i)
Next
For i = 0 To 255
buf(i) = rbuffer(i + 6)
Next
Status = ERR_NONE
Else
If gLogErrors Then
hs.WriteLog(IFACE_OTHER, "Warning, Ocelot Plug-in, Timeout getting analog I/O")
End If
Status = ERR_SEND
End If
gbusy = 0
GetAnalogInput = buf((unit - 1) * 2)
End Function
I purchased a license since you had done so much work on the plugin. I had figured out the poll thread processor usage issue, gBusy not declared, the send_IR and the analog inputs, but you already had the PED issue worked out and did a lot more with the plugin.
I use a script like this which worked fine.
sub main
dim v
v = hs.PluginFunction("Applied Digital Ocelot", "", "GetAnalogInput", array(2,0))
if v>10 and v<250 then hs.setdevicevalue "T1",round(100*v/256,1)
End sub
The plugin code I'm sure you have looks like this.
Public Function GetAnalogInput(ByRef unit As Short, ByRef point As Short) As Short
'Dim snd(7) As Byte
Dim i As Short
Dim rcv(6) As Byte
Dim buf(256) As Byte
On Error Resume Next
If Not gIOEnabled Then Exit Function
gbusy = 1
SendToCPUXA(FrameGenerator.InitiateGetUnitParameters(point + 10))
WaitForChar(gTimeOut, 3, 0)
Wait(1)
gbusy = 1
SendToCPUXA(FrameGenerator.GetUnitParameters)
If (WaitForChar(gTimeOut, 6 + 256 + 2, 42)) Then
For i = 0 To 5
rcv(i) = rbuffer(i)
Next
For i = 0 To 255
buf(i) = rbuffer(i + 6)
Next
Status = ERR_NONE
Else
If gLogErrors Then
hs.WriteLog(IFACE_OTHER, "Warning, Ocelot Plug-in, Timeout getting analog I/O")
End If
Status = ERR_SEND
End If
gbusy = 0
GetAnalogInput = buf((unit - 1) * 2)
End Function
Comment