saved some bytes
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
#include "dht11.h"
|
||||
|
||||
Dht11::Dht11(volatile unsigned char *port, volatile unsigned char *inPort, volatile unsigned char *port_ctl, const unsigned char pin): _port(port), _inPort(inPort), _port_ctl(port_ctl), _pin(pin)
|
||||
Dht11::Dht11(volatile unsigned char * const port, volatile unsigned char * const inPort, volatile unsigned char * const port_ctl, const unsigned char pin): _port(port), _inPort(inPort), _port_ctl(port_ctl), _pin(pin)
|
||||
{}
|
||||
|
||||
uint8_t Dht11::read()
|
||||
@ -53,9 +53,7 @@ uint8_t Dht11::read()
|
||||
}
|
||||
else cnt--;
|
||||
}
|
||||
|
||||
// WRITE TO RIGHT VARS
|
||||
// as bits[1] and bits[3] are allways zero they are omitted in formulas.
|
||||
|
||||
uint8_t sum;
|
||||
if constexpr(DHT22) sum= bits[0] + bits[1] + bits[2] + bits[3];
|
||||
else sum = bits[1] + bits[3];
|
||||
|
Reference in New Issue
Block a user