feature/http_call_send_json #3

Merged
f merged 56 commits from feature/http_call_send_json into master 2022-11-27 11:02:22 +01:00
3 changed files with 40 additions and 13 deletions
Showing only changes of commit 4bd4944d6b - Show all commits

View file

@ -2,21 +2,30 @@
APDS9930 _sensor_apds9930 = APDS9930();
bool sensor_apds9930_begin() {
bool sensor_apds9930_begin()
{
bool status = _sensor_apds9930.init();
if (status) {
if (status)
{
_sensor_apds9930.enableLightSensor(false);
debug("APDS9930 Connected");
} else {
debug("Could not find a valid APDS9930 sensor, check wiring!");
}
return status;
}
float apds9930_light() {
float apds9930_light()
{
float ambient_light = 0;
if (_sensor_apds9930.readAmbientLightLux(ambient_light)) {
if (_sensor_apds9930.readAmbientLightLux(ambient_light))
{
return ambient_light;
} else {
return 0;
}

View file

@ -2,26 +2,34 @@
Adafruit_APDS9960 _sensor_apds9960;
bool sensor_apds9960_begin() {
bool sensor_apds9960_begin()
{
bool status = _sensor_apds9960.begin();
if (status) {
if (status)
{
_sensor_apds9960.enableColor(true);
debug("APDS9960 Connected");
} else {
debug("Could not find a valid APDS9960 sensor, check wiring!");
}
return status;
}
float apds9960_light() {
float apds9960_light()
{
uint16_t red, green, blue, white, lux;
while(!_sensor_apds9960.colorDataReady()) {
while(!_sensor_apds9960.colorDataReady())
{
delay(5);
}
_sensor_apds9960.getColorData(&red, &green, &blue, &white);
//calculate lux
lux = _sensor_apds9960.calculateLux(red, green, blue);
return lux * LIGHT_FACTOR;
}

View file

@ -3,22 +3,32 @@
Adafruit_BME280 _sensor_bme280;
bool sensor_bme280_begin(uint8_t addr) {
bool sensor_bme280_begin(uint8_t addr)
{
bool status = _sensor_bme280.begin(addr);
if (status) {
if (status)
{
debug("BME280 Connected");
} else {
debug("Could not find a valid BME280 sensor, check wiring!");
}
return status;
}
float bme280_temperature() {
float bme280_temperature()
{
return _sensor_bme280.readTemperature() * TEMP_FACTOR;
}
float bme280_pressure() {
float bme280_pressure()
{
return _sensor_bme280.readPressure() / 100.0F;
}
float bme280_humidity() {
float bme280_humidity()
{
return _sensor_bme280.readHumidity() * HUMIDITY_FACTOR;
}