Some CDC and BTSerial compatibility fixes

This commit is contained in:
me-no-dev
2020-07-14 18:21:21 +03:00
parent 8cc9e955dc
commit e687951c0f
6 changed files with 41 additions and 22 deletions

View File

@ -477,7 +477,7 @@ static bool _init_bt(const char *deviceName)
}
if(!_spp_task_handle){
xTaskCreatePinnedToCore(_spp_tx_task, "spp_tx", 4096, NULL, 2, &_spp_task_handle, 0);
xTaskCreatePinnedToCore(_spp_tx_task, "spp_tx", 4096, NULL, 10, &_spp_task_handle, 0);
if(!_spp_task_handle){
log_e("Network Event Task Start Failed!");
return false;
@ -815,4 +815,9 @@ bool BluetoothSerial::isReady(bool checkMaster, int timeout) {
TickType_t xTicksToWait = timeout / portTICK_PERIOD_MS;
return (xEventGroupWaitBits(_spp_event_group, SPP_RUNNING, pdFALSE, pdTRUE, xTicksToWait) & SPP_RUNNING) != 0;
}
BluetoothSerial::operator bool() const
{
return true;
}
#endif

View File

@ -34,6 +34,9 @@ class BluetoothSerial: public Stream
~BluetoothSerial(void);
bool begin(String localName=String(), bool isMaster=false);
bool begin(unsigned long baud){//compatibility
return begin();
}
int available(void);
int peek(void);
bool hasClient(void);
@ -54,7 +57,8 @@ class BluetoothSerial: public Stream
bool isReady(bool checkMaster=false, int timeout=0);
bool disconnect();
bool unpairDevice(uint8_t remoteAddress[]);
operator bool() const;
private:
String local_name;