diff --git a/examples/knx-bme680/knx-bme680.ino b/examples/knx-bme680/knx-bme680.ino index 566c0fc..b6deb6d 100644 --- a/examples/knx-bme680/knx-bme680.ino +++ b/examples/knx-bme680/knx-bme680.ino @@ -1,4 +1,5 @@ // used version: BSEC_1.4.7.3_Generic_Release_20190410 +// 2 changes needed for version: BSEC_1.4.7.4_Generic_Release see below #include #include #ifdef ARDUINO_ARCH_ESP8266 @@ -111,7 +112,7 @@ void setup(void) iaqSensor.updateSubscription(sensorList, sizeof(sensorList)/sizeof(bsec_virtual_sensor_t), BSEC_SAMPLE_RATE_LP); checkIaqSensorStatus(); - String output = "Timestamp [ms], raw temperature [°C], pressure [hPa], raw relative humidity [%], gas [Ohm], IAQ, IAQ accuracy, temperature [°C], relative humidity [%], CO2"; + String output = "Timestamp [ms], raw temperature [°C], temperature[°C], pressure [hPa], raw relative humidity [%], humidity [%], gas [Ohm], IAQ, IAQ accuracy, CO2, CO2 Accuracy, breathVocEquivalent, breathVocAccuracy, compGasValue, compGas Accuracy, gasPercentage, gasPercentage Accuracy, staticIAQ, staticIAQ Accuracy, runInStatus, stabStatus"; Serial.println(output); } @@ -135,7 +136,7 @@ void loop(void) output += ", " + String(iaqSensor.rawHumidity); output += ", " + String(iaqSensor.humidity); output += ", " + String(iaqSensor.gasResistance); - output += ", " + String(iaqSensor.iaq); + output += ", " + String(iaqSensor.iaq); //.iaqEstimate for BSEC_1.4.7.4 output += ", " + String(iaqSensor.iaqAccuracy); output += ", " + String(iaqSensor.co2Equivalent); output += ", " + String(iaqSensor.co2Accuracy); @@ -143,8 +144,8 @@ void loop(void) output += ", " + String(iaqSensor.breathVocAccuracy); output += ", " + String(iaqSensor.compGasValue); output += ", " + String(iaqSensor.compGasAccuracy); - output += ", " + String(iaqSensor.gasPercentageAcccuracy); output += ", " + String(iaqSensor.gasPercentage); + output += ", " + String(iaqSensor.gasPercentageAcccuracy); output += ", " + String(iaqSensor.staticIaq); output += ", " + String(iaqSensor.staticIaqAccuracy); output += ", " + String(iaqSensor.runInStatus); @@ -162,7 +163,7 @@ void loop(void) goPressure.value(iaqSensor.pressure); goRawHumidity.value(iaqSensor.rawHumidity); goGasResistance.value(iaqSensor.gasResistance); - goIaqEstimate.value(iaqSensor.iaq); + goIaqEstimate.value(iaqSensor.iaq); //.iaqEstimate for BSEC_1.4.7.4 goIaqAccurace.value(iaqSensor.iaqAccuracy); goTemperature.value(iaqSensor.temperature); goHumidity.value(iaqSensor.humidity); diff --git a/src/knx_facade.h b/src/knx_facade.h index d059a17..5328ac9 100644 --- a/src/knx_facade.h +++ b/src/knx_facade.h @@ -31,7 +31,7 @@ template class KnxFacade : private SaveRestore manufacturerId(0xfa); _bau.addSaveRestore(this); } - + virtual ~KnxFacade() { if (_bauPtr) @@ -61,27 +61,27 @@ template class KnxFacade : private SaveRestore { return _bau.enabled(); } - + void enabled(bool value) { _bau.enabled(true); } - + bool progMode() { return _bau.deviceObject().progMode(); } - + void progMode(bool value) { _bau.deviceObject().progMode(value); } - + bool configured() { return _bau.configured(); } - + /** * returns HIGH if led is active on HIGH, LOW otherwise */ @@ -89,7 +89,7 @@ template class KnxFacade : private SaveRestore { return _ledPinActiveOn; } - + /** * Sets if the programming led is active on HIGH or LOW. * @@ -99,42 +99,60 @@ template class KnxFacade : private SaveRestore { _ledPinActiveOn = value; } - + uint32_t ledPin() { return _ledPin; } - + void ledPin(uint32_t value) { _ledPin = value; } - + + /** + * returns RISING if interrupt is created in a rising signal, FALLING otherwise + */ + uint32_t buttonPinInterruptOn() + { + return _buttonPinInterruptOn; + } + + /** + * Sets if the programming button creates a RISING or a FALLING signal. + * + * Set to RISING for GPIO--BUTTON--VDD or to FALLING for GPIO--BUTTON--GND + */ + void buttonPinInterruptOn(uint32_t value) + { + _buttonPinInterruptOn = value; + } + uint32_t buttonPin() { return _buttonPin; } - + void buttonPin(uint32_t value) { _buttonPin = value; } - + void readMemory() { _bau.readMemory(); } - + void writeMemory() { _bau.writeMemory(); } - + uint16_t induvidualAddress() { return _bau.deviceObject().induvidualAddress(); } - + void loop() { if (progMode() != _progLedState) @@ -158,32 +176,32 @@ template class KnxFacade : private SaveRestore } _bau.loop(); } - + void manufacturerId(uint16_t value) { _bau.deviceObject().manufacturerId(value); } - + void bauNumber(uint32_t value) { _bau.deviceObject().bauNumber(value); } - + void orderNumber(const char* value) { _bau.deviceObject().orderNumber(value); } - + void hardwareType(uint8_t* value) { _bau.deviceObject().hardwareType(value); } - + void version(uint16_t value) { _bau.deviceObject().version(value); } - + void start() { pinMode(_ledPin, OUTPUT); @@ -192,20 +210,20 @@ template class KnxFacade : private SaveRestore pinMode(_buttonPin, INPUT_PULLUP); - attachInterrupt(_buttonPin, buttonUp, RISING); + attachInterrupt(_buttonPin, buttonUp, _buttonPinInterruptOn); enabled(true); } - + void setSaveCallback(saveRestoreCallback func) { _saveCallback = func; } - + void setRestoreCallback(saveRestoreCallback func) { _restoreCallback = func; } - + uint8_t* paramData(uint32_t addr) { if (!_bau.configured()) @@ -213,7 +231,7 @@ template class KnxFacade : private SaveRestore return _bau.parameters().data(addr); } - + uint8_t paramByte(uint32_t addr) { if (!_bau.configured()) @@ -229,7 +247,7 @@ template class KnxFacade : private SaveRestore return _bau.parameters().getWord(addr); } - + uint32_t paramInt(uint32_t addr) { if (!_bau.configured()) @@ -237,12 +255,12 @@ template class KnxFacade : private SaveRestore return _bau.parameters().getInt(addr); } - + GroupObject& getGroupObject(uint16_t goNr) { return _bau.groupObjectTable().get(goNr); } - + void restart(uint16_t individualAddress) { _bau.restartRequest(individualAddress); @@ -252,14 +270,15 @@ template class KnxFacade : private SaveRestore P* _platformPtr = 0; B* _bauPtr = 0; B& _bau; - uint32_t _ledPinActiveOn = LOW; + uint32_t _ledPinActiveOn = LOW; uint32_t _ledPin = LED_BUILTIN; + uint32_t _buttonPinInterruptOn = RISING; uint32_t _buttonPin = 0; saveRestoreCallback _saveCallback = 0; saveRestoreCallback _restoreCallback = 0; bool _toogleProgMode = false; bool _progLedState = false; - + uint8_t* save(uint8_t* buffer) { if (_saveCallback != 0) @@ -267,7 +286,7 @@ template class KnxFacade : private SaveRestore return buffer; } - + uint8_t* restore(uint8_t* buffer) { if (_restoreCallback != 0)