mirror of
https://github.com/arendst/Tasmota.git
synced 2025-08-02 15:37:42 +00:00
Change disable interrupts during SerialSend from 9600 bps and up (#5528)
Change disable interrupts during SerialSend from 9600 bps and up (#5528)
This commit is contained in:
parent
768cf56ee8
commit
a03c1c90c7
@ -100,7 +100,7 @@ TasmotaSerial::TasmotaSerial(int receive_pin, int transmit_pin, int hardware_fal
|
|||||||
m_buffer = (uint8_t*)malloc(TM_SERIAL_BUFFER_SIZE);
|
m_buffer = (uint8_t*)malloc(TM_SERIAL_BUFFER_SIZE);
|
||||||
if (m_buffer == NULL) return;
|
if (m_buffer == NULL) return;
|
||||||
// Use getCycleCount() loop to get as exact timing as possible
|
// Use getCycleCount() loop to get as exact timing as possible
|
||||||
m_bit_time = F_CPU / 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;
|
||||||
attachInterrupt(m_rx_pin, ISRList[m_rx_pin], FALLING);
|
attachInterrupt(m_rx_pin, ISRList[m_rx_pin], FALLING);
|
||||||
@ -145,8 +145,8 @@ bool TasmotaSerial::begin(long speed, int stop_bits) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Use getCycleCount() loop to get as exact timing as possible
|
// Use getCycleCount() loop to get as exact timing as possible
|
||||||
m_bit_time = F_CPU / speed;
|
m_bit_time = ESP.getCpuFreqMHz() * 1000000 / speed;
|
||||||
m_high_speed = (speed > 9600);
|
m_high_speed = (speed >= 9600);
|
||||||
}
|
}
|
||||||
return m_valid;
|
return m_valid;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user