From 1624289496da686ca1eb9b75c3dfbd7cba8b08be Mon Sep 17 00:00:00 2001 From: Marcus Date: Mon, 18 Nov 2024 10:44:33 +0100 Subject: [PATCH] does not compile, i guess i use the wrong pointer stuff thing for in CanGrow_Sensor.h stuff --- Arduino/CanGrow/CanGrow.ino | 2 - Arduino/CanGrow/include/CanGrow_Sensor.h | 94 ++++++++----------- .../{00_ADC_builtin.h => 01_ADC_builtin.h} | 5 +- 3 files changed, 43 insertions(+), 58 deletions(-) rename Arduino/CanGrow/include/Sensor/{00_ADC_builtin.h => 01_ADC_builtin.h} (90%) diff --git a/Arduino/CanGrow/CanGrow.ino b/Arduino/CanGrow/CanGrow.ino index 33430da..a394d4f 100644 --- a/Arduino/CanGrow/CanGrow.ino +++ b/Arduino/CanGrow/CanGrow.ino @@ -56,9 +56,7 @@ // arduino-core for esp8266 and esp32 #include "LittleFS.h" -// https://github.com/arduino/ArduinoCore-avr/tree/master/libraries/SPI #include -// https://github.com/arduino/ArduinoCore-avr/tree/master/libraries/Wire #include // https://github.com/bblanchon/ArduinoJson diff --git a/Arduino/CanGrow/include/CanGrow_Sensor.h b/Arduino/CanGrow/include/CanGrow_Sensor.h index d4a9178..a8b229a 100644 --- a/Arduino/CanGrow/include/CanGrow_Sensor.h +++ b/Arduino/CanGrow/include/CanGrow_Sensor.h @@ -28,39 +28,11 @@ */ -#include "Sensor/00_ADC_builtin.h" - - -// for bme280 and bme680 -#define SEALEVELPRESSURE_HPA (1013.25) - -// How much values can a sensor return -const byte SENSOR_MAX_READING = 8; - -const byte SENSOR_READING_RAW = 1; -const byte SENSOR_READING_TEMP = 2; -const byte SENSOR_READING_HUMIDITY = 3; -const byte SENSOR_READING_MOISTURE = 4; -const byte SENSOR_READING_PRESSURE = 5; -const byte SENSOR_READING_GAS_RESISTANCE = 6; - -char SENSOR_READING_RAW_descr[] = "Raw Analog"; -char SENSOR_READING_TEMP_descr[] = "Temperature °C"; -char SENSOR_READING_HUMIDITY_descr[] = "Humidity %"; -char SENSOR_READING_MOISTURE_descr[] = "Moisture %"; -char SENSOR_READING_PRESSURE_descr[] = "Pressure Pa"; -char SENSOR_READING_GAS_RESISTANCE_descr[] = "Gas resistance KOhm"; - -const char * Sensor_Reading_descr[] = { - NULL, // 0 is unset - SENSOR_READING_RAW_descr, - SENSOR_READING_TEMP_descr, - SENSOR_READING_HUMIDITY_descr, - SENSOR_READING_MOISTURE_descr, - SENSOR_READING_PRESSURE_descr, - SENSOR_READING_GAS_RESISTANCE_descr, -}; +#include +#include "Sensor/Common.h" +#include "Sensor/01_ADC_builtin.h" +#include "Sensor/02_BME280.h" struct Sensor_Index { @@ -75,45 +47,57 @@ struct Sensor_Index { * - 4 Moisture * - 5 Pressure * - 6 Gas restistance + * - max units * */ const char name[32]; - const byte reading[SENSOR_MAX_READING]; + const byte * reading[SENSOR_MAX_READING]; + byte max; }; const byte SensorIndex_length = 4; Sensor_Index SensorIndex[] { // 0 is for unset in config - { "unset", { - {}, - }}, + { "unset", + {{}}, + 255, + }, // 1 - internal ADC - { SENSOR_00_NAME, { - SENSOR_READING_RAW, - }}, + { SENSOR_01_NAME, + SENSOR_01_READINGS, + ADC_BUILTIN_MAX, + }, + { SENSOR_02_NAME, + SENSOR_02_READINGS, + ADC_BUILTIN_MAX, + }, // 2 - BME280 - { "BME280", { - SENSOR_READING_TEMP, - SENSOR_READING_HUMIDITY, - SENSOR_READING_PRESSURE, - }}, + //{ SENSOR_02_NAME, + //{ + //SENSOR_READING_TEMP, + //SENSOR_READING_HUMIDITY, + //SENSOR_READING_PRESSURE }, + //SENSOR_02_READINGS, + //3, + //}, // 3 - { "Chirp", { - SENSOR_READING_MOISTURE, - SENSOR_READING_TEMP, - SENSOR_READING_RAW, - }}, + //{ "Chirp", { + //SENSOR_READING_MOISTURE, + //SENSOR_READING_TEMP, + //SENSOR_READING_RAW }, + //4, + //}, // 4 - { "ADS1115", { - SENSOR_READING_RAW, - SENSOR_READING_RAW, - SENSOR_READING_RAW, - SENSOR_READING_RAW - }}, + //{ "ADS1115", { + //SENSOR_READING_RAW, + //SENSOR_READING_RAW, + //SENSOR_READING_RAW, + //SENSOR_READING_RAW + //}}, // 5 diff --git a/Arduino/CanGrow/include/Sensor/00_ADC_builtin.h b/Arduino/CanGrow/include/Sensor/01_ADC_builtin.h similarity index 90% rename from Arduino/CanGrow/include/Sensor/00_ADC_builtin.h rename to Arduino/CanGrow/include/Sensor/01_ADC_builtin.h index 0a631a6..718e485 100644 --- a/Arduino/CanGrow/include/Sensor/00_ADC_builtin.h +++ b/Arduino/CanGrow/include/Sensor/01_ADC_builtin.h @@ -27,4 +27,7 @@ * */ -#define SENSOR_00_NAME "ADC builtin" +#define SENSOR_01_NAME "ADC builtin" +#define ADC_BUILTIN_MAX 0 + +const byte SENSOR_01_READINGS[] = { SENSOR_READING_RAW };