emelianov / modbus-esp8266

Most complete Modbus library for Arduino. A library that allows your Arduino board to communicate via Modbus protocol, acting as a master, slave or both. Supports network transport (Modbus TCP) and Serial line/RS-485 (Modbus RTU). Supports Modbus TCP Security for ESP8266/ESP32.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API documentation unclear

rob040 opened this issue · comments

commented

I think this library can do everything I need, however, the documentation in the API.md file and the lack of documentation in the source code makes it hard to understand.

  • The API.md says that the master() function is TCP specific in the server API section. I'm missing this for RTU mode but the RTU-master example shows that it is needed. So, this must be missing from the RTU API doc.
  • The current class definition public methods have zero comments. Adding function level documentation would allow for generating API documentation from code, automatically updated when functionality changes. Checkout Doxygen for that.
  • The file ModbusAPI.h, a file that screams I'm very important, is about as unreadable as it can get with its templates and multi-line macros and zero comments.
  • The double old+new (politically corrected) naming for master/slave, which also run double duty (master/slave mode selection AND slave/master interrogate (?)) is quite confusing.
  • Source code with a mix of tabs and spaces, where the tab settings differ from my editor, makes it harder to follow the code because indentation is off (I quickly run 'Format document' on it to get uniformity on indents and braces)
  • It is unclear to me of what is the full set of methods available once master or slave mode is selected and communication method (RTU/TCP) and communication interface (RS485/Wifi/Ethernet) has been chosen. It appears to me that there is no limitation of combination errors the library user can make. It would be helpful when e.g. through conditional compiling, non-selected modes would inhibit the use (compile, linking AND intellisense hints) of invalid classes and methods.
  • wrt modbus functions, the actual used modbus function code is only occasionally mentioned in the API doc. Room for improvement.
  • When different terminology than standard Modbus is used, it will be helpful if there are pointers to the documented terminology.
  • It is unknown to me, and it is nowhere described, but where do the push/pull methods differ from read/write methods.
  • and what are the ...IststoCoil and ...CoiltoIsts and HregtoIreg and IregtoHreg methods doing?
  • There is mention of "local registers". Is that some caching method? How to use?
  • Which modbus methods are or can be Blocking ?
  • file modbusSettings.h contain compiletime settings, however, it is part of the library, which normally is read-only.

Care to respond on these?