Skip to content

Commit e284fbe

Browse files
Release 3.2.0 (#8)
# Release 3.2.0 ## New features - New function to edit amount of extra bytes to add to process data byte length ## Improvements - FlowConfig handling
1 parent e2919b5 commit e284fbe

12 files changed

Lines changed: 582 additions & 435 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## Release 3.2.0
5+
6+
### New features
7+
- New function to edit amount of extra bytes to add to process data byte length
8+
9+
### Improvements
10+
- FlowConfig handling
11+
412
## Release 3.1.0
513

614
### New features

CSK_Module_MultiIOLinkSMI/pages/pages/CSK_Module_MultiIOLinkSMI/CSK_Module_MultiIOLinkSMI.html

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,16 +1515,48 @@ <h6 id="H61_SavedDeviceIdentification">
15151515
style="align-items: center">
15161516
<layout-column id="ColumnLayout32"
15171517
style="align-items: stretch; flex-grow: 4">
1518-
<davinci-value-display id="VD_WriteStatus"
1519-
value="Status:">
1520-
</davinci-value-display>
1521-
<davinci-value-display
1522-
id="VD_LatestTestCommandStatus2"
1523-
value="-">
1524-
<crown-on property="value"
1525-
crown-event="CSK_MultiIOLinkSMI/OnNewTestCommandState">
1526-
</crown-on>
1527-
</davinci-value-display>
1518+
<layout-row id="RowLayout90">
1519+
<layout-column id="ColumnLayout90"
1520+
style="align-items: stretch">
1521+
<davinci-value-display
1522+
id="VD_WriteStatus"
1523+
value="Status">
1524+
</davinci-value-display>
1525+
<davinci-value-display
1526+
id="VD_LatestTestCommandStatus2"
1527+
value="-">
1528+
<crown-on property="value"
1529+
crown-event="CSK_MultiIOLinkSMI/OnNewTestCommandState">
1530+
</crown-on>
1531+
</davinci-value-display>
1532+
</layout-column>
1533+
<layout-column id="ColumnLayout92"
1534+
style="align-items: stretch">
1535+
<davinci-value-display
1536+
id="VD_ExtraBytes"
1537+
value="Extra byte length"
1538+
title="Amount of extra bytes to add to PDLength of output process data.">
1539+
</davinci-value-display>
1540+
<davinci-numeric-field
1541+
id="NF_ExtraByteLength"
1542+
type="outline" min="0" max="20"
1543+
ticks="1" group-separator=","
1544+
decimal-separator="."
1545+
format-pattern="0"
1546+
title="Amount of extra bytes to add to PDLength of output process data.">
1547+
<crown-edpws-binding
1548+
property="value"
1549+
name="CSK_MultiIOLinkSMI/OnNewProcessDataExtraByteLength"
1550+
update-on-resume>
1551+
</crown-edpws-binding>
1552+
<crown-binding event="change"
1553+
name="CSK_MultiIOLinkSMI/setProcessDataExtraByteLength"
1554+
path="param/args/extraBytes"
1555+
auto-commit>
1556+
</crown-binding>
1557+
</davinci-numeric-field>
1558+
</layout-column>
1559+
</layout-row>
15281560
</layout-column>
15291561
<layout-column id="ColumnLayout35"
15301562
style="align-items: stretch; flex-grow: 4">

CSK_Module_MultiIOLinkSMI/project.mf.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,10 @@ INFO: Other modules can check via "Script.isServedAsEvent" if event exists.</des
510510
<desc>Notify status if ALL readMessage timers should start automatically after parameters were loaded.</desc>
511511
<param desc="Status" multiplicity="1" name="status" type="bool"/>
512512
</event>
513+
<event name="OnNewProcessDataExtraByteLength">
514+
<desc>Notify amount of extra bytes to add to byte length of process data output.</desc>
515+
<param desc="Amount of extra bytes." multiplicity="1" name="extraBytes" type="int"/>
516+
</event>
513517
<function name="setParameterName">
514518
<desc>Function to set the name of the parameters if saved/loaded via the CSK_PersistentData module.</desc>
515519
<param desc="Name of the parameter" multiplicity="1" name="name" type="string"/>
@@ -1129,6 +1133,10 @@ NUM will be replaced by the number of instance (e.g. "readProcessDataBinary_1").
11291133
<desc>Function to set status if ALL readMessage timers should be started automatically by loading parameters.</desc>
11301134
<param desc="Status" multiplicity="1" name="status" type="bool"/>
11311135
</function>
1136+
<function name="setProcessDataExtraByteLength">
1137+
<desc>Function to set amount of extra bytes to add to process data byte length.</desc>
1138+
<param desc="Amount of extra bytes." multiplicity="1" name="extraBytes" type="int"/>
1139+
</function>
11321140
</serves>
11331141
</crown>
11341142
<crown name="MultiIOLinkSMI_FC">
@@ -1232,7 +1240,7 @@ Set source event of incoming data to use for writeMessage.</desc>
12321240
</crown>
12331241
</crown>
12341242
<meta key="author">SICK AG</meta>
1235-
<meta key="version">3.1.0</meta>
1243+
<meta key="version">3.2.0</meta>
12361244
<meta key="priority">low</meta>
12371245
<meta key="copy-protected">false</meta>
12381246
<meta key="read-protected">false</meta>

CSK_Module_MultiIOLinkSMI/scripts/CSK_Module_MultiIOLinkSMI.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ local multiIOLinkSMI_Instances = {} -- Handle all instances
5050
local multiIOLinkSMIController = require('Communication/MultiIOLinkSMI/MultiIOLinkSMI_Controller')
5151

5252
if _G.availableAPIs.default and _G.availableAPIs.specificSMI and Engine.getEnumValues('IOLinkMasterPorts') ~= nil then
53-
local setInstanceHandle = require('Communication/MultiIOLinkSMI/FlowConfig/MultiIOLinkSMI_FlowConfig')
53+
require('Communication/MultiIOLinkSMI/FlowConfig/MultiIOLinkSMI_FlowConfig')
5454
table.insert(multiIOLinkSMI_Instances, multiIOLinkSMI_Model.create(1))
5555
multiIOLinkSMIController.setMultiIOLinkSMI_Instances_Handle(multiIOLinkSMI_Instances) -- share handle of instances
56-
setInstanceHandle(multiIOLinkSMI_Instances)
5756
else
5857
_G.logger:warning("CSK_MultiIOLinkSMI: Relevant CROWN(s) not available on device. Module is not supported...")
5958
end

CSK_Module_MultiIOLinkSMI/scripts/CSK_MultiIOLinkSMI_Processing.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ processingParams.activeInUi = false
3333
-- processingParams.name = scriptParams:get('name') -- future use
3434
processingParams.active = scriptParams:get('active')
3535
processingParams.port = scriptParams:get('port')
36+
processingParams.extraByteLength = scriptParams:get('extraByteLength')
3637
processingParams.showLiveValue = false
3738

3839
local ioddReadMessages = {} -- table with configured read messages
@@ -174,7 +175,7 @@ local function writeBinaryProcessData(data)
174175
-- Byte 1= Process data valid
175176
-- Byte 2= Byte length of data
176177
-- Byte 3= Data
177-
local l_data = string.char(0x01, #data+1) .. data
178+
local l_data = string.char(0x01, #data + processingParams.extraByteLength) .. data
178179
l_returnCode, detailErrorCode = IOLink.SMI.setPDOut(processingParams.SMIhandle, processingParams.port, l_data)
179180
end
180181

CSK_Module_MultiIOLinkSMI/scripts/Communication/MultiIOLinkSMI/FlowConfig/MultiIOLinkSMI_FlowConfig.lua

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,18 @@ require('Communication.MultiIOLinkSMI.FlowConfig.MultiIOLinkSMI_OnNewData')
77
require('Communication.MultiIOLinkSMI.FlowConfig.MultiIOLinkSMI_OnNewDataAuto')
88
require('Communication.MultiIOLinkSMI.FlowConfig.MultiIOLinkSMI_WriteProcessData')
99

10-
-- Reference to the multiIOLinkSMI_Instances handle
11-
local multiIOLinkSMI_Instances
12-
1310
--- Function to react if FlowConfig was updated
1411
local function handleOnClearOldFlow()
1512
if _G.availableAPIs.default and _G.availableAPIs.specificSMI then
16-
for i = 1, # multiIOLinkSMI_Instances do
17-
if multiIOLinkSMI_Instances[i].parameters.flowConfigPriority then
18-
CSK_MultiIOLinkSMI.clearFlowConfigRelevantConfiguration()
19-
break
20-
end
21-
end
13+
CSK_MultiIOLinkSMI.clearFlowConfigRelevantConfiguration()
2214
end
2315
end
2416
Script.register('CSK_FlowConfig.OnClearOldFlow', handleOnClearOldFlow)
2517

2618
--- Function to react if FlowConfig was updated
2719
local function handleOnStopProvider()
2820
if _G.availableAPIs.default and _G.availableAPIs.specificSMI then
29-
for i = 1, # multiIOLinkSMI_Instances do
30-
if multiIOLinkSMI_Instances[i].parameters.flowConfigPriority then
31-
CSK_MultiIOLinkSMI.stopFlowConfigRelevantProvider()
32-
break
33-
end
34-
end
21+
CSK_MultiIOLinkSMI.stopFlowConfigRelevantProvider()
3522
end
3623
end
3724
Script.register('CSK_FlowConfig.OnStopFlowConfigProviders', handleOnStopProvider)
38-
39-
--- Function to get access to the multiIOLinkSMI_Instances
40-
---@param handle handle Handle of multiIOLinkSMI_Instances object
41-
local function setMultiIOLinkSMI_Instances_Handle(handle)
42-
multiIOLinkSMI_Instances = handle
43-
end
44-
45-
return setMultiIOLinkSMI_Instances_Handle

CSK_Module_MultiIOLinkSMI/scripts/Communication/MultiIOLinkSMI/MultiIOLinkSMI_Controller.lua

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ Script.serveEvent('CSK_MultiIOLinkSMI.OnNewReadDataMessage', 'M
167167
Script.serveEvent('CSK_MultiIOLinkSMI.OnNewReadDataSuccess', 'MultiIOLinkSMI_OnNewReadDataSuccess')
168168
Script.serveEvent('CSK_MultiIOLinkSMI.OnNewWriteDataMessage', 'MultiIOLinkSMI_OnNewWriteDataMessage')
169169
Script.serveEvent('CSK_MultiIOLinkSMI.OnNewWriteDataSuccess', 'MultiIOLinkSMI_OnNewWriteDataSuccess')
170+
Script.serveEvent('CSK_MultiIOLinkSMI.OnNewProcessDataExtraByteLength', 'MultiIOLinkSMI_OnNewProcessDataExtraByteLength')
170171

171172
Script.serveEvent('CSK_MultiIOLinkSMI.OnNewReadParameterByteArray', 'MultiIOLinkSMI_OnNewReadParameterByteArray')
172173
Script.serveEvent('CSK_MultiIOLinkSMI.OnNewReadProcessDataByteArray', 'MultiIOLinkSMI_OnNewReadProcessDataByteArray')
@@ -435,6 +436,7 @@ local function handleOnExpiredTmrMultiIOLinkSMI()
435436
Script.notifyEvent('MultiIOLinkSMI_OnNewListIODDWriteMessages', json.encode(nameList))
436437
Script.notifyEvent('MultiIOLinkSMI_OnNewStatusIODDWriteMessageSelected', selectedIODDWriteMessage ~= '')
437438
Script.notifyEvent('MultiIOLinkSMI_OnNewSelectedIODDWriteMessage', selectedIODDWriteMessage)
439+
Script.notifyEvent('MultiIOLinkSMI_OnNewProcessDataExtraByteLength', multiIOLinkSMI_Instances[selectedInstance].parameters.extraByteLength)
438440
if selectedIODDWriteMessage ~= '' then
439441
if multiIOLinkSMI_Instances[selectedInstance].parameters.ioddInfo then
440442
CSK_IODDInterpreter.pageCalledWriteData()
@@ -1187,6 +1189,12 @@ local function getIODDWriteMessageJSONTemplate(messageName)
11871189
end
11881190
Script.serveFunction('CSK_MultiIOLinkSMI.getIODDWriteMessageJSONTemplate', getIODDWriteMessageJSONTemplate)
11891191

1192+
local function setProcessDataExtraByteLength(extraBytes)
1193+
multiIOLinkSMI_Instances[selectedInstance].parameters.extraByteLength = extraBytes
1194+
Script.notifyEvent('MultiIOLinkSMI_OnNewProcessingParameter', selectedInstance, 'extraByteLength', extraBytes)
1195+
end
1196+
Script.serveFunction('CSK_MultiIOLinkSMI.setProcessDataExtraByteLength', setProcessDataExtraByteLength)
1197+
11901198
--**************************************************************************
11911199
--*************Copy/Paste device configuration from outside*****************
11921200
--**************************************************************************
@@ -1460,17 +1468,24 @@ Script.serveFunction('CSK_MultiIOLinkSMI.getStatusModuleActive', getStatusModule
14601468

14611469
local function clearFlowConfigRelevantConfiguration()
14621470
for i = 1, #multiIOLinkSMI_Instances do
1463-
setSelectedInstance(i)
1464-
for key, value in pairs(multiIOLinkSMI_Instances[i].parameters.ioddWriteMessages) do
1465-
setSelectedIODDWriteMessage(key)
1466-
setIODDWriteMessageEventName('')
1471+
if multiIOLinkSMI_Instances[i].parameters.flowConfigPriority == true then
1472+
setSelectedInstance(i)
1473+
for key, value in pairs(multiIOLinkSMI_Instances[i].parameters.ioddWriteMessages) do
1474+
setSelectedIODDWriteMessage(key)
1475+
setIODDWriteMessageEventName('')
1476+
end
14671477
end
14681478
end
14691479
end
14701480
Script.serveFunction('CSK_MultiIOLinkSMI.clearFlowConfigRelevantConfiguration', clearFlowConfigRelevantConfiguration)
14711481

14721482
local function stopFlowConfigRelevantProvider()
1473-
setReadMessageTimerActive(false)
1483+
for i = 1, #multiIOLinkSMI_Instances do
1484+
if multiIOLinkSMI_Instances[i].parameters.flowConfigPriority == true then
1485+
setReadMessageTimerActive(false)
1486+
break
1487+
end
1488+
end
14741489
end
14751490
Script.serveFunction('CSK_MultiIOLinkSMI.stopFlowConfigRelevantProvider', stopFlowConfigRelevantProvider)
14761491

CSK_Module_MultiIOLinkSMI/scripts/Communication/MultiIOLinkSMI/MultiIOLinkSMI_Model.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ function multiIOLinkSMI.create(multiIOLinkSMIInstanceNo)
160160
--self.multiIOLinkSMIProcessingParams:add('name', self.parameters.name, 'STRING') -- future usage
161161
self.multiIOLinkSMIProcessingParams:add('active', self.parameters.active, 'BOOL')
162162
self.multiIOLinkSMIProcessingParams:add('port', self.parameters.port, 'STRING')
163+
self.multiIOLinkSMIProcessingParams:add('extraByteLength', self.parameters.extraByteLength, 'INT')
163164

164165
-- Handle processing
165166
Script.startScript(self.parameters.processingFile, self.multiIOLinkSMIProcessingParams)

CSK_Module_MultiIOLinkSMI/scripts/Communication/MultiIOLinkSMI/MultiIOLinkSMI_Parameters.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ local function getParameters()
2020
multiIOLinkSMIParameters.ioddReadMessages = {} -- Table contatining information about read messages. Each read message has its own IODD Interpreter instance
2121
multiIOLinkSMIParameters.ioddWriteMessages = {} -- Table contatining information about write messages. Each write message has its own IODD Interpreter instance
2222
multiIOLinkSMIParameters.autoStartTimer = false -- Status if read message timers should be started automatically after parameters were loaded
23+
multiIOLinkSMIParameters.extraByteLength = 1 -- Extra bytes to add to ProcessData Out byte length
2324

2425
return multiIOLinkSMIParameters
2526
end

CSK_Module_MultiIOLinkSMI/scripts/Communication/MultiIOLinkSMI/helper/funcs.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ local function convertTable2Container(data)
125125
val2add = convertTable2Container(val)
126126
valType = 'OBJECT'
127127
end
128-
if type(val) == 'string' then valType = 'STRING' end
128+
if type(val) == 'string' then
129+
valType = 'STRING'
130+
end
129131
cont:add(key, val2add, valType)
130132
end
131133
return cont

0 commit comments

Comments
 (0)