xreef / LoRa_E32_Series_Library

Arduino LoRa EBYTE E32 device library complete and tested with Arduino, esp8266, esp32, STM32 and Raspberry Pi Pico (rp2040 boards). sx1278/sx1276
https://www.mischianti.org
Other
348 stars 72 forks source link

ESP32 & SoftwareSerial error #46

Closed nravanelli closed 1 year ago

nravanelli commented 2 years ago

I seem to be having an issue with the following code which mirrors examples:

#include <SoftwareSerial.h>
// LORA communication
#include "LoRa_E32.h"
//------ SOFTWARE SERIAL 
#define RX_PIN 19                                          // Rx pin 
#define TX_PIN 23                                          // Tx pin                                    
SoftwareSerial mySerial(RX_PIN, TX_PIN);                   

//-------------LORA E32 connection
LoRa_E32 e32ttl(&mySerial);

and I am met with this error: no matching function for call to 'LoRa_E32::LoRa_E32(SoftwareSerial*)'

Based on the constructors tutorials provided, this should work, unless there is something different with an esp32? ... https://www.mischianti.org/2019/10/21/lora-e32-device-for-arduino-esp32-or-esp8266-library-part-2/#Constructor

xreef commented 2 years ago

Hi nravanelli, by default, I disable SoftwareSerial for ESP32 because ESP32 allows selecting pins to assign to his HardwareSerial. If you want to enable that functionality, you must add#define ACTIVATE_SOFTWARE_SERIALbefore the use of It. Bye Renzo

nravanelli commented 2 years ago

Added #define ACTIVATE_SOFTWARE_SERIAL before #include "LoRa_E32.h" and it doesn't compile for ESP32...

undefined reference to 'LoRa_E32::LoRa_E32(SoftwareSerial*, UART_BPS_RATE)'

exact error code: Error compiling for board ESP32 Dev Module

Thoughts?

EDIT: Can confirm the same issue occurs when modifying the example 'sendFixedTransmission.ino' to enable SoftwareSerial using an ESP32.

Arduino: 1.8.16 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"
sketch\sendFixedTransmission.ino.cpp.o:(.literal.startup._GLOBAL__sub_I_mySerial+0x8): undefined reference to `LoRa_E32::LoRa_E32(SoftwareSerial*, UART_BPS_RATE)'
sketch\sendFixedTransmission.ino.cpp.o: In function `_GLOBAL__sub_I_mySerial':
C:....\sendFixedTransmission.ino:25: undefined reference to `LoRa_E32::LoRa_E32(SoftwareSerial*, UART_BPS_RATE)'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board ESP32 Dev Module.
xreef commented 1 year ago

Put the #define ACTIVATE_SOFTWARE_SERIAL inside LoRa_E32.h file, probably the value isn't propagated in the other files. Bye Renzo