ArduinoRS485 icon indicating copy to clipboard operation
ArduinoRS485 copied to clipboard

invalid conversion from 'uint16_t' to 'SerialConfig'

Open mostafahk opened this issue 3 years ago • 4 comments

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 avatar Aug 21 '21 14:08 mostafahk

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

mostafahk avatar Aug 30 '21 08:08 mostafahk

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)

kscholty avatar Nov 15 '21 15:11 kscholty

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 avatar Apr 03 '24 19:04 rseidt

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

mattl1598 avatar Apr 23 '24 22:04 mattl1598