does not compile, i guess i use the wrong pointer stuff thing for in CanGrow_Sensor.h stuff
This commit is contained in:
parent
16f4871306
commit
1624289496
3 changed files with 43 additions and 58 deletions
|
@ -56,9 +56,7 @@
|
||||||
// arduino-core for esp8266 and esp32
|
// arduino-core for esp8266 and esp32
|
||||||
#include "LittleFS.h"
|
#include "LittleFS.h"
|
||||||
|
|
||||||
// https://github.com/arduino/ArduinoCore-avr/tree/master/libraries/SPI
|
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
// https://github.com/arduino/ArduinoCore-avr/tree/master/libraries/Wire
|
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
|
|
||||||
// https://github.com/bblanchon/ArduinoJson
|
// https://github.com/bblanchon/ArduinoJson
|
||||||
|
|
|
@ -28,39 +28,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "Sensor/00_ADC_builtin.h"
|
#include <Adafruit_Sensor.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 "Sensor/Common.h"
|
||||||
|
#include "Sensor/01_ADC_builtin.h"
|
||||||
|
#include "Sensor/02_BME280.h"
|
||||||
|
|
||||||
|
|
||||||
struct Sensor_Index {
|
struct Sensor_Index {
|
||||||
|
@ -75,45 +47,57 @@ struct Sensor_Index {
|
||||||
* - 4 Moisture
|
* - 4 Moisture
|
||||||
* - 5 Pressure
|
* - 5 Pressure
|
||||||
* - 6 Gas restistance
|
* - 6 Gas restistance
|
||||||
|
* - max units
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const char name[32];
|
const char name[32];
|
||||||
const byte reading[SENSOR_MAX_READING];
|
const byte * reading[SENSOR_MAX_READING];
|
||||||
|
byte max;
|
||||||
};
|
};
|
||||||
|
|
||||||
const byte SensorIndex_length = 4;
|
const byte SensorIndex_length = 4;
|
||||||
Sensor_Index SensorIndex[] {
|
Sensor_Index SensorIndex[] {
|
||||||
// 0 is for unset in config
|
// 0 is for unset in config
|
||||||
{ "unset", {
|
{ "unset",
|
||||||
{},
|
{{}},
|
||||||
}},
|
255,
|
||||||
|
},
|
||||||
|
|
||||||
// 1 - internal ADC
|
// 1 - internal ADC
|
||||||
{ SENSOR_00_NAME, {
|
{ SENSOR_01_NAME,
|
||||||
SENSOR_READING_RAW,
|
SENSOR_01_READINGS,
|
||||||
}},
|
ADC_BUILTIN_MAX,
|
||||||
|
},
|
||||||
|
|
||||||
|
{ SENSOR_02_NAME,
|
||||||
|
SENSOR_02_READINGS,
|
||||||
|
ADC_BUILTIN_MAX,
|
||||||
|
},
|
||||||
// 2 - BME280
|
// 2 - BME280
|
||||||
{ "BME280", {
|
//{ SENSOR_02_NAME,
|
||||||
SENSOR_READING_TEMP,
|
//{
|
||||||
SENSOR_READING_HUMIDITY,
|
//SENSOR_READING_TEMP,
|
||||||
SENSOR_READING_PRESSURE,
|
//SENSOR_READING_HUMIDITY,
|
||||||
}},
|
//SENSOR_READING_PRESSURE },
|
||||||
|
//SENSOR_02_READINGS,
|
||||||
|
//3,
|
||||||
|
//},
|
||||||
|
|
||||||
// 3
|
// 3
|
||||||
{ "Chirp", {
|
//{ "Chirp", {
|
||||||
SENSOR_READING_MOISTURE,
|
//SENSOR_READING_MOISTURE,
|
||||||
SENSOR_READING_TEMP,
|
//SENSOR_READING_TEMP,
|
||||||
SENSOR_READING_RAW,
|
//SENSOR_READING_RAW },
|
||||||
}},
|
//4,
|
||||||
|
//},
|
||||||
|
|
||||||
// 4
|
// 4
|
||||||
{ "ADS1115", {
|
//{ "ADS1115", {
|
||||||
SENSOR_READING_RAW,
|
//SENSOR_READING_RAW,
|
||||||
SENSOR_READING_RAW,
|
//SENSOR_READING_RAW,
|
||||||
SENSOR_READING_RAW,
|
//SENSOR_READING_RAW,
|
||||||
SENSOR_READING_RAW
|
//SENSOR_READING_RAW
|
||||||
}},
|
//}},
|
||||||
|
|
||||||
// 5
|
// 5
|
||||||
|
|
||||||
|
|
|
@ -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 };
|
Loading…
Reference in a new issue