Fixed software serial macro warnings

This commit is contained in:
jgromes 2019-10-02 19:41:31 +02:00
parent b8128c15a6
commit 47be7923da
3 changed files with 8 additions and 6 deletions

View file

@ -7,7 +7,7 @@ Module::Module(int rx, int tx, HardwareSerial* useSer) {
_int0 = -1;
_int1 = -1;
#if SOFTWARE_SERIAL_UNSUPPORTED
#ifdef SOFTWARE_SERIAL_UNSUPPORTED
ModuleSerial = useSer;
#else
ModuleSerial = new SoftwareSerial(_rx, _tx);
@ -34,7 +34,7 @@ Module::Module(int cs, int int0, int int1, int rx, int tx, SPIClass& spi, SPISet
_spi = &spi;
_spiSettings = spiSettings;
#if SOFTWARE_SERIAL_UNSUPPORTED
#ifdef SOFTWARE_SERIAL_UNSUPPORTED
ModuleSerial = useSer;
#else
ModuleSerial = new SoftwareSerial(_rx, _tx);

View file

@ -27,7 +27,7 @@ class Module {
\param serial HardwareSerial to be used on ESP32 and SAMD. Defaults to 1
*/
#if SOFTWARE_SERIAL_UNSUPPORTED
#ifdef SOFTWARE_SERIAL_UNSUPPORTED
Module(int tx, int rx, HardwareSerial* useSer = &Serial1);
#else
Module(int tx, int rx, HardwareSerial* useSer = nullptr);
@ -84,7 +84,7 @@ class Module {
\param serial HardwareSerial to be used on ESP32 and SAMD. Defaults to 1
*/
#if SOFTWARE_SERIAL_UNSUPPORTED
#ifdef SOFTWARE_SERIAL_UNSUPPORTED
Module(int cs, int int0, int int1, int rx, int tx, SPIClass& spi = SPI, SPISettings spiSettings = SPISettings(2000000, MSBFIRST, SPI_MODE0), HardwareSerial* useSer = &Serial1);
#else
Module(int cs, int int0, int int1, int rx, int tx, SPIClass& spi = SPI, SPISettings spiSettings = SPISettings(2000000, MSBFIRST, SPI_MODE0), HardwareSerial* useSer = nullptr);
@ -96,7 +96,7 @@ class Module {
/*!
\brief Internal SoftwareSerial instance.
*/
#if SOFTWARE_SERIAL_UNSUPPORTED
#ifdef SOFTWARE_SERIAL_UNSUPPORTED
HardwareSerial* ModuleSerial;
#else
SoftwareSerial* ModuleSerial;

View file

@ -8,7 +8,9 @@
#endif
// the following platforms do not support SoftwareSerial library
#define SOFTWARE_SERIAL_UNSUPPORTED (defined(ESP32) || defined(SAMD_SERIES) || defined (ARDUINO_ARCH_STM32))
#if defined(ESP32) || defined(SAMD_SERIES) || defined(ARDUINO_ARCH_STM32)
#define SOFTWARE_SERIAL_UNSUPPORTED
#endif
// uncomment to enable static-only memory management: no dynamic allocation will be performed
// Warning: Large static arrays will be created in some methods. It is also not advised to send large packets in this mode.