1
0
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:
Markus Sattler 2015-06-19 10:41:20 +02:00
parent fe1b39fa0e
commit d6f62943d4
2 changed files with 7 additions and 2 deletions

View File

@ -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);

View File

@ -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;
} }