From 9f40a89bae943094848430360ff81ac26c2442b2 Mon Sep 17 00:00:00 2001 From: soederqvist_a Date: Thu, 2 Apr 2026 13:26:44 +0200 Subject: [PATCH 1/2] PlugNPLay: autoconnect with disconnectOnReadtimeout working --- db/epluse.db | 9 +++++++++ db/epluse.proto | 9 ++++++--- epluse.cmd | 8 ++++++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/db/epluse.db b/db/epluse.db index 48fc690..17b260d 100644 --- a/db/epluse.db +++ b/db/epluse.db @@ -18,3 +18,12 @@ record(ai, "$(PREFIX):RELHUM") field(EGU, "%RH") } +record(asyn,"$(PREFIX):ASYN") +{ + field(DTYP,"asynRecordDevice") + field(PORT,"$(PORT)") + field(ADDR,"-1") + field(TMOD, "NoI/O") + field(TMOT, -1.0) +} + diff --git a/db/epluse.proto b/db/epluse.proto index cbd26ac..cd2987c 100644 --- a/db/epluse.proto +++ b/db/epluse.proto @@ -3,8 +3,11 @@ Terminator = ''; ReplyTimeout = 3000; +LockTimeout = 5000; +ReadTimeout = 2000; +MaxInput = 15; # Remove if we can fix the occasional null byte being sent -ExtraInput = Ignore +#ExtraInput = Ignore; # unsolicited weight message fetch_rht { @@ -12,7 +15,7 @@ fetch_rht { # 3rd byte is command, fetch rht values # 4th byte length of message, 2 bytes # 5th and 6th byte, data. For this case it is 1 - + out 0x00 0x00 0x67 0x02 0x00 0x01 0x6a; # First 2 bytes is address # 0xca8b is the unit at neutra @@ -27,5 +30,5 @@ fetch_rht { # I try to handle this with with ?*c command, but it doesn't work # Possibly check with Dirk sometime how to make this work, if possible # For now ignore extra data - in 0xca 0x8b 0x67 0x0A 0x06 0x00 "%(\$1:TEMP)#R%(\$1:RELHUM)#R%*c%*?1c"; + in 0xca 0x8b 0x67 0x0A 0x06 0x00 "%(\$1:TEMP)#R%(\$1:RELHUM)#R%"; } diff --git a/epluse.cmd b/epluse.cmd index 7783872..91927e4 100644 --- a/epluse.cmd +++ b/epluse.cmd @@ -7,6 +7,10 @@ require stream epicsEnvSet("PROTO", "$(epluse_DB)epluse.proto") -drvAsynIPPortConfigure("$(INSTR)-sps", "$(MOXA_ADDR)",0,0,0) +### We have autoconnect and disconnectOnReadTimeout enabled, so that it can come and go +## without generating too much noise. We detect connected state via asyn record .CNCT +# drvAsynIPPortConfigure(portName, hostInfo, priority, noAutoConnect, noProcessEos) +drvAsynIPPortConfigure("$(INSTR)-epluse", "$(MOXA_ADDR)",0,0,0) +asynSetOption("$(INSTR)-epluse", -1, "disconnectOnReadTimeout", "Y") -dbLoadRecords("$(epluse_DB)epluse.db", "PREFIX=SQ:$(INSTR), PROTO=$(PROTO), PORT=$(INSTR)-sps") +dbLoadRecords("$(epluse_DB)epluse.db", "PREFIX=SQ:$(INSTR), PROTO=$(PROTO), PORT=$(INSTR)-epluse") -- 2.52.0 From 3d40f435408d321e57bb2089366f3032e4c3903d Mon Sep 17 00:00:00 2001 From: soederqvist_a Date: Thu, 16 Apr 2026 08:24:39 +0200 Subject: [PATCH 2/2] Status propagation and checksum --- db/epluse.db | 15 ++++++++++++--- db/epluse.proto | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/db/epluse.db b/db/epluse.db index 17b260d..23c396d 100644 --- a/db/epluse.db +++ b/db/epluse.db @@ -1,20 +1,29 @@ -record(bo, "$(PREFIX):FETCH") +record(calcout, "$(PREFIX):FETCH") { field(DTYP, "stream") field(DESC, "Initialization parameters") - field(OUT,"@$(PROTO) fetch_rht($(PREFIX)) $(PORT) 0") - field(SCAN,"1 second") + field(CALC, "0") + field(OUT, "@$(PROTO) fetch_rht($(PREFIX)) $(PORT) 0") + field(SCAN, "1 second") + field(FLNK, "$(PREFIX):FANOUT") +} + +record(fanout, "$(PREFIX):FANOUT") { + field(LNK1, "$(PREFIX):TEMP") + field(LNK2, "$(PREFIX):RELHUM") } record(ai, "$(PREFIX):TEMP") { field(DESC, "Temperature") + field(INP, "$(PREFIX):FETCH.A NPP MS") field(EGU, "degC") } record(ai, "$(PREFIX):RELHUM") { field(DESC, "Relative Humidity") + field(INP, "$(PREFIX):FETCH.B NPP MS") field(EGU, "%RH") } diff --git a/db/epluse.proto b/db/epluse.proto index cd2987c..2cb901d 100644 --- a/db/epluse.proto +++ b/db/epluse.proto @@ -30,5 +30,5 @@ fetch_rht { # I try to handle this with with ?*c command, but it doesn't work # Possibly check with Dirk sometime how to make this work, if possible # For now ignore extra data - in 0xca 0x8b 0x67 0x0A 0x06 0x00 "%(\$1:TEMP)#R%(\$1:RELHUM)#R%"; + in 0xca 0x8b 0x67 0x0A 0x06 0x00 "%(A)#R%(B)#R%"; } -- 2.52.0