[SX128x] Added missing BLE modem check

This commit is contained in:
jgromes 2020-04-17 07:51:29 +02:00
parent dcf31e481d
commit 1aef03c473
2 changed files with 13 additions and 5 deletions

View file

@ -444,6 +444,8 @@ int16_t SX128x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
state = setPacketParamsLoRa(_preambleLengthLoRa, _headerType, len, _crcLoRa);
} else if((modem == SX128X_PACKET_TYPE_GFSK) || (modem == SX128X_PACKET_TYPE_FLRC)) {
state = setPacketParamsGFSK(_preambleLengthGFSK, _syncWordLen, _syncWordMatch, _crcGFSK, _whitening, len);
} else if(modem == SX128X_PACKET_TYPE_BLE) {
state = setPacketParamsBLE(_connectionState, _crcBLE, _bleTestPayload, _whitening);
} else {
return(ERR_WRONG_MODEM);
}
@ -458,8 +460,14 @@ int16_t SX128x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
RADIOLIB_ASSERT(state);
// write packet to buffer
state = writeBuffer(data, len);
RADIOLIB_ASSERT(state);
if(modem == SX128X_PACKET_TYPE_BLE) {
// first 2 bytes of BLE payload are PDU header
state = writeBuffer(data, len, 2);
RADIOLIB_ASSERT(state);
} else {
state = writeBuffer(data, len);
RADIOLIB_ASSERT(state);
}
// set DIO mapping
state = setDioIrqParams(SX128X_IRQ_TX_DONE | SX128X_IRQ_RX_TX_TIMEOUT, SX128X_IRQ_TX_DONE);

View file

@ -442,7 +442,7 @@ class SX128x: public PhysicalLayer {
\param len Number of bytes to send.
\param addr Address to send the data to. Will only be added if address filtering was enabled.
\param addr Address to send the data to. Unsupported, compatibility only.
\returns \ref status_codes
*/
@ -531,7 +531,7 @@ class SX128x: public PhysicalLayer {
\param len Number of bytes to send.
\param addr Address to send the data to. Will only be added if address filtering was enabled.
\param addr Address to send the data to. Unsupported, compatibility only.
\returns \ref status_codes
*/
@ -745,7 +745,7 @@ class SX128x: public PhysicalLayer {
protected:
#endif
Module* _mod;
// cached LoRa parameters
float _bwKhz;
uint8_t _bw, _sf, _cr;