harihanv / esp32-modbus-gateway

esp32 port of modbus RTU to TCP Arduino gateway
GNU General Public License v3.0
56 stars 28 forks source link

Fix compile issues with actual libraries (ArduinoRS485/StreamLib) #8

Open plewka opened 1 year ago

plewka commented 1 year ago

ESP32 - I had to add a define into ArduinoRS485 ArduinoRS485.h, globally in *.ino it didn't work #define SERIAL_PORT_HARDWARE Serial2

and I had to comment out the flush in StreamLib TeePrint.h since "Print" for ESP32 doesn't need/have a flush virtual void flush() { // out1.flush(); // out2.flush(); }

plewka commented 1 year ago

There are direct values for the bitrate of dbg_serial and mbus_serial. I replaced these via this in main. const uint16_t MBUS_BITRATE = 19200; const uint32_t DBG_BITRATE = 115200;

I moved this to from 01-interfaces.ino to setup() of the "main" *.ino to see dbg from setup and main loop:

ifdef DEBUG

Serial.begin(DBG_BITRATE);

endif

At least debug works now, Webserver is there, but there is an index.html response without body caused by sendPage. ChunkedPrint doesn't work....

plewka commented 1 year ago

Got it compile and output the web page. MemberFunction flush() is not in the base-class print but is required here. I removed the virtual property at flush() inside StreamLib ChunkedPrint.h

The page is delivered in chunks, but one of the chunks was much bigger than 64 chars so I changed the buffer size const uint16_t webOutBufferSize = 1024;

martin8310 commented 1 year ago

Helllo,

has somebody a bin file for me?

regards Martin

madfatpat commented 1 year ago

Hi harish

i have done all the changes mentioned in all the posts regarding this project including moving header files to the project directory and still getting the same compile errors

i am running an espnode32 board with a wiznet 5500 eth chip

WARNING: library ArduinoRS485 claims to run on samd, mbed_portenta, mbed_opta architecture(s) and may be incompatible with your current board which runs on esp32 architecture(s). RS485.cpp:209:18: error: 'SERIAL_PORT_HARDWARE' was not declared in this scope RS485Class RS485(SERIAL_PORT_HARDWARE, RS485_DEFAULT_TX_PIN, RS485_DEFAULT_DE_PIN, RS485_DEFAULT_RE_PIN); ^~~~~~~~ Multiple libraries were found for "StreamLib.h" Used: C:\Users\Pat\Documents\Arduino\libraries\StreamLib Not used: C:\Users\Pat\Documents\Arduino\libraries\StreamLib-master Multiple libraries were found for "WiFi.h" Used: C:\Users\Pat\Documents\ArduinoData\packages\esp32\hardware\esp32\2.0.9\libraries\WiFi Not used: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\libraries\WiFi exit status 1 'SERIAL_PORT_HARDWARE' was not declared in this scope

any help would be apricated i really want to run this package but have been banging my head on the wall for over a week now

To be honest i would love the rs485 side for other projects but i am trying to use your modbus tcp and configuration panel to create a can bus to modbus tcp converter..

TIA pat

harihanv commented 1 year ago

This port for wifi. It will not work for wiznet network chip.

On Thu, 7 Sept, 2023, 7:47 pm madfatpat, @.***> wrote:

Hi harish

i have done all the changes mentioned in all the posts regarding this project including moving header files to the project directory and still getting the same compile errors

i am running an espnode32 board with a wiznet 5500 eth chip

WARNING: library ArduinoRS485 claims to run on samd, mbed_portenta, mbed_opta architecture(s) and may be incompatible with your current board which runs on esp32 architecture(s). RS485.cpp:209:18: error: 'SERIAL_PORT_HARDWARE' was not declared in this scope RS485Class RS485(SERIAL_PORT_HARDWARE, RS485_DEFAULT_TX_PIN, RS485_DEFAULT_DE_PIN, RS485_DEFAULT_RE_PIN); ^~~~~~~~ Multiple libraries were found for "StreamLib.h" Used: C:\Users\Pat\Documents\Arduino\libraries\StreamLib Not used: C:\Users\Pat\Documents\Arduino\libraries\StreamLib-master Multiple libraries were found for "WiFi.h" Used: C:\Users\Pat\Documents\ArduinoData\packages\esp32\hardware\esp32\2.0.9\libraries\WiFi Not used: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\libraries\WiFi exit status 1 'SERIAL_PORT_HARDWARE' was not declared in this scope

any help would be apricated i really want to run this package but have been banging my head on the wall for over a week now

— Reply to this email directly, view it on GitHub https://github.com/harihanv/esp32-modbus-gateway/issues/8#issuecomment-1710236809, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEH5LAOKFEDJBNQDL547B3XZHJPDANCNFSM6AAAAAAT355VXY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

madfatpat commented 12 months ago

Hi

is there any way this could be ported to esp32 wroom with ethernet? problem is wifi is not stable enough for datalogging. this would make it a very powerfull platform

harihanv commented 11 months ago

yes, it can be. Take the original code which is based on arduino with ethernet support and needs to be ported esp32 wroom with ethernet.

On Wed, 13 Sept 2023 at 15:29, madfatpat @.***> wrote:

Hi

is there any way this could be ported to esp32 wroom with ethernet? problem is wifi is not stable enough for datalogging. this would make it a very powerfull platform

— Reply to this email directly, view it on GitHub https://github.com/harihanv/esp32-modbus-gateway/issues/8#issuecomment-1717323913, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEH5LAZ36AYTVH4PCLXSBLX2F7YHANCNFSM6AAAAAAT355VXY . You are receiving this because you commented.Message ID: @.***>

ErasmusFerdie commented 10 months ago

Hi harihanv (https://github.com/harihanv) i'm new to this and are trying an industrial modbus TCP RTU bridge, i'm using ESP32 wemos R3 board and W5500 ethernet shield but i get the following compile error in arduino IDE platform.

exit status 1

Compilation error: variable or field 'WiFiDisconnected' declared void

Thank you for a great project