Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sensors - allow a second BMX280 sensor #1647

Merged
merged 40 commits into from
Mar 29, 2019

Conversation

CraigMarkwardt
Copy link
Contributor

Up to two BMX280 sensors are allowed on a single I2C bus, with addresses 0x76 and 0x77. Currently espurna only supports one of them.

This change adds a second sensor object to deal with two sensors, if BMX280_ADDRESS2 is defined.

ElderJoy and others added 22 commits March 3, 2019 12:17
1. Add thermostat to the espurna_modules in progmem.h
2. Add thermostat to webui, gulp, html, js.
3. in general.h MQTT_USE_JSON returned to 0 by default and 1 if thermostat enabled.
# Conflicts:
#	code/espurna/config/webui.h
#	code/espurna/data/index.all.html.gz
#	code/espurna/data/index.light.html.gz
#	code/espurna/data/index.rfbridge.html.gz
#	code/espurna/data/index.rfm69.html.gz
#	code/espurna/data/index.sensor.html.gz
#	code/espurna/data/index.small.html.gz
#	code/espurna/espurna.ino
#	code/espurna/static/index.all.html.gz.h
#	code/espurna/static/index.light.html.gz.h
#	code/espurna/static/index.rfbridge.html.gz.h
#	code/espurna/static/index.rfm69.html.gz.h
#	code/espurna/static/index.sensor.html.gz.h
#	code/espurna/static/index.small.html.gz.h
#	code/espurna/web.ino
#	code/gulpfile.js
#	code/html/index.html
Mine was not working till I added BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
- wrapper NTPClient class to avoid inadvertently calling NTP::getTime() while
setting things up
- only call NTP::getTime() when in loop(), install async TimeLib
sync provider and manually set TimeLib time
- randomize sync and delay times
…resent its magnitude types; update sensor.ino to take advantage of this knowledge; sensors BMX280 and Dallas OneWire are updated with this knowledge; tested with BME280 and Dallas DS18B20 sensors
@CraigMarkwardt
Copy link
Contributor Author

Don't know how to resolve the Codacy quality review, either BMX280_ADDRESS2 is defined or not, and the firmware builds either way.

@xoseperez
Copy link
Owner

Hack-ish but it works, of course. You don't have to specify the individual addresses. Setting both to 0x00 will work since the auto-discover procedure will take care of the already used ones.

Maybe it will be better to add a BMX280_NUMBER to specify the number of sensors connected (1 or 2).

@CraigMarkwardt
Copy link
Contributor Author

OK I can re-work it, but... non-auto addressing is important. Order matters. If I have sensor 0x76 on the "incoming air" and sensor 0x77 on the "outgoing air" I don't ever want those mixed up.

@xoseperez
Copy link
Owner

It will always load sensor at 0x76 first. But yes, if you want to be define the order yourself then you are right.

…ses 0x76 and 0x77. Currently espurna only supports one of them.

This change adds a second sensor object to deal with two sensors, if BMX280_NUMBER == 2
@xoseperez xoseperez merged commit b74e02e into xoseperez:dev Mar 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants