More compact module sensors was added
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "Arduino.h"
|
||||
#include "BluetoothSerial.h"
|
||||
#include "HardwareSerial.h"
|
||||
#include "Stream.h"
|
||||
#include "mString.h"
|
||||
|
||||
/* Check the ESP configuration */
|
||||
#if not defined(CONFIG_BT_ENABLED) || not defined(CONFIG_BLUEDROID_ENABLED)
|
||||
@@ -37,6 +36,6 @@ class BluetoothDispatcher {
|
||||
bool _confirmRequestDone = false;
|
||||
BluetoothSerial *_controller = nullptr;
|
||||
HardwareSerial *_serial = nullptr;
|
||||
static constexpr int _buffer_size = 256;
|
||||
String _buffer;
|
||||
static constexpr uint16_t _buffer_size = 256;
|
||||
mString<_buffer_size> _buffer;
|
||||
};
|
||||
Reference in New Issue
Block a user