xreef / EByte_LoRa_E220_Series_Library

Arduino LoRa EBYTE E220 LLCC68 device library complete and tested with Arduino, esp8266, esp32, STM32 and Raspberry Pi Pico (rp2040 boards)..
https://www.mischianti.org/category/my-libraries/lora-e220-llcc68-devices/
Other
88 stars 22 forks source link

Can't use espSoftwareSerial #21

Closed lovefool closed 8 months ago

lovefool commented 8 months ago

I made a small test environment of E220 library with Wemos D1 mini (8266) and SoftwareSerial, and this works great. Then I wanted to use Wemos D1 mini ESP32. For using same schmetic, I added espSoftSerial library (not harware Serial1,2).

When I compile program, and got this error. It seems espSoftware Serial return value differs from original SoftwareSerial.

I try to cast "byte", "unsigned char" and "uint8_t" not work. Any work around for this?

Original code that works with 8266 Code SoftwareSerial mySerial(E220_rxd, E220_txd); LoRa_E220 e220ttl(&mySerial, E220_aux, E220_m0, E220_m1); Error error: invalid conversion from 'EspSoftwareSerial::UART' {aka 'EspSoftwareSerial::BasicUART'} to 'byte' {aka 'unsigned char'} [-fpermissive] LoRa_E220 e220ttl(&mySerial, E220_aux, E220_m0, E220_m1);

Error when CASTING to byte Code SoftwareSerial mySerial(E220_rxd, E220_txd); LoRa_E220 e220ttl((unsighned)&mySerial, E220_aux, E220_m0, E220_m1); Error error: cast from 'SoftwareSerial' {aka 'EspSoftwareSerial::BasicUART'} to 'byte' {aka 'unsigned char'} loses precision [-fpermissive]

lovefool commented 8 months ago

Looking into espSoftwareSerial, esp32SoftSerial but not found the cause. And then looking into E220 library, found the reason. In LoRa_E220.h, ESP32 and some device can use only Hardware Serial. When I modify this line, at least compile succeed.

if !defined(ARDUINO_ARCH_STM32) && !defined(ESP32) && !defined(ARDUINO_ARCH_SAMD) && !defined(ARDUINO_ARCH_MBED) && !defined(STM32F1) && !defined(STM32F4)

#define ACTIVATE_SOFTWARE_SERIAL

endif

if defined(ESP32)

#define HARDWARE_SERIAL_SELECTABLE_PIN

endif

lovefool commented 8 months ago

I added espSoftwareSerial library and modified LoRa_E220.h, a configuration program can communicte with E220 over SoftwareSerial.