Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MinorChanges: SoftwareSerial for RS485 #1300

Open
ploeffler opened this issue Jun 14, 2019 · 3 comments · May be fixed by #1510
Open

MinorChanges: SoftwareSerial for RS485 #1300

ploeffler opened this issue Jun 14, 2019 · 3 comments · May be fixed by #1510

Comments

@ploeffler
Copy link

ploeffler commented Jun 14, 2019

Todo:
+) include SoftwareSerial to drivers
+) include espsoftwareserial to drivers

Changes in File MySensors.h
replace line 372 with

#if defined(MY_RS485_SWSERIAL) #if defined(ESP8266) || defined(ESP32) #include "drivers/ESPSoftwareSerial/SoftwareSerial.cpp" #elif #include "drivers/SoftwareSerial/SoftwareSerial.cpp" #endif #elif #include "drivers/AltSoftSerial/AltSoftSerial.cpp" #endif

File hal/transport/RS485/MyTransportRS485.cpp
replace line 90 with:

#if defined(MY_RS485_SWSERIAL) SoftwareSerial& _dev = MY_RS485_SWSERIAL; #elif #include "drivers/AltSoftSerial/AltSoftSerial.cpp" #endif

thank you! (sorry for the formating)

@mfalkvidd
Copy link
Member

Thanks for your suggestion.

AVR (and maybe others) already use soft serial for rs485 by default, so there is no need to introduce a new define.

include SoftwareSerial to drivers

Could you describe which software serial you mean?

include espsoftwareserial to drivers

Do you mean https://github.com/plerup/espsoftwareserial ? (There are multiple libraries matching that name and it would be good if we knew which one to use.)

For reference, AltSoftSerial (which is currently used if a RS485 node or gateway is compiled for ESP8266/ESP32 with MySensors) provides this output during compilation:

In file included from ...\Arduino\libraries\MySensors/drivers/AltSoftSerial/AltSoftSerial.cpp:35:0,

                 from ...\Arduino\libraries\MySensors/MySensors.h:372,

                 from ...\Arduino\libraries\MySensors\examples\GatewaySerialRS485\GatewaySerialRS485.ino:89:

...\Arduino\libraries\MySensors/drivers/AltSoftSerial/config/AltSoftSerial_Boards.h:146:2: error: #error "Please define your board timer and pins"

 #error "Please define your board timer and pins"

  ^

Using library MySensors at version 2.3.2-beta in folder: ...\Arduino\libraries\MySensors

@ploeffler
Copy link
Author

sorry, no experiences with Altsoftserial, except the same you had (and had no motivation to read that part of the code too)

SoftwareSerial: i have read the discussions (some months ago) with the changes in the source too, its really not important WHICH of them to be used. just keep in mind that ESP's need another one then the AVR's

@kasparsd kasparsd linked a pull request Oct 29, 2021 that will close this issue
@kasparsd
Copy link

I've created #1510 which implements the suggest fix. This enables RS485 communication on any compatible pin pair while keeping the default Serial interface for debugging purposes.

Please let me know if there is anything that needs to be adjusted to make it compatible with the project standards and concepts. Thanks!

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

Successfully merging a pull request may close this issue.

3 participants