Skip to content

Commit

Permalink
Don't send data by BLE if measurements is not available (CO2 > 0)
Browse files Browse the repository at this point in the history
  • Loading branch information
melkati committed Jan 29, 2024
1 parent d81f83d commit e74b6e1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions CO2_Gadget_BLE.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
#include "Sensirion_Gadget_BLE.h"
#include "WifiMultiLibraryWrapper.h"

// clang-format on

NimBLELibraryWrapper lib;
WifiMultiLibraryWrapper wifi;
DataProvider provider(lib, DataType::T_RH_CO2_ALT, true, false, false, &wifi);
// DataProvider provider(lib, DataType::T_RH_CO2_ALT);
#endif

void initBLE() {
#ifdef SUPPORT_BLE
#ifdef SUPPORT_BLE
if (activeBLE) {
if (bleInitialized) {
Serial.print(
Expand All @@ -36,7 +38,7 @@ void initBLE() {

void publishBLE() {
#ifdef SUPPORT_BLE
if (activeBLE) {
if ((activeBLE) && (co2 > 0)) {
provider.writeValueToCurrentSample(co2, SignalType::CO2_PARTS_PER_MILLION);
provider.writeValueToCurrentSample(temp, SignalType::TEMPERATURE_DEGREES_CELSIUS);
provider.writeValueToCurrentSample(hum, SignalType::RELATIVE_HUMIDITY_PERCENTAGE);
Expand Down

0 comments on commit e74b6e1

Please sign in to comment.