mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-16 15:26:29 +00:00
Reduce TasmotaSerial iRam usage
Reduce TasmotaSerial iRam usage for core stage and Pre-2.6 (#6373)
This commit is contained in:
parent
612654ffca
commit
c44765d37f
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "TasmotaSerial",
|
"name": "TasmotaSerial",
|
||||||
"version": "2.3.3",
|
"version": "2.3.4",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"serial", "io", "TasmotaSerial"
|
"serial", "io", "TasmotaSerial"
|
||||||
],
|
],
|
@ -1,5 +1,5 @@
|
|||||||
name=TasmotaSerial
|
name=TasmotaSerial
|
||||||
version=2.3.3
|
version=2.3.4
|
||||||
author=Theo Arends
|
author=Theo Arends
|
||||||
maintainer=Theo Arends <theo@arends.com>
|
maintainer=Theo Arends <theo@arends.com>
|
||||||
sentence=Implementation of software serial with hardware serial fallback for ESP8266.
|
sentence=Implementation of software serial with hardware serial fallback for ESP8266.
|
@ -27,6 +27,9 @@ extern "C" {
|
|||||||
|
|
||||||
#include <TasmotaSerial.h>
|
#include <TasmotaSerial.h>
|
||||||
|
|
||||||
|
// for STAGE and pre-2.6, we can have a single wrapper using attachInterruptArg()
|
||||||
|
void ICACHE_RAM_ATTR callRxRead(void *self) { ((TasmotaSerial*)self)->rxRead(); };
|
||||||
|
|
||||||
// As the Arduino attachInterrupt has no parameter, lists of objects
|
// As the Arduino attachInterrupt has no parameter, lists of objects
|
||||||
// and callbacks corresponding to each possible GPIO pins have to be defined
|
// and callbacks corresponding to each possible GPIO pins have to be defined
|
||||||
TasmotaSerial *tms_obj_list[16];
|
TasmotaSerial *tms_obj_list[16];
|
||||||
@ -105,7 +108,11 @@ TasmotaSerial::TasmotaSerial(int receive_pin, int transmit_pin, int hardware_fal
|
|||||||
m_bit_time = ESP.getCpuFreqMHz() * 1000000 / TM_SERIAL_BAUDRATE;
|
m_bit_time = ESP.getCpuFreqMHz() * 1000000 / TM_SERIAL_BAUDRATE;
|
||||||
pinMode(m_rx_pin, INPUT);
|
pinMode(m_rx_pin, INPUT);
|
||||||
tms_obj_list[m_rx_pin] = this;
|
tms_obj_list[m_rx_pin] = this;
|
||||||
|
#if defined(ARDUINO_ESP8266_RELEASE_2_3_0) || defined(ARDUINO_ESP8266_RELEASE_2_4_2) || defined(ARDUINO_ESP8266_RELEASE_2_5_2)
|
||||||
attachInterrupt(m_rx_pin, ISRList[m_rx_pin], (m_nwmode) ? CHANGE : FALLING);
|
attachInterrupt(m_rx_pin, ISRList[m_rx_pin], (m_nwmode) ? CHANGE : FALLING);
|
||||||
|
#else
|
||||||
|
attachInterruptArg(m_rx_pin, callRxRead, this, (m_nwmode) ? CHANGE : FALLING);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (m_tx_pin > -1) {
|
if (m_tx_pin > -1) {
|
||||||
pinMode(m_tx_pin, OUTPUT);
|
pinMode(m_tx_pin, OUTPUT);
|
Loading…
x
Reference in New Issue
Block a user