Skip to content

Commit

Permalink
Fixed exception with empty list of BLE addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-bs committed Jun 10, 2024
1 parent 1703669 commit 02b42ae
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/PayloadBLE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
//
// 20240531 Moved from AppLayer.cpp
// 20240603 Added BLE sensor battery status
// 20240610 Fixed exception with empty list of BLE addresses
//
// ToDo:
// -
Expand Down Expand Up @@ -111,6 +112,10 @@ void PayloadBLE::bleAddrInit(void)
knownBLEAddresses = knownBLEAddressesDef;
log_d("Using BLE addresses from BresserWeatherSensorLWCfg.h:");
}
else if (knownBLEAddressesDef.size() == 0)
{
log_d("No BLE addresses specified.");
}
else
{
log_d("Using BLE addresses from Preferences:");
Expand All @@ -127,9 +132,11 @@ void PayloadBLE::bleAddrInit(void)
/*
* Encode BLE temperature/humidity sensor values for LoRaWAN transmission
*/
void PayloadBLE::encodeBLE(uint8_t *appPayloadCfg, uint8_t * appStatus, LoraEncoder &encoder)
void PayloadBLE::encodeBLE(uint8_t *appPayloadCfg, uint8_t *appStatus, LoraEncoder &encoder)
{
#if defined(MITHERMOMETER_EN) || defined(THEENGSDECODER_EN)
if (bleSensors.data.size() == 0)
return;

float indoor_temp_c;
float indoor_humidity;

Expand All @@ -144,7 +151,6 @@ void PayloadBLE::encodeBLE(uint8_t *appPayloadCfg, uint8_t * appStatus, LoraEnco
appPrefs.end();
// Get sensor data - run BLE scan for <bleScanTime>
bleSensors.getData(ble_scantime, ble_active);
#endif

// BLE Temperature/Humidity Sensors
#if defined(MITHERMOMETER_EN)
Expand Down

0 comments on commit 02b42ae

Please sign in to comment.