Skip to content

Commit 10c482f

Browse files
committed
Fix the Firmata issue
1. The BLEStream add profile when boot but the HW doesn't be initialized and makes APP crash. 2. Move the add profile at begin after HW complete initial process.
1 parent 059a769 commit 10c482f

File tree

1 file changed

+6
-5
lines changed
  • libraries/CurieBLE/examples/test/CommunitySketches/StandardFirmataBLE

1 file changed

+6
-5
lines changed

Diff for: libraries/CurieBLE/examples/test/CommunitySketches/StandardFirmataBLE/BLEStream.h

+6-5
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ BLEStream::BLEStream(unsigned char req, unsigned char rdy, unsigned char rst) :
8787
this->_flushed = 0;
8888
this->_flushInterval = BLESTREAM_TXBUFFER_FLUSH_INTERVAL;
8989
BLEStream::_instance = this;
90+
}
9091

92+
void BLEStream::begin(...)
93+
{
9194
addAttribute(this->_uartService);
9295
addAttribute(this->_uartNameDescriptor);
9396
setAdvertisedServiceUuid(this->_uartService.uuid());
@@ -96,11 +99,9 @@ BLEStream::BLEStream(unsigned char req, unsigned char rdy, unsigned char rst) :
9699
this->_rxCharacteristic.setEventHandler(BLEWritten, BLEStream::_received);
97100
addAttribute(this->_txCharacteristic);
98101
addAttribute(this->_txNameDescriptor);
99-
}
100-
101-
void BLEStream::begin(...)
102-
{
102+
103103
BLEPeripheral::begin();
104+
104105
#ifdef BLE_SERIAL_DEBUG
105106
Serial.println(F("BLEStream::begin()"));
106107
#endif
@@ -240,4 +241,4 @@ void BLEStream::_received(BLECentral& /*central*/, BLECharacteristic& rxCharacte
240241
}
241242

242243

243-
#endif // _BLE_STREAM_H_
244+
#endif // _BLE_STREAM_H_

0 commit comments

Comments
 (0)