ArduinoRS485
ArduinoRS485 copied to clipboard
invalid conversion from 'uint16_t' to 'SerialConfig'
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);
I've made my change in a fork and my pull request is here.
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)
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
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