Browse Source

Cleanup sensors and travis environments

rfm69
Xose Pérez 6 years ago
parent
commit
08241d0e1b
6 changed files with 98 additions and 29 deletions
  1. +4
    -0
      code/espurna/config/arduino.h
  2. +36
    -0
      code/espurna/config/hardware.h
  3. +35
    -12
      code/espurna/config/sensors.h
  4. +16
    -16
      code/espurna/sensor.ino
  5. +1
    -1
      code/espurna/sensors/GUVAS12SDSensor.h
  6. +6
    -0
      code/espurna/utils.ino

+ 4
- 0
code/espurna/config/arduino.h View File

@ -87,6 +87,7 @@
//#define DEBUG_SERIAL_SUPPORT 0
//#define DEBUG_TELNET_SUPPORT 0
//#define DEBUG_UDP_SUPPORT 1
//#define DEBUG_WEB_SUPPORT 0
//#define DOMOTICZ_SUPPORT 0
//#define HOMEASSISTANT_SUPPORT 0
//#define I2C_SUPPORT 1
@ -117,6 +118,7 @@
//#define ANALOG_SUPPORT 1
//#define BH1750_SUPPORT 1
//#define BMX280_SUPPORT 1
//#define CSE7766_SUPPORT 1
//#define DALLAS_SUPPORT 1
//#define DHT_SUPPORT 1
//#define DIGITAL_SUPPORT 1
@ -126,10 +128,12 @@
//#define EMON_ANALOG_SUPPORT 1
//#define EVENTS_SUPPORT 1
//#define GUVAS12SD_SUPPORT 1
//#define HCSR04_SUPPORT 1
//#define HLW8012_SUPPORT 1
//#define MHZ19_SUPPORT 1
//#define PMSX003_SUPPORT 1
//#define PZEM004T_SUPPORT 1
//#define SHT3X_I2C_SUPPORT 1
//#define SI7021_SUPPORT 1
//#define TMP3X_SUPPORT 1
//#define V9261F_SUPPORT 1

+ 36
- 0
code/espurna/config/hardware.h View File

@ -1950,6 +1950,7 @@
// We got silk sensor, velvet sensor, naugahyde sensor. We even got horse sensor, dog sensor, chicken sensor.
// C'mon, you want sensor, come on in sensor lovers!
// If we dont got it, you don't want it!
#define AM2320_SUPPORT 1
#define BH1750_SUPPORT 1
#define BMX280_SUPPORT 1
#define SHT3X_I2C_SUPPORT 1
@ -2019,6 +2020,36 @@
#endif
#define DHT_PIN 5
// A bit of TMP3X (analog)
#define TMP3X_SUPPORT 1
// A bit of EVENTS - pin 10
#define EVENTS_SUPPORT 1
#define EVENTS_PIN 6
// HC-RS04
#define HCSR04_SUPPORT 1
#define HCSR04_TRIGGER 7
#define HCSR04_ECHO 8
// MHZ19
#define MHZ19_SUPPORT 1
#define MHZ19_RX_PIN 9
#define MHZ19_TX_PIN 10
// PZEM004T
#define PZEM004T_SUPPORT 0 // not working?
#define PZEM004T_RX_PIN 11
#define PZEM004T_TX_PIN 12
// V9261F
#define V9261F_SUPPORT 1
#define V9261F_PIN 13
// GUVAS12SD
#define GUVAS12SD_SUPPORT 1
#define GUVAS12SD_PIN 14
#elif defined(TRAVIS03)
// Relay provider light/my92XX
@ -2037,6 +2068,11 @@
#define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
#define MY92XX_MAPPING 4, 3, 5, 0, 1
// A bit of Analog EMON (analog)
#ifndef EMON_ANALOG_SUPPORT
#define EMON_ANALOG_SUPPORT 1
#endif
#endif
// -----------------------------------------------------------------------------


+ 35
- 12
code/espurna/config/sensors.h View File

@ -339,8 +339,13 @@
#define MHZ19_SUPPORT 0
#endif
#ifndef MHZ19_RX_PIN
#define MHZ19_RX_PIN 13
#endif
#ifndef MHZ19_TX_PIN
#define MHZ19_TX_PIN 15
#endif
//------------------------------------------------------------------------------
// Particle Monitor based on Plantower PMSX003
@ -351,8 +356,13 @@
#define PMSX003_SUPPORT 0
#endif
#ifndef PMS_RX_PIN
#define PMS_RX_PIN 13
#endif
#ifndef PMS_TX_PIN
#define PMS_TX_PIN 15
#endif
//------------------------------------------------------------------------------
// PZEM004T based power monitor
@ -475,18 +485,31 @@
// =============================================================================
#ifndef SENSOR_SUPPORT
#if ANALOG_SUPPORT || BH1750_SUPPORT || BMX280_SUPPORT || DALLAS_SUPPORT \
|| DHT_SUPPORT || DIGITAL_SUPPORT || ECH1560_SUPPORT \
|| EMON_ADC121_SUPPORT || EMON_ADS1X15_SUPPORT \
|| EMON_ANALOG_SUPPORT || EVENTS_SUPPORT || HLW8012_SUPPORT \
|| MHZ19_SUPPORT || PMSX003_SUPPORT || SHT3X_I2C_SUPPORT \
|| SI7021_SUPPORT || V9261F_SUPPORT || AM2320_SUPPORT \
|| GUVAS12SD_SUPPORT || CSE7766_SUPPORT || TMP3X_SUPPORT \
|| HCSR04_SUPPORT
#define SENSOR_SUPPORT 1
#else
#define SENSOR_SUPPORT 0
#endif
#define SENSOR_SUPPORT ( \
AM2320_SUPPORT || \
ANALOG_SUPPORT || \
BH1750_SUPPORT || \
BMX280_SUPPORT || \
CSE7766_SUPPORT || \
DALLAS_SUPPORT || \
DHT_SUPPORT || \
DIGITAL_SUPPORT || \
ECH1560_SUPPORT || \
EMON_ADC121_SUPPORT || \
EMON_ADS1X15_SUPPORT || \
EMON_ANALOG_SUPPORT || \
EVENTS_SUPPORT || \
GUVAS12SD_SUPPORT || \
HCSR04_SUPPORT || \
HLW8012_SUPPORT || \
MHZ19_SUPPORT || \
PMSX003_SUPPORT || \
PZEM004T_SUPPORT || \
SHT3X_I2C_SUPPORT || \
SI7021_SUPPORT || \
TMP3X_SUPPORT || \
V9261F_SUPPORT \
)
#endif
// -----------------------------------------------------------------------------


+ 16
- 16
code/espurna/sensor.ino View File

@ -310,6 +310,14 @@ void _sensorLoad() {
*/
#if AM2320_SUPPORT
{
AM2320Sensor * sensor = new AM2320Sensor();
sensor->setAddress(AM2320_ADDRESS);
_sensors.push_back(sensor);
}
#endif
#if ANALOG_SUPPORT
{
AnalogSensor * sensor = new AnalogSensor();
@ -440,6 +448,14 @@ void _sensorLoad() {
}
#endif
#if GUVAS12SD_SUPPORT
{
GUVAS12SDSensor * sensor = new GUVAS12SDSensor();
sensor->setGPIO(GUVAS12SD_PIN);
_sensors.push_back(sensor);
}
#endif
#if HCSR04_SUPPORT
{
HCSR04Sensor * sensor = new HCSR04Sensor();
@ -524,22 +540,6 @@ void _sensorLoad() {
}
#endif
#if AM2320_SUPPORT
{
AM2320Sensor * sensor = new AM2320Sensor();
sensor->setAddress(AM2320_ADDRESS);
_sensors.push_back(sensor);
}
#endif
#if GUVAS12SD_SUPPORT
{
GUVAS12SDSensor * sensor = new GUVAS12SDSensor();
sensor->setGPIO(GUVAS12SD_PIN);
_sensors.push_back(sensor);
}
#endif
}
void _sensorCallback(unsigned char i, unsigned char type, const char * payload) {


+ 1
- 1
code/espurna/sensors/GUVAS12SDSensor.h View File

@ -122,6 +122,7 @@ class GUVAS12SDSensor : public BaseSensor {
// ---------------------------------------------------------------------
void _read() {
int _average = 0;
#if UV_SAMPLE_RATE == 1
@ -161,7 +162,6 @@ class GUVAS12SDSensor : public BaseSensor {
_uvindex = 10;
}
return _uvindex;
}
unsigned char _gpio = GPIO_NONE;


+ 6
- 0
code/espurna/utils.ino View File

@ -386,6 +386,9 @@ void info() {
#if GUVAS12SD_SUPPORT
DEBUG_MSG_P(PSTR(" GUVAS12SD"));
#endif
#if HCSR04_SUPPORT
DEBUG_MSG_P(PSTR(" HCSR04"));
#endif
#if HLW8012_SUPPORT
DEBUG_MSG_P(PSTR(" HLW8012"));
#endif
@ -404,6 +407,9 @@ void info() {
#if SI7021_SUPPORT
DEBUG_MSG_P(PSTR(" SI7021"));
#endif
#if TMP3X_SUPPORT
DEBUG_MSG_P(PSTR(" TMP3X"));
#endif
#if V9261F_SUPPORT
DEBUG_MSG_P(PSTR(" V9261F"));
#endif


Loading…
Cancel
Save