diff --git a/BMP280.cpp b/BMP280.cpp index f080fc3..f926786 100644 --- a/BMP280.cpp +++ b/BMP280.cpp @@ -2,7 +2,7 @@ #include "writepin.h" #include -BMP280::BMP280(SpiMaster* spi, volatile uint8_t *port, const uint8_t pin): _port(port), _pin(pin), _spi(spi) +BMP280::BMP280(SpiMaster * const spi, volatile uint8_t * const port, const uint8_t pin): _port(port), _pin(pin), _spi(spi) { writePin(_port, _pin, true); } diff --git a/BMP280.h b/BMP280.h index 4722f4b..2526235 100644 --- a/BMP280.h +++ b/BMP280.h @@ -3,7 +3,7 @@ #include "softspim.h" -//#define PRECOMP_COMPENSATION +#define PRECOMP_COMPENSATION class BMP280 { @@ -51,10 +51,10 @@ private: static constexpr int32_t var3 = 52; #endif - volatile uint8_t *_port; + volatile uint8_t * const _port; const uint8_t _pin; - SpiMaster *_spi; + SpiMaster * const _spi; void write(const uint8_t address, const uint8_t data); uint16_t read16b(const uint8_t address); @@ -63,6 +63,6 @@ private: public: - BMP280(SpiMaster* spi, volatile uint8_t *port, const uint8_t pin); + BMP280(SpiMaster * const spi, volatile uint8_t * const port, const uint8_t pin); uint16_t getPressure(); }; diff --git a/dht11.h b/dht11.h index b1cb7e4..f8d185d 100644 --- a/dht11.h +++ b/dht11.h @@ -8,7 +8,7 @@ class Dht11 static constexpr uint16_t LOOP_TIMEOUT_COUNT = (10000.0 / 16000000.0)*F_CPU; static constexpr uint8_t LOOP_TIMEOUT_SMALL_COUNT = (100.0 / 16000000.0)*F_CPU; static constexpr uint8_t BIT_COUNT = 6;//(8.0 / 16000000.0)*F_CPU; - static constexpr bool DHT22 = true; + static constexpr bool DHT22 = false; volatile unsigned char * const _port; volatile unsigned char * const _port_ctl; diff --git a/main.cpp b/main.cpp index b7b6959..4bc8198 100644 --- a/main.cpp +++ b/main.cpp @@ -18,7 +18,7 @@ EMPTY_INTERRUPT(WDT_OVERFLOW_vect); -static constexpr uint8_t id = 3; +static constexpr uint8_t id = 4; static constexpr bool WATCH_DOOR = false; static constexpr bool BMP_280 = false; static constexpr bool DHT22 = true; @@ -93,8 +93,7 @@ int main() if constexpr (DHT22) { debugBlink(false); - uint8_t readret; - readret = tempSensor.read(); + tempSensor.read(); paket[0] = 1; paket[2] = tempSensor.temperature >> 8; paket[3] = tempSensor.temperature; @@ -117,7 +116,7 @@ int main() debugBlink(false); paket[0] = 128; paket[2] = 0; - paket[3] = 1; + paket[3] = id; transmiter.sendPacket(paketUint); }