sandeepmistry / arduino-BLEPeripheral

An Arduino library for creating custom BLE peripherals with Nordic Semiconductor's nRF8001 or nR51822.
MIT License
462 stars 179 forks source link

BLESrerial stream libray issue #170

Closed cheeta1 closed 6 years ago

cheeta1 commented 7 years ago

BLESerial.parseFloat(); BLESerial.parseInt(); these function are not working properly they only return the value of firts two char that i send eg if i send 1000 it return 10. i have tried to increase timeout to 5 sec but still same results

mlu commented 7 years ago

There is a problem in BLESerial::peek() that reads one byte off, should read the same byte as would be returned by a call to read(), just without advancing _rxTail.

- uint8_t byte = this->_rxBuffer[this->_rxTail]; + uint8_t byte = this->_rxBuffer[ (this->_rxTail + 1) % sizeof(this->_rxBuffer)];

sandeepmistry commented 6 years ago

Fixed via https://github.com/mlu/arduino-BLEPeripheral/commit/3e80f487662abe4474aa1cd663b8cf3554d694c8 from @mlu.

@mlu thanks for the patch, @cheeta1 could you please try the Github master version of the lib?

cheeta1 commented 6 years ago

hi @sandeepmistry it is well thanks for the correction update.