Skip to content

Commit 3e8a376

Browse files
hightlight notes and warnings of Usage documentation in Sphinx supported way
1 parent debf453 commit 3e8a376

File tree

2 files changed

+96
-46
lines changed

2 files changed

+96
-46
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ described in the [installation section](#install-package-on-board-with-pip)
8282
the following commands can be used to request a coil state of a target/client
8383
device. Further usage examples can be found in the
8484
[examples folder][ref-examples-folder] and in the
85-
[Micropython section of USAGE](USAGE.md#micropython)
85+
[Micropython section of USAGE](USAGE.md)
8686

8787
#### TCP
8888

@@ -175,7 +175,7 @@ of this library.
175175

176176
* **sfera-labs** - *Initial work* - [giampiero7][ref-sferalabs-exo-sense]
177177
* **pycom** - *Initial Modbus work* - [pycom-modbus][ref-pycom-modbus]
178-
* **pfalcon** - *Initial MicroPython unittest module* - [micropython-unittest][ref-pfalcon-unittest]:
178+
* **pfalcon** - *Initial MicroPython unittest module* - [micropython-unittest][ref-pfalcon-unittest]
179179

180180
<!-- Links -->
181181
[ref-sferalabs-exo-sense]: https://github.com/sfera-labs/exo-sense-py-modbus

docs/USAGE.md

Lines changed: 94 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ Overview to use and test this `micropython-modbus` library
44

55
---------------
66

7-
The onwards described steps assume a successful setup as described in
8-
[SETUP.md](SETUP.md)
7+
```{note}
8+
The onwards described steps assume a successful setup as described in the
9+
[setup chapter](SETUP.md)
10+
```
911

1012
## MicroPython
1113

@@ -134,10 +136,15 @@ The value of multiple registers can be set like this
134136
}
135137
```
136138

137-
> :warning: As of version 2.0.0 of this package it is not possible to request
138-
only the holding register 94, which would hold `38` in the above example.
139-
This is a bug (non implemented feature) of the client/slave implementation.
140-
For further details check [#35](https://github.com/brainelectronics/micropython-modbus/issues/35)
139+
```{eval-rst}
140+
.. warning::
141+
As of version `2.0.0 <https://github.com/brainelectronics/micropython-modbus/releases/tag/2.0.0>`_
142+
of this package it is not possible to request only the holding register
143+
`94`, which would hold `38` in the above example.
144+
145+
This is a bug (non implemented feature) of the client/slave implementation.
146+
For further details check `issue #35 <https://github.com/brainelectronics/micropython-modbus/issues/35>`_
147+
```
141148

142149
#### Detailed key explanation
143150

@@ -254,8 +261,10 @@ or `1` (on).
254261

255262
##### Read
256263

257-
> The function code `0x01` is used to read from 1 to 2000 contiguous status of
264+
```{note}
265+
The function code `0x01` is used to read from 1 to 2000 contiguous status of
258266
coils in a remote device.
267+
```
259268

260269
With the function [`read_coils`](umodbus.tcp.TCP.read_coils) a single coil
261270
status can be read.
@@ -271,12 +280,17 @@ print('Status of COIL {}: {}'.format(coil_address, coil_status))
271280
# Status of COIL 125: [True, False]
272281
```
273282

274-
> :warning: Please be aware of bug
275-
[#35](https://github.com/brainelectronics/micropython-modbus/issues/35). It is
276-
not possible to read a specific position within a configured list of multiple
277-
coils on a MicroPython Modbus TCP client device. Reading coil 126 in the above
278-
example will throw an error. This bug affects only devices using this package.
279-
Other devices work as expected and can be addressed as specified.
283+
```{eval-rst}
284+
.. warning::
285+
Please be aware of `bug #35 <https://github.com/brainelectronics/micropython-modbus/issues/35>`_.
286+
287+
It is not possible to read a specific position within a configured list of
288+
multiple coils on a MicroPython Modbus TCP client device. Reading coil 126
289+
in the above example will throw an error.
290+
291+
This bug affects only devices using this package. Other devices work as
292+
expected and can be addressed as specified.
293+
```
280294

281295
##### Write
282296

@@ -285,8 +299,10 @@ to the `ON` state.
285299

286300
###### Single
287301

288-
> The function code `0x05` is used to write a single output to either `ON` or
302+
```{note}
303+
The function code `0x05` is used to write a single output to either `ON` or
289304
`OFF` in a remote device.
305+
```
290306

291307
With the function [`write_single_coil`](umodbus.tcp.TCP.write_single_coil)
292308
a single coil status can be set.
@@ -302,16 +318,23 @@ print('Result of setting COIL {}: {}'.format(coil_address, operation_status))
302318
# Result of setting COIL 123: True
303319
```
304320

305-
> :warning: Please be aware of bug
306-
[#15](https://github.com/brainelectronics/micropython-modbus/issues/15). It is
307-
not possible to write to a specific position within a configured list of multiple coils on a MicroPython Modbus TCP client device. This bug affects only
308-
devices using this package. Other devices work as expected and can be addressed
309-
as specified.
321+
```{eval-rst}
322+
.. warning::
323+
Please be aware of `bug #15 <https://github.com/brainelectronics/micropython-modbus/issues/15>`_.
324+
325+
It is not possible to write to a specific position within a configured
326+
list of multiple coils on a MicroPython Modbus TCP client device.
327+
328+
This bug affects only devices using this package. Other devices work as
329+
expected and can be addressed as specified.
330+
```
310331

311332
###### Multiple
312333

313-
> The function code `0x0F` is used to force each coil in a sequence of coils to
334+
```{note}
335+
The function code `0x0F` is used to force each coil in a sequence of coils to
314336
either `ON` or `OFF` in a remote device.
337+
```
315338

316339
With the function [`write_multiple_coils`](umodbus.tcp.TCP.write_multiple_coils)
317340
multiple coil states can be set at once.
@@ -327,11 +350,17 @@ print('Result of setting COIL {}: {}'.format(coil_address, operation_status))
327350
# Result of setting COIL 126: True
328351
```
329352

330-
> :warning: Please be aware of bug
331-
[#35](https://github.com/brainelectronics/micropython-modbus/issues/35). It is
332-
not possible to write to a specific position within a configured list of multiple coils on a MicroPython Modbus TCP client device. Setting coil 127, which is `1` in the above example will throw an error. This bug affects only
333-
devices using this package. Other devices work as expected and can be addressed
334-
as specified.
353+
```{eval-rst}
354+
.. warning::
355+
Please be aware of `bug #35 <https://github.com/brainelectronics/micropython-modbus/issues/35>`_.
356+
357+
It is not possible to write to a specific position within a configured
358+
list of multiple coils on a MicroPython Modbus TCP client device. Setting
359+
coil `127`, which is `1` in the above example will throw an error.
360+
361+
This bug affects only devices using this package. Other devices work as
362+
expected and can be addressed as specified.
363+
```
335364

336365
#### Discrete inputs
337366

@@ -340,8 +369,10 @@ or `1` (on). Unlike [coils](#coils), these cannot be set.
340369

341370
##### Read
342371

343-
> The function code `0x02` is used to read from 1 to 2000 contiguous status of
372+
```{note}
373+
The function code `0x02` is used to read from 1 to 2000 contiguous status of
344374
discrete inputs in a remote device.
375+
```
345376

346377
With the function [`read_discrete_inputs`](umodbus.tcp.TCP.read_discrete_inputs)
347378
discrete inputs can be read.
@@ -365,8 +396,10 @@ represent `-32768` through `32767`.
365396

366397
##### Read
367398

368-
> The function code `0x03` is used to read the contents of a contiguous block
399+
```{note}
400+
The function code `0x03` is used to read the contents of a contiguous block
369401
of holding registers in a remote device.
402+
```
370403

371404
With the function
372405
[`read_holding_registers`](umodbus.tcp.TCP.read_holding_registers) a single
@@ -384,13 +417,18 @@ print('Status of HREG {}: {}'.format(hreg_address, register_value))
384417
# Status of HREG 94: [29, 38, 0]
385418
```
386419

387-
> :warning: Please be aware of bug
388-
[#35](https://github.com/brainelectronics/micropython-modbus/issues/35). It is
389-
not possible to read a specific position within a configured list of multiple
390-
holding registers on a MicroPython Modbus TCP client device. Reading holding
391-
register 95, holding the value `38` in the above example will throw an error.
392-
This bug affects only devices using this package. Other devices work as
393-
expected and can be addressed as specified.
420+
```{eval-rst}
421+
.. warning::
422+
Please be aware of `bug #35 <https://github.com/brainelectronics/micropython-modbus/issues/35>`_.
423+
424+
It is not possible to read a specific position within a configured list of
425+
multiple holding registers on a MicroPython Modbus TCP client device.
426+
Reading holding register `95`, holding the value `38` in the above example
427+
will throw an error.
428+
429+
This bug affects only devices using this package. Other devices work as
430+
expected and can be addressed as specified.
431+
```
394432

395433
##### Write
396434

@@ -399,8 +437,10 @@ in case signed values are used.
399437

400438
###### Single
401439

402-
> The function code `0x06` is used to write a single holding register in a
440+
```{note}
441+
The function code `0x06` is used to write a single holding register in a
403442
remote device.
443+
```
404444

405445
With the function
406446
[`write_single_register`](umodbus.tcp.TCP.write_single_register) a single
@@ -420,8 +460,10 @@ print('Result of setting HREG {}: {}'.format(hreg_address, operation_status))
420460

421461
###### Multiple
422462

423-
> The function code `0x10` is used to write a block of contiguous registers
463+
```{note}
464+
The function code `0x10` is used to write a block of contiguous registers
424465
(1 to 123 registers) in a remote device.
466+
```
425467

426468
With the function
427469
[`write_multiple_registers`](umodbus.tcp.TCP.write_multiple_registers)
@@ -439,13 +481,19 @@ print('Result of setting HREG {}: {}'.format(hreg_address, operation_status))
439481
# Result of setting HREG 94: True
440482
```
441483

442-
> :warning: Please be aware of bug
443-
[#35](https://github.com/brainelectronics/micropython-modbus/issues/35). It is
444-
not possible to write to a specific position within a configured list of
445-
multiple holding registers on a MicroPython Modbus TCP client device. Setting
446-
holding register 95+96 to e.g. `[-12, 30001]` in the above example will throw
447-
an error. This bug affects only devices using this package. Other devices work
448-
as expected and can be addressed as specified.
484+
```{eval-rst}
485+
.. warning::
486+
487+
Please be aware of `bug #35 <https://github.com/brainelectronics/micropython-modbus/issues/35>`_.
488+
489+
It is not possible to write to a specific position within a configured
490+
list of multiple holding registers on a MicroPython Modbus TCP client
491+
device. Setting holding register `95 + 96` to e.g. `[-12, 30001]` in the
492+
above example will throw an error.
493+
494+
This bug affects only devices using this package. Other devices work as
495+
expected and can be addressed as specified.
496+
```
449497

450498
#### Input registers
451499

@@ -456,8 +504,10 @@ be set.
456504

457505
##### Read
458506

459-
> The function code `0x04` is used to read from 1 to 125 contiguous input
507+
```{note}
508+
The function code `0x04` is used to read from 1 to 125 contiguous input
460509
registers in a remote device.
510+
```
461511

462512
With the function [`read_input_registers`](umodbus.tcp.TCP.read_input_registers)
463513
input registers can be read.

0 commit comments

Comments
 (0)