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

invalid conversion from 'uint16_t' to 'SerialConfig' #14

Open
mostafahk opened this issue Aug 21, 2021 · 4 comments · May be fixed by #16 or #53
Open

invalid conversion from 'uint16_t' to 'SerialConfig' #14

mostafahk opened this issue Aug 21, 2021 · 4 comments · May be fixed by #16 or #53
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@mostafahk
Copy link

mostafahk commented Aug 21, 2021

In last update of ESP8266 SDK, I got many errors:

.pio\libdeps\esp12e\ArduinoRS485\src\RS485.cpp:65:28: error: invalid conversion from 'uint16_t' {aka 'short unsigned int'} to 'SerialConfig' [-fpermissive]

error occurs in _serial->begin call.

I solved problem with following changes:

In RS485.h:

#ifdef __AVR__
#define RS485_DEFAULT_DE_PIN 2
#define RS485_DEFAULT_RE_PIN -1
#elif defined(ESP32) || defined(ESP8266)
#define RS485_DEFAULT_DE_PIN 0
#define RS485_DEFAULT_RE_PIN 0
#else
#define RS485_DEFAULT_DE_PIN A6
#define RS485_DEFAULT_RE_PIN A5
#endif

#if defined(ESP32) || defined(ESP8266)
#define RS485_SER_CONF_TYPE SerialConfig
#else
#define RS485_SER_CONF_TYPE uint16_t
#endif
....

class RS485Class{
....
RS485_SER_CONF_TYPE _config;
...
}

In RS485.cpp:

_serial->begin(baudrate, (RS485_SER_CONF_TYPE)config);
@mostafahk
Copy link
Author

I've made my change in a fork and my pull request is here.

@kscholty
Copy link

Could someone please merge the according PR?
This ssue makes it impossible to use the lib on ESP MCs. The ESP32's SERIAL_8N1 config value is a 32 bit value (0x800001C)

@per1234 per1234 linked a pull request Jan 14, 2023 that will close this issue
@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself status: in progress Work is in progress on this labels Jan 14, 2023
@rseidt
Copy link

rseidt commented Apr 3, 2024

I stumbled upon this problem, and (once again) fixed that issue, because the mentined PR #16 seem abononed (last commit 2 years ago). Please find an updated PR here: Added Compatibility to ESP32 and ESP8266 #53

@rseidt rseidt linked a pull request Apr 3, 2024 that will close this issue
@per1234 per1234 linked a pull request Apr 12, 2024 that will close this issue
@per1234 per1234 added type: enhancement Proposed improvement and removed type: imperfection Perceived defect in any part of project status: in progress Work is in progress on this labels Apr 12, 2024
@mattl1598
Copy link

is this going to be approved soon? would be nice to use a proper release version of the library and keep it updated through the arduino ide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
5 participants