Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
dhoomakethu committed Oct 17, 2021
2 parents 731b080 + d2d1974 commit c5772b3
Show file tree
Hide file tree
Showing 37 changed files with 133 additions and 90 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ jobs:
mkdir --parents $(dirname $PYPY_EXTERNALS_PATH)
hg clone https://foss.heptapod.net/pypy/externals/ $PYPY_EXTERNALS_PATH
dir $PYPY_EXTERNALS_PATH
cd $PYPY_EXTERNALS_PATH && hg update win32_14x
cd $PYPY_EXTERNALS_PATH && hg update win$(python -c 'import struct; print(struct.calcsize("P") * 8)')_14x
echo "INCLUDE=$PYPY_EXTERNALS_PATH/include;$INCLUDE" >> $GITHUB_ENV
echo "LIB=$PYPY_EXTERNALS_PATH/lib;$LIB" >> $GITHUB_ENV
# echo "CL=${{ matrix.PYTHON.CL_FLAGS }}" >> $GITHUB_ENV
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
version 2.5.3
----------------------------------------------------------
* Fix retries on tcp client failing randomly.
* Fix Asyncio client timeout arg not being used.
* Treat exception codes as valid responses
* Fix examples (modbus_payload)
* Add missing identity argument to async ModbusSerialServer

version 2.5.2
----------------------------------------------------------
* Add kwarg `reset_socket` to control closing of the socket on read failures (set to `True` by default).
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ For those of you that just want to get started fast, here you go::
client.close()

For more advanced examples, check out the `Examples <https://pymodbus.readthedocs.io/en/dev/source/example/modules.html>`_ included in the
respository. If you have created any utilities that meet a specific
repository. If you have created any utilities that meet a specific
need, feel free to submit them so others can benefit.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -113,7 +113,7 @@ get lost in the noise: http://groups.google.com/group/pymodbus or
at gitter: https://gitter.im/pymodbus_dev/Lobby

.. important::
**Note For async clients, it is recomended to use `asyncio` as the async facilitator (Python 3.6 and above).**
**Note For async clients, it is recommended to use `asyncio` as the async facilitator (Python 3.6 and above).**
**If using tornado make sure the tornado version is `4.5.3`.Other versions of tornado can break the implementation**


Expand Down
2 changes: 1 addition & 1 deletion examples/common/async_asyncio_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
--------------------------------------------------------------------------
The following is an example of how to use the asynchronous modbus
client implementation from pymodbus with ayncio.
client implementation from pymodbus with asyncio.
The example is only valid on Python3.4 and above
"""
Expand Down
2 changes: 1 addition & 1 deletion examples/common/async_asyncio_serial_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
--------------------------------------------------------------------------
The following is an example of how to use the asynchronous serial modbus
client implementation from pymodbus with ayncio.
client implementation from pymodbus with asyncio.
The example is only valid on Python3.4 and above
"""
Expand Down
4 changes: 2 additions & 2 deletions examples/common/asynchronous_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
free to use it as a skeleton guide in implementing your own.
"""
# --------------------------------------------------------------------------- #
# import the neccessary modules
# import the necessary modules
# --------------------------------------------------------------------------- #
from twisted.internet import serialport, reactor
from twisted.internet.protocol import ClientFactory
Expand Down Expand Up @@ -46,7 +46,7 @@
# --------------------------------------------------------------------------- #
# an example custom protocol
# --------------------------------------------------------------------------- #
# Here you can perform your main procesing loop utilizing defereds and timed
# Here you can perform your main processing loop utilizing defereds and timed
# callbacks.
# --------------------------------------------------------------------------- #
class ExampleProtocol(ModbusClientProtocol):
Expand Down
49 changes: 34 additions & 15 deletions examples/common/modbus_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,31 @@ def run_binary_payload_ex():
# ----------------------------------------------------------------------- #
client = ModbusClient('127.0.0.1', port=5020)
client.connect()

# ----------------------------------------------------------------------- #
# If you need to build a complex message to send, you can use the payload
# builder to simplify the packing logic.
#
# Here we demonstrate packing a random payload layout, unpacked it looks
# like the following:
#
# - a 8 byte string 'abcdefgh'
# - a 32 bit float 22.34
# - a 16 bit unsigned int 0x1234
# - another 16 bit unsigned int 0x5678
# - an 8 bit int 0x12
# - an 8 byte string "abcdefgh"
# - an 8 bit bitstring [0,1,0,1,1,0,1,0]
# - an 32 bit uint 0x12345678
# - an 32 bit signed int -0x1234
# - an 64 bit signed int 0x12345678
# - an 8 bit int -0x12
# - an 8 bit unsigned int 0x12
# - a 16 bit int -0x5678
# - a 16 bit unsigned int 0x1234
# - a 32 bit int -0x1234
# - a 32 bit unsigned int 0x12345678
# - a 16 bit float 12.34
# - a 16 bit float -12.34
# - a 32 bit float 22.34
# - a 32 bit float -22.34
# - a 64 bit int -0xDEADBEEF
# - a 64 bit unsigned int 0x12345678DEADBEEF
# - another 64 bit unsigned int 0x12345678DEADBEEF
# - a 64 bit float 123.45
# - a 64 bit float -123.45

# The packing can also be applied to the word (wordorder) and bytes in each
# word (byteorder)
Expand Down Expand Up @@ -123,12 +131,23 @@ def run_binary_payload_ex():
# Here we demonstrate decoding a random register layout, unpacked it looks
# like the following:
#
# - a 8 byte string 'abcdefgh'
# - a 32 bit float 22.34
# - a 16 bit unsigned int 0x1234
# - another 16 bit unsigned int which we will ignore
# - an 8 bit int 0x12
# - an 8 byte string "abcdefgh"
# - an 8 bit bitstring [0,1,0,1,1,0,1,0]
# - an 8 bit int -0x12
# - an 8 bit unsigned int 0x12
# - a 16 bit int -0x5678
# - a 16 bit unsigned int 0x1234
# - a 32 bit int -0x1234
# - a 32 bit unsigned int 0x12345678
# - a 16 bit float 12.34
# - a 16 bit float -12.34
# - a 32 bit float 22.34
# - a 32 bit float -22.34
# - a 64 bit int -0xDEADBEEF
# - a 64 bit unsigned int 0x12345678DEADBEEF
# - another 64 bit unsigned int which we will ignore
# - a 64 bit float 123.45
# - a 64 bit float -123.45
# ----------------------------------------------------------------------- #
address = 0x0
count = len(payload)
Expand Down Expand Up @@ -174,7 +193,7 @@ def run_binary_payload_ex():
print("-" * 60)
for name, value in iteritems(decoded):
print("%s\t" % name, hex(value) if isinstance(value, int) else value)

# ----------------------------------------------------------------------- #
# close the client
# ----------------------------------------------------------------------- #
Expand Down
2 changes: 1 addition & 1 deletion examples/contrib/asynchronous_asyncio_modbus_tls_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
the TLS feature and asyncio.
"""
# -------------------------------------------------------------------------- #
# import neccessary libraries
# import necessary libraries
# -------------------------------------------------------------------------- #
import ssl
from pymodbus.client.asynchronous.tls import AsyncModbusTLSClient
Expand Down
2 changes: 1 addition & 1 deletion examples/contrib/bcd_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def add_string(self, value):
class BcdPayloadDecoder(object):
"""
A utility that helps decode binary coded decimal payload
messages from a modbus reponse message. What follows is
messages from a modbus response message. What follows is
a simple example::
decoder = BcdPayloadDecoder(payload)
Expand Down
2 changes: 1 addition & 1 deletion examples/contrib/concurrent_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from futures import Future

# -------------------------------------------------------------------------- #
# import neccessary modbus libraries
# import necessary modbus libraries
# -------------------------------------------------------------------------- #
from pymodbus.client.common import ModbusClientMixin

Expand Down
2 changes: 1 addition & 1 deletion examples/contrib/message_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self, framer, encode=False):
def decode(self, message):
""" Attempt to decode the supplied message
:param message: The messge to decode
:param message: The message to decode
"""
if IS_PYTHON3:
value = message if self.encode else c.encode(message, 'hex_codec')
Expand Down
2 changes: 1 addition & 1 deletion examples/contrib/modbus_saver.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
class ModbusDatastoreSaver(object):
""" An abstract base class that can be used to implement
a persistance format for the modbus server context. In
order to use it, just complete the neccessary callbacks
order to use it, just complete the necessary callbacks
(SAX style) that your persistance format needs.
"""

Expand Down
2 changes: 1 addition & 1 deletion examples/contrib/modbus_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def parse(self):
""" Parses the config file and creates a server context
"""
handle = pickle.load(self.file)
try: # test for existance, or bomb
try: # test for existence, or bomb
dsd = handle['di']
csd = handle['ci']
hsd = handle['hr']
Expand Down
2 changes: 1 addition & 1 deletion examples/contrib/modbus_tls_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
feature.
"""
# -------------------------------------------------------------------------- #
# import neccessary libraries
# import necessary libraries
# -------------------------------------------------------------------------- #
import ssl
from pymodbus.client.sync import ModbusTlsClient
Expand Down
2 changes: 1 addition & 1 deletion examples/contrib/modicon_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def add_string(self, value):
class ModiconPayloadDecoder(object):
"""
A utility that helps decode modicon encoded payload
messages from a modbus reponse message. What follows is
messages from a modbus response message. What follows is
a simple example::
decoder = ModiconPayloadDecoder(payload)
Expand Down
2 changes: 1 addition & 1 deletion examples/contrib/remote_server_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def __iter__(self):
def __contains__(self, slave):
""" Check if the given slave is in this list
:param slave: slave The slave to check for existance
:param slave: slave The slave to check for existence
:returns: True if the slave exists, False otherwise
"""
# we don't want to check the cache here as the
Expand Down
2 changes: 1 addition & 1 deletion examples/gui/bottle/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def build_application(server):
""" Helper method to create and initiailze a bottle application
:param server: The modbus server to pull instance data from
:returns: An initialied bottle application
:returns: An initialized bottle application
"""
log.info("building web application")
api = ModbusApiWebApp(server)
Expand Down
2 changes: 1 addition & 1 deletion examples/gui/bottle/media/js/backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@
tagName: 'div',

// jQuery delegate for element lookup, scoped to DOM elements within the
// current view. This should be prefered to global lookups where possible.
// current view. This should be preferred to global lookups where possible.
$: function(selector) {
return this.$el.find(selector);
},
Expand Down
2 changes: 1 addition & 1 deletion examples/tools/build_datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __str__(self):
# Datablock Builders
#--------------------------------------------------------------------------#
def build_translation(option, opt, value, parser):
""" Converts a register dump list to a pickeld datastore
""" Converts a register dump list to a pickled datastore
:param option: The option instance
:param opt: The option string specified
Expand Down
Loading

0 comments on commit c5772b3

Please sign in to comment.