mongoose-os-libs / modbus

Modbus implementation
Other
1 stars 4 forks source link

Error compiling for ESP8266 #1

Open fbalestrini opened 1 year ago

fbalestrini commented 1 year ago

I would use the library on ESP8266 boards but there are some errors compiling the source code of my demo project.

This is the most significant piece of my mos.yml:

config_schema:
  - ["modbus.enable", true]
conds:
  - when: mos.platform == "esp8266"
    apply:
      config_schema:
        - ["modbus.uart_no", 0]
        - ["modbus.tx_en_enable", false]
        - ["modbus.uart_tx_pin", 1]
        - ["modbus.uart_rx_pin", 3]
        - ["debug.stdout_uart", 1]
        - ["debug.stderr_uart", 1]
libs:
  - origin: https://github.com/mongoose-os-libs/modbus

These are some of the compile errors:

deps/modbus/src/mgos_modbus.c:498:17: error: 'struct mgos_uart_dev_config' has no member named 'rx_gpio'
deps/modbus/src/mgos_modbus.c:501:17: error: 'struct mgos_uart_dev_config' has no member named 'tx_gpio'
deps/modbus/src/mgos_modbus.c:518:42: error: 'struct mgos_uart_dev_config' has no member named 'tx_gpio'
deps/modbus/src/mgos_modbus.c:517:56: error: 'struct mgos_uart_dev_config' has no member named 'rx_gpio'
deps/modbus/src/mgos_modbus.c:512:13: error: 'struct mgos_uart_dev_config' has no member named 'hd'
...

Looking forward for your support. Many thanks in advance.

fbalestrini commented 1 year ago

@pimvanpelt in order to let this library working on ESP8266, I developed a SOFTUART library for Mongoose OS. I would like to get your directions on how to publish my library to mongoose-os-libs organization.

pimvanpelt commented 1 year ago

I would socialize your library with the maintainers of Mongoose OS - @cpq can help navigate. I did a lot of work for Mongoose OS over the years, but more recently have been more of a user :)

fbalestrini commented 1 year ago

I thank you for your feedback. I met @cpq on Skype years go while my company (ABB SpA) was exploring Mongoose OS. I really hope he can help me.

cpq commented 1 year ago

@fbalestrini thank you! Created https://github.com/mongoose-os-libs/soft-uart/ and invited you there as a maintainer.

fbalestrini commented 1 year ago

@cpq many thanks. The https://github.com/mongoose-os-libs/soft-uart/ library is now ready to use (on ESP8266 at least)

fbalestrini commented 1 year ago

Dear @rojer I cloned your modbus library for integrating the use of the soft-uart library. This makes your library usable on ESP8266 as well.

In addition, I did some optimizations to the source code and I applied the standard naming convention for public function names.

I would like to have your support for testing my changes on ESP32 and merging them into your official library with your blessing. This will fix this compile time issue as well.

Looking forward for your reply.

fbalestrini commented 1 year ago

Hi @cpq, I did finalize the soft-uart library. Now I would integrate it into the modbus library in order to make it compatible with ESP8266 as well.

Is there any chance to share and discuss these changes with you or with @rojer before creating the pull request?