Fixed SoftwareSerial for ESP8266 core 2.6.0
This commit is contained in:
parent
e61e9afbe5
commit
1f26d3d5a3
2 changed files with 12 additions and 0 deletions
|
@ -5,7 +5,11 @@ ISerial::ISerial(Module* mod) {
|
|||
}
|
||||
|
||||
void ISerial::begin(long speed) {
|
||||
#if defined(ESP8266)
|
||||
_mod->ModuleSerial->begin(speed, _mod->getRx(), _mod->getTx(), SWSERIAL_8N1);
|
||||
#else
|
||||
_mod->ModuleSerial->begin(speed);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ISerial::listen() {
|
||||
|
|
|
@ -9,6 +9,9 @@ Module::Module(int rx, int tx, HardwareSerial* useSer) {
|
|||
|
||||
#ifdef SOFTWARE_SERIAL_UNSUPPORTED
|
||||
ModuleSerial = useSer;
|
||||
#elif defined(ESP8266)
|
||||
ModuleSerial = new SoftwareSerial();
|
||||
(void)useSer;
|
||||
#else
|
||||
ModuleSerial = new SoftwareSerial(_rx, _tx);
|
||||
(void)useSer;
|
||||
|
@ -36,6 +39,9 @@ Module::Module(int cs, int int0, int int1, int rx, int tx, SPIClass& spi, SPISet
|
|||
|
||||
#ifdef SOFTWARE_SERIAL_UNSUPPORTED
|
||||
ModuleSerial = useSer;
|
||||
#elif defined(ESP8266)
|
||||
ModuleSerial = new SoftwareSerial();
|
||||
(void)useSer;
|
||||
#else
|
||||
ModuleSerial = new SoftwareSerial(_rx, _tx);
|
||||
(void)useSer;
|
||||
|
@ -63,6 +69,8 @@ void Module::init(uint8_t interface, uint8_t gpio) {
|
|||
case USE_UART:
|
||||
#if defined(ESP32)
|
||||
ModuleSerial->begin(baudrate, SERIAL_8N1, _rx, _tx);
|
||||
#elif defined(ESP8266)
|
||||
ModuleSerial->begin(baudrate, _rx, _tx, SWSERIAL_8N1);
|
||||
#else
|
||||
ModuleSerial->begin(baudrate);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue