Skip to content

Commit

Permalink
Fixed exception caused by max_num_sensors = 0
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-bs committed Jun 9, 2024
1 parent 443acb4 commit ce2a375
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/PayloadBresser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
// 20240601 Added mapping of invalid RainGauge values to INV_FLOAT
// 20240603 Added encoding of sensor battery status
// 20240608 Modified default number of sensors
// 20240609 Fixed exception caused by max_num_sensors = 0
//
// ToDo:
// - Add handling of Professional Rain Gauge
Expand All @@ -54,6 +55,9 @@
void PayloadBresser::begin(void)
{
weatherSensor.begin(MAX_NUM_868MHZ_SENSORS);
if (weatherSensor.sensor.size() == 0)
return;

weatherSensor.clearSlots();
appPrefs.begin("BWS-LW-APP", false);
uint8_t ws_timeout = appPrefs.getUChar("ws_timeout", WEATHERSENSOR_TIMEOUT);
Expand All @@ -68,6 +72,9 @@ void PayloadBresser::begin(void)

void PayloadBresser::encodeBresser(uint8_t *appPayloadCfg, uint8_t *appStatus, LoraEncoder &encoder)
{
if (weatherSensor.sensor.size() == 0)
return;

// Handle weather sensors - which only have one channel (0) - first.
// Configuration for SENSOR_TYPE_WEATHER0 is integrated into SENSOR_TYPE_WEATHER1.
uint8_t flags = appPayloadCfg[1];
Expand Down

0 comments on commit ce2a375

Please sign in to comment.