mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
fix problems with serial and cbuf (some times freeze on high load)
This commit is contained in:
parent
fe1b39fa0e
commit
d6f62943d4
@ -608,6 +608,7 @@ size_t HardwareSerial::write(uint8_t c) {
|
|||||||
|
|
||||||
while(_tx_buffer->room() == 0) {
|
while(_tx_buffer->room() == 0) {
|
||||||
yield();
|
yield();
|
||||||
|
uart_arm_tx_interrupt(_uart);
|
||||||
}
|
}
|
||||||
|
|
||||||
_tx_buffer->write(c);
|
_tx_buffer->write(c);
|
||||||
|
@ -39,8 +39,12 @@ class cbuf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t room() const {
|
size_t room() const {
|
||||||
if(_end >= _begin) return _size - (_end - _begin) - 1;
|
if(_end >= _begin) {
|
||||||
|
return _size - (_end - _begin) - 1;
|
||||||
|
}
|
||||||
|
if(_begin == _end) {
|
||||||
|
return _size;
|
||||||
|
}
|
||||||
return _begin - _end - 1;
|
return _begin - _end - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user