Commit d3ae3dba authored by Ivan Tyagov's avatar Ivan Tyagov

Slaposify

See merge request !2
parents 6e716112 a93f16b8
......@@ -25,12 +25,15 @@ from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext
from pymodbus.transaction import (ModbusRtuFramer,
ModbusAsciiFramer,
ModbusBinaryFramer)
from custom_message import CustomModbusRequest
#from .custom_message import CustomModbusRequest
from pymodbus.pdu import ModbusRequest
from pyA20Lime2 import i2c
import bitarray
from bitarray.util import ba2int
ModbusRequest.function_code = 55
# name fo device within Lime2
DEFAULT_MOD_IO_DEVICE_NAME = "/dev/i2c-1"
......@@ -153,7 +156,7 @@ def run_async_server():
co=ModbusSequentialDataBlock(0, [0]*10),
hr=ModbusSequentialDataBlock(0, [0]*10),
ir=ModbusSequentialDataBlock(0, [0]*10), zero_mode = True)
store.register(CustomModbusRequest.function_code, 'cm',
store.register(ModbusRequest.function_code, 'cm',
ModbusSequentialDataBlock(0, [17] * 100))
context = ModbusServerContext(slaves=store, single=True)
......@@ -172,7 +175,7 @@ def run_async_server():
# TCP Server
StartTcpServer(context, identity=identity, address=("0.0.0.0", 502),
custom_functions=[CustomModbusRequest])
custom_functions=[ModbusRequest])
def main():
"""
......
# the default SlapOs profile which setup a modbus server instance usually over OSIE's coupler
[buildout]
#allow-picked-versions = true
extends =
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/component/python3/buildout.cfg
parts =
osie-repository
python-interpreter
osie-coupler-egg
osie-coupler-script
# osie-coupler-script
# fix for pypi: https://mail.python.org/pipermail/distutils-sig/2017-October/031712.html
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]
recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git
# token must be removed if going public!!!
repository = https://gitlab+deploy-token-4:pLwtBu8TbusqZDKPUpZA@lab.nexedi.com/nexedi/osie.git
location = ${buildout:parts-directory}/osie
branch = slaposify
[osie-coupler-egg]
recipe = zc.recipe.egg:develop
egg = osie-coupler
setup = ${osie-repository:location}/eggs/osie_coupler/
interpreter = ${python-interpreter:interpreter}
[osie-coupler-script]
recipe = zc.recipe.egg:scripts
eggs = ${osie-coupler-egg:egg}
scripts = modbus_server=modbus_server-run
#interpreter = ${python-interpreter:interpreter}
interpreter = ${python-interpreter:interpreter}
[eggs]
eggs +=
${osie-coupler-egg:egg}
setuptools
[versions]
six = 1.15.0
attrs = 19.2.0
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment