Skip to content

Conversation

@brainelectronics
Copy link

By this small fix it is possible to compile and use the lib for non ESP devices like STM32F103 or Arduino Uno. Of course only ModbusRTU is usable.

@emelianov
Copy link
Owner

Hello,
In general I doesn't mind.

I just suggest leave in peace bool begin(HardwareSerial* port, int16_t txPin=-1); declaration but extend API with

void setBaudrate(uint32 baud = -1);

Extending API this way will also allow change baud rate on-fly for ESP and non-ESP both. I'm assuming that call of setBaudrate should be optional for ESP.
Also it's required to add changes to RTU-master and RTU-slave examples to make it able to be belt on classic Arduino platforms.

Can you change you pull request according above mentioned?

Also, please, provide information on c sdtlib implementation was used for testing.

@brainelectronics
Copy link
Author

Everything changed accordingly. Tested on ESP32, ESP8266 and STM32F103 boards

@emelianov emelianov changed the base branch from master to 3.0.1 May 17, 2020 17:07
@emelianov emelianov merged commit c177eed into emelianov:3.0.1 May 17, 2020
@emelianov
Copy link
Owner

At this point i want to add some slight changes and perform additional checking before merging to master.

@emelianov
Copy link
Owner

@brainelectronics
I've put _t calculation to setBaudrate(), so no need to store baudrate set (save 4 bites of RAM per Modbus instance).
Initialisation should be opposite order:

mb.begin(...);
mb.setBaudrate(19200);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants