More compact module sensors was added

This commit is contained in:
2024-01-05 23:21:31 +07:00
parent 89940fbec2
commit b86af180ab
9 changed files with 213 additions and 47 deletions

View File

@@ -30,9 +30,12 @@ void BluetoothDispatcher::tick() {
_buffer += (char)_controller->read();
}
if (_buffer.endsWith("\r")) {
_serial->println(_buffer.substring(0, _buffer.lastIndexOf("\r")));
char buffer[_buffer_size];
_buffer.substring(0, _buffer.lastIndexOf('\r'), buffer);
_serial->println(buffer); // print the payload
_buffer.clear();
_controller->write((uint8_t *)"Hello, world!", strlen("Hello, world!"));
// TODO: add callback, that receive new state
}
if (_buffer.length() > _buffer_size) {
_buffer.clear();