Compare commits

..

No commits in common. "0f8c14e51e60132258f60569164028acce2e9d94" and "efc7331f25e0dce18b38355207e9a52bb88085f4" have entirely different histories.

3 changed files with 2 additions and 84 deletions

View File

@ -14,6 +14,8 @@
//Use Default i2c pin GPIO4(D2): SDA, GPIO5(D1):SCL
#define SEALEVELPRESSURE_HPA (1013.25)
#include <SFE_BMP180.h>
#include "debug_sketch.h"
int BME680GetMeasure(float &t, float &p, float &h, float &g, float &a);
int BME680Setup();

View File

@ -1,23 +0,0 @@
#pragma once
#ifdef CONFIG_ENABLE_SCD4X
#include "debug_sketch.h"
int SCD4XGetMeasure(float &t, float &h, uint16_t &co2);
int SCD4XSetup();
bool SCD4XIsConnected();
#else
int SCD4XGetMeasure(float &, float &, uint16_t &)
{
return -1;
};
int SCD4XSetup()
{
SKETCH_DEBUG_PRINTLN("SCD4X is disabled at build time");
return -1;
};
bool SCD4XIsConnected()
{
return false;
};
#endif

View File

@ -1,61 +0,0 @@
#ifdef CONFIG_ENABLE_SCD4X
#include "SCD4X.h"
#include <Arduino.h>
#include <SensirionI2CScd4x.h>
#include <Wire.h>
SensirionI2CScd4x scd4x;
int SCD4XConnected = 0;
int SCD4XSetup()
{
Wire.begin();
scd4x.begin(Wire);
// Stop previous measurement
uint16_t error = scd4x.stopPeriodicMeasurement();
if (error) {
SKETCH_DEBUG_PRINTLN("Cannot connect to SCD4X");
return -1;
}
// Start new measurement
error = scd4x.startPeriodicMeasurement();
if (error) {
SKETCH_DEBUG_PRINTLN("Cannot start measurement for SCD4X");
return -1;
}
SCD4XConnected = 1;
return 0;
}
int SCD4XGetMeasure(float &temperature, float &humidity, uint16_t &co2)
{
// Read Measurement
bool isDataReady = false;
uint16_t error = scd4x.getDataReadyFlag(isDataReady);
if (error) {
SKETCH_DEBUG_PRINTLN("Error trying to execute getDataReadyFlag() for SCD4X ");
return -1;
}
if (!isDataReady) {
return -1;
}
error = scd4x.readMeasurement(co2, temperature, humidity);
if (error || co2 == 0) {
char errorMsg[256];
SKETCH_DEBUG_PRINT("Error with reading measurement. Error : ");
errorToString(error, errorMsg, sizeof(errorMsg));
SKETCH_DEBUG_PRINTLN(" Co2: %d", co2);
return -1;
}
return 0;
}
bool SCD4XIsConnected()
{
return SCD4XConnected != 0;
}
#endif