espressif / esp-modbus

ESP-Modbus - the officially suppported library for Modbus protocol (serial RS485 + TCP over WiFi or Ethernet).
Apache License 2.0
85 stars 46 forks source link

Error when add esp-modbus-release-v2.0 into my project (IDFGH-13192) #65

Closed TiDiChi closed 1 week ago

TiDiChi commented 2 weeks ago

Hi my friend, I am create a project with modbus RS485. I added esp-modbus-release-v2.0 component into "components" folder of project and then i used command "idf.py fullclean", but when i built my project, it displayed error: "fatal error: mbcontroller.h: No such file or directory 4 | #include "mbcontroller.h" | ^~~~ compilation terminated. ninja: build stopped: subcommand failed. BUG: component_requirements.py: mbcontroller.h found in component esp-modbus-release-v2.0 which is already in the requirements list of ses-device". I don't understand this error because i add component esp-modbus-release-v2.0 to requirements list of ses-device component.

alisitsyn commented 4 days ago

Hi @TiDiChi, Have you been able to solve the issue with esp-modbus v2.0? In order to create the project based on v2:

  1. Copy the example code from here to your root/mb_serial_master project folder.
  2. Copy the following folders and files into proj_root/components/esp-modbus_v2 folder from esp-modbus_v2 release.
    esp-modbus/modbus
    esp-modbus/CMakeLists.txt
    esp-modbus/component.mk
    esp-modbus/idf_component.yml
    esp-modbus/Kconfig
    esp-modbus/LICENSE
    esp-modbus/linker.lf
    esp-modbus/pytest.ini
    esp-modbus/README.md  
  3. Copy the common data library into root of the v2 folder (where the master project is located).
  4. change the mb_serial_master/main/idf_component.yml as below:
    dependencies:
    idf: ">=4.1"
    mb_example_common:
    path: "../../mb_example_common"
  5. Type the commands in the terminal: "idf.py fullclean;idf.py build"

You should be able to build the project. Let me know if you have any questions.