From 0added4e01f619f3866f97a4e7a83e35dd32ea16 Mon Sep 17 00:00:00 2001 From: oscgonfer Date: Thu, 21 Nov 2024 17:22:10 +0100 Subject: [PATCH] Fix ifdefs for external temperature sensor --- lib/Sensors/Sensors.h | 8 ++++++-- sam/src/SckAux.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/Sensors/Sensors.h b/lib/Sensors/Sensors.h index 04ba62a..0b92ac2 100644 --- a/lib/Sensors/Sensors.h +++ b/lib/Sensors/Sensors.h @@ -10,6 +10,7 @@ #define WITH_SCD30 #define WITH_SFA30 #define WITH_GPS +#define WITH_EXT_TEMP #endif #ifdef SCK22_AIR @@ -21,6 +22,7 @@ #define WITH_ADS1X15 #define WITH_SFA30 #define WITH_GPS +#define WITH_EXT_TEMP #endif #ifdef SCK23_AIR @@ -32,6 +34,7 @@ #define WITH_ADS1X15 #define WITH_SFA30 #define WITH_GPS +#define WITH_EXT_TEMP #endif #ifdef SCK_WATER @@ -59,6 +62,7 @@ // #define WITH_ATLAS // Saves 884 bytes // #define WITH_CHIRP // Saves 404 bytes // #define WITH_DALLAS_TEMP // Saves 292 bytes +// #define #define WITH_EXT_TEMP // #define WITH_GPS // Saves 1508 bytes // #define WITH_RANGE // Saves 292 bytes // #define WITH_BME68X // Saves 644 bytes @@ -244,7 +248,7 @@ enum SensorType SENSOR_DALLAS_TEMP, #endif -#ifdef WITH_URBAN +#ifdef WITH_EXT_TEMP SENSOR_SHT31_TEMP, SENSOR_SHT31_HUM, SENSOR_SHT35_TEMP, @@ -523,7 +527,7 @@ class AllSensors OneSensor { BOARD_AUX, 0, SENSOR_DALLAS_TEMP, "DALLAS_TEMP", "Direct Dallas Temperature", 96, true, 1, "C" }, #endif -#ifdef WITH_URBAN +#ifdef WITH_EXT_TEMP OneSensor { BOARD_AUX, 0, SENSOR_SHT31_TEMP, "EXT_TEMP", "Ext Temperature", 79, true, 1, "C" }, OneSensor { BOARD_AUX, 0, SENSOR_SHT31_HUM, "EXT_HUM", "Ext Humidity", 80, true, 1, "%" }, OneSensor { BOARD_AUX, 0, SENSOR_SHT35_TEMP, "EXT_TEMP_SHT35", "Ext SHT35 Temperature", 224, true, 1, "C" }, diff --git a/sam/src/SckAux.cpp b/sam/src/SckAux.cpp index 2c0db47..16eca96 100644 --- a/sam/src/SckAux.cpp +++ b/sam/src/SckAux.cpp @@ -33,7 +33,7 @@ PMsensor pmSensorB = PMsensor(SLOT_B); PM_DallasTemp pmDallasTemp; Sck_DallasTemp dallasTemp; #endif -#ifdef WITH_URBAN +#ifdef WITH_EXT_TEMP Sck_SHT31 sht31 = Sck_SHT31(&auxWire); Sck_SHT31 sht35 = Sck_SHT31(&auxWire, 0x45); #endif @@ -148,7 +148,7 @@ bool AuxBoards::start(SckBase *base, SensorType wichSensor) case SENSOR_PM_DALLAS_TEMP: return pmDallasTemp.start(); case SENSOR_DALLAS_TEMP: return dallasTemp.start(); #endif -#ifdef WITH_URBAN +#ifdef WITH_EXT_TEMP case SENSOR_SHT31_TEMP: case SENSOR_SHT31_HUM: #ifdef WITH_GASES_BOARD @@ -275,7 +275,7 @@ bool AuxBoards::stop(SensorType wichSensor) case SENSOR_PM_DALLAS_TEMP: return pmDallasTemp.stop(); case SENSOR_DALLAS_TEMP: return dallasTemp.stop(); #endif -#ifdef WITH_URBAN +#ifdef WITH_EXT_TEMP case SENSOR_SHT31_TEMP: case SENSOR_SHT31_HUM: return sht31.stop(); case SENSOR_SHT35_TEMP: @@ -397,7 +397,7 @@ void AuxBoards::getReading(SckBase *base, OneSensor *wichSensor) case SENSOR_PM_DALLAS_TEMP: wichSensor->reading = String(pmDallasTemp.getReading()); return; case SENSOR_DALLAS_TEMP: if (dallasTemp.getReading()) { wichSensor->reading = String(dallasTemp.reading); return; } break; #endif -#ifdef WITH_URBAN +#ifdef WITH_EXT_TEMP case SENSOR_SHT31_TEMP: if (sht31.getReading()) { wichSensor->reading = String(sht31.temperature); return; } break; case SENSOR_SHT31_HUM: if (sht31.getReading()) { wichSensor->reading = String(sht31.humidity); return; } break; case SENSOR_SHT35_TEMP: if (sht35.getReading()) { wichSensor->reading = String(sht35.temperature); return; } break;