diff --git a/lcls-twincat-motion/Library/Library.plcproj b/lcls-twincat-motion/Library/Library.plcproj
index 20dde9f..9429903 100644
--- a/lcls-twincat-motion/Library/Library.plcproj
+++ b/lcls-twincat-motion/Library/Library.plcproj
@@ -631,6 +631,10 @@
Tc2_Utilities, * (Beckhoff Automation GmbH)
Tc2_Utilities
+
+ Tc3_IPCDiag, * (Beckhoff Automation GmbH)
+ Tc3_IPCDiag
+
Tc3_JsonXml, * (Beckhoff Automation GmbH)
Tc3_JsonXml
diff --git a/lcls-twincat-motion/Library/POUs/Motion/PMPS/FB_Standard_PMPSDB.TcPOU b/lcls-twincat-motion/Library/POUs/Motion/PMPS/FB_Standard_PMPSDB.TcPOU
index 06d04dd..0b0190e 100644
--- a/lcls-twincat-motion/Library/POUs/Motion/PMPS/FB_Standard_PMPSDB.TcPOU
+++ b/lcls-twincat-motion/Library/POUs/Motion/PMPS/FB_Standard_PMPSDB.TcPOU
@@ -22,7 +22,7 @@ VAR_INPUT
// Set to TRUE to cause an extra read.
bRefresh: BOOL;
// Directory where the DB is stored.
- sDirectory: STRING := '/Hard Disk/ftp/PMPS/';
+ sDirectory: STRING := '';
END_VAR
VAR_OUTPUT
{attribute 'pytmc' := '
@@ -42,6 +42,10 @@ VAR
fbTime : FB_LocalSystemTime := ( bEnable := TRUE, dwCycle := 1 );
fbTime_to_UTC: FB_TzSpecificLocalTimeToSystemTime;
fbGetTimeZone: FB_GetTimeZoneInformation;
+
+ fbIPCReg: FB_IPCDiag_Register;
+ fbCheckOS: FB_IPCDiag_ReadParameter;
+ sOSName: STRING;
END_VAR
]]>
@@ -62,9 +66,30 @@ IF rtEnable.Q OR rtRefresh.Q THEN
bExecute := TRUE;
END_IF
+IF sDirectory = '' THEN
+ // Check OS for default directory
+ fbIPCReg(bExecute:=TRUE);
+ fbCheckOS(
+ bExecute:=NOT fbIPCReg.bBusy,
+ eParameterKey:=E_IPCDiag_ParameterKey.OS_Name,
+ fbRegister:=fbIPCReg,
+ );
+ IF fbCheckOS.bValid THEN
+ fbCheckOS.GetParameter(
+ pBuffer:=ADR(sOSName),
+ nBufferSize:=SIZEOF(sOSName),
+ );
+ END_IF
+ IF sOSName = 'TwinCAT/BSD' THEN
+ sDirectory := '/home/ecs-user/pmpsdb/';
+ ELSIF sOSName <> '' THEN
+ sDirectory := '/Hard Disk/ftp/PMPS/';
+ END_IF
+END_IF
+
MOTION_GVL.fbPmpsFileReader(
io_fbFFHWO:=io_fbFFHWO,
- bExecute:=bExecute,
+ bExecute:=bExecute AND sDirectory <> '',
sSrcPathName:=CONCAT(CONCAT(sDirectory, sPlcName), '.json'),
sPLCName:=sPLCName,
PMPS_jsonDoc=>PMPS_GVL.BP_jsonDoc,