Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
osie
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Martin Manchev
osie
Commits
d3ae3dba
Commit
d3ae3dba
authored
Jun 16, 2021
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Plain Diff
Slaposify
See merge request
nexedi/osie!2
parents
6e716112
a93f16b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
10 deletions
+65
-10
eggs/osie_coupler/osie_modbus.py
eggs/osie_coupler/osie_modbus.py
+6
-3
slapos/software/osie-coupler/software.cfg
slapos/software/osie-coupler/software.cfg
+59
-7
No files found.
eggs/osie_coupler/osie_modbus.py
View file @
d3ae3dba
...
@@ -25,12 +25,15 @@ from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext
...
@@ -25,12 +25,15 @@ from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext
from
pymodbus.transaction
import
(
ModbusRtuFramer
,
from
pymodbus.transaction
import
(
ModbusRtuFramer
,
ModbusAsciiFramer
,
ModbusAsciiFramer
,
ModbusBinaryFramer
)
ModbusBinaryFramer
)
from
custom_message
import
CustomModbusRequest
#from .custom_message import CustomModbusRequest
from
pymodbus.pdu
import
ModbusRequest
from
pyA20Lime2
import
i2c
from
pyA20Lime2
import
i2c
import
bitarray
import
bitarray
from
bitarray.util
import
ba2int
from
bitarray.util
import
ba2int
ModbusRequest
.
function_code
=
55
# name fo device within Lime2
# name fo device within Lime2
DEFAULT_MOD_IO_DEVICE_NAME
=
"/dev/i2c-1"
DEFAULT_MOD_IO_DEVICE_NAME
=
"/dev/i2c-1"
...
@@ -153,7 +156,7 @@ def run_async_server():
...
@@ -153,7 +156,7 @@ def run_async_server():
co
=
ModbusSequentialDataBlock
(
0
,
[
0
]
*
10
),
co
=
ModbusSequentialDataBlock
(
0
,
[
0
]
*
10
),
hr
=
ModbusSequentialDataBlock
(
0
,
[
0
]
*
10
),
hr
=
ModbusSequentialDataBlock
(
0
,
[
0
]
*
10
),
ir
=
ModbusSequentialDataBlock
(
0
,
[
0
]
*
10
),
zero_mode
=
True
)
ir
=
ModbusSequentialDataBlock
(
0
,
[
0
]
*
10
),
zero_mode
=
True
)
store
.
register
(
Custom
ModbusRequest
.
function_code
,
'cm'
,
store
.
register
(
ModbusRequest
.
function_code
,
'cm'
,
ModbusSequentialDataBlock
(
0
,
[
17
]
*
100
))
ModbusSequentialDataBlock
(
0
,
[
17
]
*
100
))
context
=
ModbusServerContext
(
slaves
=
store
,
single
=
True
)
context
=
ModbusServerContext
(
slaves
=
store
,
single
=
True
)
...
@@ -172,7 +175,7 @@ def run_async_server():
...
@@ -172,7 +175,7 @@ def run_async_server():
# TCP Server
# TCP Server
StartTcpServer
(
context
,
identity
=
identity
,
address
=
(
"0.0.0.0"
,
502
),
StartTcpServer
(
context
,
identity
=
identity
,
address
=
(
"0.0.0.0"
,
502
),
custom_functions
=
[
Custom
ModbusRequest
])
custom_functions
=
[
ModbusRequest
])
def
main
():
def
main
():
"""
"""
...
...
slapos/software/osie-coupler/software.cfg
View file @
d3ae3dba
# the default SlapOs profile which setup a modbus server instance usually over OSIE's coupler
# the default SlapOs profile which setup a modbus server instance usually over OSIE's coupler
[buildout]
[buildout]
#allow-picked-versions = true
extends =
extends =
buildout.hash.cfg
buildout.hash.cfg
https://lab.nexedi.com/nexedi/slapos/raw/master/component/fluentd/buildout.cfg
https://lab.nexedi.com/nexedi/slapos/raw/master/stack/slapos.cfg
https://lab.nexedi.com/nexedi/slapos/raw/master/stack/slapos.cfg
https://lab.nexedi.com/nexedi/slapos/raw/master/component/python3/buildout.cfg
https://lab.nexedi.com/nexedi/slapos/raw/master/component/python3/buildout.cfg
parts =
parts =
osie-repository
osie-repository
python-interpreter
osie-coupler-egg
osie-coupler-egg
osie-coupler-script
#
osie-coupler-script
# fix for pypi: https://mail.python.org/pipermail/distutils-sig/2017-October/031712.html
# fix for pypi: https://mail.python.org/pipermail/distutils-sig/2017-October/031712.html
index = https://pypi.python.org/simple/
index = https://pypi.python.org/simple/
[python]
part = python3
[pymodbus]
recipe = zc.recipe.egg:custom
egg = pymodbus[twisted]
setup-eggs =
six
[Twisted]
recipe = zc.recipe.egg:custom
egg = Twisted
setup-eggs =
incremental
[Automat]
recipe = zc.recipe.egg:custom
egg = Automat
setup-eggs =
m2r
[python-interpreter]
recipe = zc.recipe.egg
interpreter = pythonwitheggs
eggs = click
prompt_toolkit
pygments
bitarray
pyA20Lime2
${Automat:egg}
${Twisted:egg}
${pymodbus:egg}
[osie-repository]
[osie-repository]
recipe = slapos.recipe.build:gitclone
recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git
git-executable = ${git:location}/bin/git
# token must be removed if going public!!!
# token must be removed if going public!!!
repository = https://gitlab+deploy-token-4:pLwtBu8TbusqZDKPUpZA@lab.nexedi.com/nexedi/osie.git
repository = https://gitlab+deploy-token-4:pLwtBu8TbusqZDKPUpZA@lab.nexedi.com/nexedi/osie.git
location = ${buildout:parts-directory}/osie
location = ${buildout:parts-directory}/osie
branch = slaposify
[osie-coupler-egg]
[osie-coupler-egg]
recipe = zc.recipe.egg:develop
recipe = zc.recipe.egg:develop
egg = osie-coupler
egg = osie-coupler
setup = ${osie-repository:location}/eggs/osie_coupler/
setup = ${osie-repository:location}/eggs/osie_coupler/
interpreter = ${python-interpreter:interpreter}
[osie-coupler-script]
[osie-coupler-script]
recipe = zc.recipe.egg:scripts
recipe = zc.recipe.egg:scripts
eggs = ${osie-coupler-egg:egg}
eggs = ${osie-coupler-egg:egg}
scripts = modbus_server=modbus_server-run
scripts = modbus_server=modbus_server-run
#
interpreter = ${python-interpreter:interpreter}
interpreter = ${python-interpreter:interpreter}
[eggs]
[versions]
eggs +=
six = 1.15.0
${osie-coupler-egg:egg}
attrs = 19.2.0
setuptools
zope.interface = 4.4.2
Automat = 20.2.0
Pygments = 2.9.0
Twisted = 21.2.0
appdirs = 1.4.4
bcrypt = 3.2.0
bitarray = 2.1.2
constantly = 15.1.0
hyperlink = 21.0.0
incremental = 21.3.0
prompt-toolkit = 3.0.18
pymodbus = 2.5.2
pyserial = 3.5
m2r = 0.2.1
pyA20Lime2 = 0.2.1
docutils = 0.17.1
mistune = 0.8.4
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment