Skip to content

Commit

Permalink
Correct ECMC_PREV_PLG_P pointer reference
Browse files Browse the repository at this point in the history
Corrects the ECMC_PREV_PLG_P pointer reference of loadPlugin.cmd.

Also sneaks in a number of corrections to commentaries related to
ecmcXXXPrevXXX.db and the auto gui generation in the
scripts/loadXXX.cmd and scripts/addXXX.cmd files.
  • Loading branch information
Markus Kristensson committed Aug 8, 2023
1 parent 125a05c commit 8345b1c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions db/core/ecmcPlcPrevPlc.db
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# This record is already initialized by the previous call to addAxis.cmd
# Used to make a "pointer" between the axes objects to be used to autoconfigure GUI
# This record is already initialized by the previous call to loadPLCFile.cmd
# Used to make a "pointer" between the PLC objects to be used to autoconfigure GUI
# This db is only used to set the VAL field
record(ao,"$(PREV_ECMC_P)NxtObjId") {
field(VAL, "$(NEXT_OBJ_ID=-1)")
Expand Down
2 changes: 1 addition & 1 deletion db/core/ecmcPlgPrevPlg.db
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# This record is already initialized by the previous call to addAxis.cmd
# This record is already initialized by the previous call to loadPlugin.cmd
# Used to make a "pointer" between the plugin objects to be used to autoconfigure GUI
# This db is only used to set the VAL field
record(ao,"$(PREV_ECMC_P)NxtObjId") {
Expand Down
6 changes: 3 additions & 3 deletions scripts/addDataStorage.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ dbLoadTemplate(${SUBST_FILE="ecmcDS.substitutions"}, "P=${ECMC_PREFIX}, PORT=${E
epicsEnvUnset(ECMC_DS_ID_2_CHARS)

#- Below for facilitate auto gui generation
# Do not set NxtObj "pointer" if this is the first axis (ECMC_PREV_DS_OBJ_ID==-1)
# Do not set NxtObj "pointer" if this is the first dataStorage (ECMC_PREV_DS_OBJ_ID==-1)
ecmcEpicsEnvSetCalcTernary(ECMC_EXE_NEXT_DS,"${ECMC_PREV_DS_OBJ_ID=-1}>=0", "","#- ")
${ECMC_EXE_NEXT_DS}ecmcFileExist(ecmcDsPrevDs.db,1,1)
${ECMC_EXE_NEXT_DS}dbLoadRecords(ecmcDsPrevDs.db,"NEXT_OBJ_ID=${DS_ID=-1},PREV_ECMC_P=${ECMC_PREV_DS_P=""}")
epicsEnvUnset(ECMC_EXE_NEXT_DS)

#- If this is the first added slave then store value in P:MCU-Cfg-AX-FrstObj
#- If this is the first added dataStorage then store value in P:MCU-Cfg-AX-FrstObjId
ecmcEpicsEnvSetCalcTernary(ECMC_EXE_FIRST_DS,"${ECMC_PREV_DS_OBJ_ID=-1}<0", "","#- ")
${ECMC_EXE_FIRST_DS}ecmcFileExist(ecmcDsFirstDs.db,1,1)
${ECMC_EXE_FIRST_DS}dbLoadRecords(ecmcDsFirstDs.db,"P=${ECMC_PREFIX},FIRST_OBJ_ID=${DS_ID}")
epicsEnvUnset(ECMC_EXE_FIRST_DS)

#- Store info to populate the ECMC_P-NxtObj "pointer" of next added axis
#- Store info to populate the ECMC_P-NxtObj "pointer" of next added dataStorage
epicsEnvSet(ECMC_PREV_DS_P,"$(ECMC_PREFIX)MCU-Cfg-DS${DS_ID}-")
epicsEnvSet(ECMC_PREV_DS_OBJ_ID,${DS_ID})

2 changes: 1 addition & 1 deletion scripts/addSlave.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ecmcEpicsEnvSetCalcTernary(ECMC_EXE_NEXT_SLV,"${ECMC_EC_PREV_SLAVE_NUM=-1}>=0",
${ECMC_EXE_NEXT_SLV}dbLoadRecords(ecmcEcPrevSlave.db,"NEXT_SLAVE_ID=${ECMC_EC_SLAVE_NUM=-1},PREV_ECMC_P=${ECMC_PREV_ECMC_P=""}")
epicsEnvUnset(ECMC_EXE_NEXT_SLV)

#- If this is the first added slave then store value in P:MCU-Cfg-EC-FrstObj
#- If this is the first added slave then store value in P:MCU-Cfg-EC-FrstObjId
ecmcEpicsEnvSetCalcTernary(ECMC_EXE_FIRST_SLAVE,"${ECMC_EC_PREV_SLAVE_NUM=-1}<0", "","#- ")
#- Next slave of the previous slave is this slave
${ECMC_EXE_FIRST_SLAVE}dbLoadRecords(ecmcEcFirstSlave.db,"P=${ECMC_PREFIX},FIRST_SLAVE_ID=${ECMC_EC_SLAVE_NUM}")
Expand Down
6 changes: 3 additions & 3 deletions scripts/loadPLCFile.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ dbLoadTemplate(${SUBST_FILE="ecmcPlc.substitutions"}, "PORT=${ECMC_ASYN_PORT},A=
epicsEnvUnset(ECMC_PLC_ID_2_CHARS)

#- Below for facilitate auto gui generation
# Do not set NxtObj "pointer" if this is the first axis (ECMC_PREV_PLC_OBJ_ID==-1)
# Do not set NxtObj "pointer" if this is the first PLC (ECMC_PREV_PLC_OBJ_ID==-1)
ecmcEpicsEnvSetCalcTernary(ECMC_EXE_NEXT_PLC,"${ECMC_PREV_PLC_OBJ_ID=-1}>=0", "","#- ")
${ECMC_EXE_NEXT_PLC}ecmcFileExist(ecmcPlcPrevPlc.db,1,1)
${ECMC_EXE_NEXT_PLC}dbLoadRecords(ecmcPlcPrevPlc.db,"NEXT_OBJ_ID=${ECMC_PLC_ID=-1},PREV_ECMC_P=${ECMC_PREV_PLC_P=""}")
epicsEnvUnset(ECMC_EXE_NEXT_PLC)

#- If this is the first added slave then store value in P:MCU-Cfg-AX-FrstObj
#- If this is the first added PLC then store value in P:MCU-Cfg-PLC-FrstObjId
ecmcEpicsEnvSetCalcTernary(ECMC_EXE_FIRST_PLC,"${ECMC_PREV_PLC_OBJ_ID=-1}<0", "","#- ")
${ECMC_EXE_FIRST_PLC}ecmcFileExist(ecmcPlcFirstPlc.db,1,1)
${ECMC_EXE_FIRST_PLC}dbLoadRecords(ecmcPlcFirstPlc.db,"P=${ECMC_PREFIX},FIRST_OBJ_ID=${ECMC_PLC_ID}")
epicsEnvUnset(ECMC_EXE_FIRST_PLC)

#- Store info to populate the ECMC_P-NxtObj "pointer" of next added axis
#- Store info to populate the ECMC_P-NxtObj "pointer" of next added PLC
epicsEnvSet(ECMC_PREV_PLC_P,"$(ECMC_PREFIX)MCU-Cfg-PLC${ECMC_PLC_ID}-")
epicsEnvSet(ECMC_PREV_PLC_OBJ_ID,${ECMC_PLC_ID})

10 changes: 5 additions & 5 deletions scripts/loadPlugin.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#- Arguments: FILE, PLUGIN_ID, [CONFIG], [REPORT]

#-d /**
#-d \brief Script for loading a ecmc pluginfrom file.
#-d \brief Script for loading a ecmc plugin from file.
#-d \author Anders Sandström
#-d \file
#-d \param FILE Filename of plugin shared lib (./ecmcPlugin_Advanced.so)
Expand All @@ -26,18 +26,18 @@ epicsEnvUnset(ECMC_PLUGIN_REPORT);
ecmcFileExist(ecmcPlg.template,1,1)
dbLoadRecords(ecmcPlg.template, "P=${ECMC_PREFIX},Index=${PLUGIN_ID}")

# Do not set NxtObj "pointer" if this is the first axis (ECMC_PREV_PLG_OBJ_ID==-1)
# Do not set NxtObj "pointer" if this is the first plugin (ECMC_PREV_PLG_OBJ_ID==-1)
ecmcEpicsEnvSetCalcTernary(ECMC_EXE_NEXT_PLG,"${ECMC_PREV_PLG_OBJ_ID=-1}>=0", "","#- ")
${ECMC_EXE_NEXT_PLG}ecmcFileExist(ecmcPlgPrevPlg.db,1,1)
${ECMC_EXE_NEXT_PLG}dbLoadRecords(ecmcPlgPrevPlg.db,"NEXT_OBJ_ID=${PLUGIN_ID=-1},PREV_ECMC_P=${ECMC_PREV_PLG_P=""}")
epicsEnvUnset(ECMC_EXE_NEXT_PLG)

#- If this is the first added slave then store value in P:MCU-Cfg-AX-FrstObj
#- If this is the first added plugin then store value in P:MCU-Cfg-PLG-FrstObjId
ecmcEpicsEnvSetCalcTernary(ECMC_EXE_FIRST_PLG,"${ECMC_PREV_PLG_OBJ_ID=-1}<0", "","#- ")
${ECMC_EXE_FIRST_PLG}ecmcFileExist(ecmcPlgFirstplg.db,1,1)
${ECMC_EXE_FIRST_PLG}dbLoadRecords(ecmcPlgFirstplg.db,"P=${ECMC_PREFIX},FIRST_OBJ_ID=${PLUGIN_ID}")
epicsEnvUnset(ECMC_EXE_FIRST_PLG)

#- Store info to populate the ECMC_P-NxtObj "pointer" of next added axis
epicsEnvSet(ECMC_PREV_PLG_P,"$(ECMC_PREFIX)MCU-Cfg-DS${PLUGIN_ID}-")
#- Store info to populate the ECMC_P-NxtObj "pointer" of next added plugin
epicsEnvSet(ECMC_PREV_PLG_P,"$(ECMC_PREFIX)MCU-Cfg-PLG${PLUGIN_ID}-")
epicsEnvSet(ECMC_PREV_PLG_OBJ_ID,${PLUGIN_ID})

0 comments on commit 8345b1c

Please sign in to comment.