Browse Source

sensors - allow a second BMX280 sensor

rules-rpn
Craig Markwardt 5 years ago
parent
commit
e4ed2439c4
2 changed files with 9 additions and 1 deletions
  1. +2
    -1
      code/espurna/config/sensors.h
  2. +7
    -0
      code/espurna/sensor.ino

+ 2
- 1
code/espurna/config/sensors.h View File

@ -159,8 +159,9 @@
#endif #endif
#ifndef BMX280_ADDRESS #ifndef BMX280_ADDRESS
#define BMX280_ADDRESS 0x00 // 0x00 means auto
#define BMX280_ADDRESS 0x00 // 0x00 means auto (0x76 or 0x77 allowed)
#endif #endif
//#define BMX280_ADDRESS2 0x77 // Address of 2nd BMX (must not use auto for either if two are present)
#define BMX280_MODE 1 // 0 for sleep mode, 1 or 2 for forced mode, 3 for normal mode #define BMX280_MODE 1 // 0 for sleep mode, 1 or 2 for forced mode, 3 for normal mode
#define BMX280_STANDBY 0 // 0 for 0.5ms, 1 for 62.5ms, 2 for 125ms #define BMX280_STANDBY 0 // 0 for 0.5ms, 1 for 62.5ms, 2 for 125ms


+ 7
- 0
code/espurna/sensor.ino View File

@ -481,6 +481,13 @@ void _sensorLoad() {
BMX280Sensor * sensor = new BMX280Sensor(); BMX280Sensor * sensor = new BMX280Sensor();
sensor->setAddress(BMX280_ADDRESS); sensor->setAddress(BMX280_ADDRESS);
_sensors.push_back(sensor); _sensors.push_back(sensor);
#ifdef BMX280_ADDRESS2
// Up to two BME sensors allowed on one bus
BMX280Sensor * sensor2 = new BMX280Sensor();
sensor->setAddress(BMX280_ADDRESS2);
_sensors.push_back(sensor2);
#endif
} }
#endif #endif


Loading…
Cancel
Save