Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,4 @@
All notable changes to this project will be documented in this file.

## Release 0.1.0
- Initial commit

### New features
- ...

### Improvements
- ...

### Bugfix
- ...
- Initial commit
8 changes: 7 additions & 1 deletion CSK_Module_Fieldbus/pages/assets/legacy/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"showLoginButton": false
"canChangeLanguage": true,
"showLoginButton": false,
"defaultLanguage": "en",
"disableEditMode": true,
"showPageHistory": true,
"compactMode": false,
"canChangeCompactMode": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,14 @@
margin: 6px;
}

.myCustomCssClass_CSK_Module_Fieldbus {
.myCustomMinHeight100p_CSK_Module_Fieldbus {
min-height: 100%;
}

.myCustomMarginBottom4px_CSK_Module_Fieldbus {
margin-bottom: 4px;
}

.myCustomRedText_CSK_Module_Fieldbus {
color: crimson;
}
1,803 changes: 1,722 additions & 81 deletions CSK_Module_Fieldbus/pages/pages/CSK_Module_Fieldbus/CSK_Module_Fieldbus.html

Large diffs are not rendered by default.

642 changes: 563 additions & 79 deletions CSK_Module_Fieldbus/project.mf.xml

Large diffs are not rendered by default.

50 changes: 42 additions & 8 deletions CSK_Module_Fieldbus/scripts/CSK_Module_Fieldbus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
-- If app property "LuaLoadAllEngineAPI" is FALSE, use this to load and check for required APIs
-- This can improve performance of garbage collection

--_G.availableAPIs = require('Communication/Fieldbus/helper/checkAPIs') -- can be used to adjust function scope of the module related on available APIs of the device
_G.availableAPIs = require('Communication/Fieldbus/helper/checkAPIs') -- can be used to adjust function scope of the module related on available APIs of the device
-----------------------------------------------------------
-- Logger
_G.logger = Log.SharedLogger.create('ModuleLogger')
_G.logHandle = Log.Handler.create()
_G.logHandle:attachToSharedLogger('ModuleLogger')
_G.logHandle:setConsoleSinkEnabled(false) --> Set to TRUE if CSK_Logger module is not used
_G.logHandle:setConsoleSinkEnabled(true) --> Set to TRUE if CSK_Logger module is not used
_G.logHandle:setLevel("ALL")
_G.logHandle:applyConfig()
-----------------------------------------------------------
Expand All @@ -62,17 +62,51 @@ local function main()
-- Can be used e.g. like this
----------------------------------------------------------------------------------------

-- _G.fieldbus_Model.doSomething() -- if you want to start a function
-- ...
CSK_Fieldbus.pageCalled() -- Update UI

end
Script.register("Engine.OnStarted", main)
--[[
CSK_Fieldbus.setDataNameReceive('Data1')
CSK_Fieldbus.setDataTypeReceive('U_INT2')
CSK_Fieldbus.addDataToReceiveViaUI()

CSK_Fieldbus.setDataNameReceive('Data2')
CSK_Fieldbus.setDataTypeReceive('U_INT4')
CSK_Fieldbus.addDataToReceiveViaUI()

CSK_Fieldbus.setDataTypeTransmit('U_BYTE')
for i=1, 6 do
CSK_Fieldbus.setDataNameTransmit('Data' ..tostring(i))
CSK_Fieldbus.addDataToTransmitViaUI()
end

CSK_Fieldbus.setDataTypeTransmit('S_INT2')
for i=7, 10 do
CSK_Fieldbus.setDataNameTransmit('Data' ..tostring(i))
CSK_Fieldbus.addDataToTransmitViaUI()
end

--OR
CSK_Fieldbus.setDataTypeTransmit('U_BYTE')
for i=11, 18 do
CSK_Fieldbus.setDataNameTransmit('Data' ..tostring(i))
CSK_Fieldbus.addDataToTransmitViaUI()
end

-- Call function after persistent data was loaded
--Script.register("CSK_Fieldbus.OnDataLoadedOnReboot", main)
CSK_Fieldbus.setDataTypeTransmit('U_INT8')
for i=19, 31 do
CSK_Fieldbus.setDataNameTransmit('Data' ..tostring(i))
CSK_Fieldbus.addDataToTransmitViaUI()
end

CSK_Fieldbus.setDataTypeTransmit('U_BYTE')
for i=32, 33 do
CSK_Fieldbus.setDataNameTransmit('Data' ..tostring(i))
CSK_Fieldbus.addDataToTransmitViaUI()
end
]]

end
Script.register("Engine.OnStarted", main)

--**************************************************************************
--**********************End Function Scope *********************************
Expand Down

Large diffs are not rendered by default.

1,007 changes: 986 additions & 21 deletions CSK_Module_Fieldbus/scripts/Communication/Fieldbus/Fieldbus_Model.lua

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--*****************************************************************
-- Here you will find all the required content to provide specific
-- features of this module via the 'CSK FlowConfig'.
--*****************************************************************

require('Communication.Fieldbus.FlowConfig.Fieldbus_OnNewData')
require('Communication.Fieldbus.FlowConfig.Fieldbus_Transmit')

-- Reference to the fieldbus_Instances handle
local fieldbus_Instances

--- Function to react if FlowConfig was updated
local function handleOnClearOldFlow()
if _G.availableAPIs.default and _G.availableAPIs.specific then
for i = 1, #fieldbus_Instances do
if fieldbus_Instances[i].parameters.flowConfigPriority then
CSK_Fieldbus.clearFlowConfigRelevantConfiguration()
break
end
end
end
end
Script.register('CSK_FlowConfig.OnClearOldFlow', handleOnClearOldFlow)

--- Function to get access to the fieldbus_Instances
---@param handle handle Handle of fieldbus_Instances object
local function setFieldbus_Instances_Handle(handle)
fieldbus_Instances = handle
end

return setFieldbus_Instances_Handle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
local availableAPIs = {}

local function loadAPIs()
CSK_ModuleName = require 'API.CSK_ModuleName'
CSK_Fieldbus = require 'API.CSK_Fieldbus'

Container = require 'API.Container'
Engine = require 'API.Engine'
File = require 'API.File'
Log = require 'API.Log'
Log.Handler = require 'API.Log.Handler'
Log.SharedLogger = require 'API.Log.SharedLogger'
Object = require 'API.Object'
Parameters = require 'API.Parameters'
Timer = require 'API.Timer'

-- Check if related CSK modules are available to be used
Expand All @@ -30,7 +32,11 @@ end
local function loadSpecificAPIs()
-- If you want to check for specific APIs/functions supported on the device the module is running, place relevant APIs here
-- e.g.:
-- NTPClient = require 'API.NTPClient'
FieldBus = require 'API.FieldBus'
FieldBus.Config = require 'API.FieldBus.Config'
FieldBus.Config.EtherNetIP = require 'API.FieldBus.Config.EtherNetIP'
FieldBus.Config.ProfinetIO = require 'API.FieldBus.Config.ProfinetIO'
FieldBus.StorageRequest = require 'API.FieldBus.StorageRequest'
end

availableAPIs.default = xpcall(loadAPIs, debug.traceback) -- TRUE if all default APIs were loaded correctly
Expand Down
Loading