mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-20 01:06:31 +00:00
structual changes
structual changes
This commit is contained in:
parent
01fbe69824
commit
2e0a06c19a
@ -61,7 +61,7 @@ bool begin()
|
|||||||
|
|
||||||
bool AHT10Read(void)
|
bool AHT10Read(void)
|
||||||
{
|
{
|
||||||
unsigned long result, temp[6];
|
unsigned long result_t, result_h, temp[6];
|
||||||
|
|
||||||
if (AHT10.valid) { AHT10.valid--; }
|
if (AHT10.valid) { AHT10.valid--; }
|
||||||
|
|
||||||
@ -75,9 +75,11 @@ bool AHT10Read(void)
|
|||||||
{
|
{
|
||||||
temp[i] = Wire.read();
|
temp[i] = Wire.read();
|
||||||
}
|
}
|
||||||
|
result_h = ((temp[1] << 16) | (temp[2] << 8) | temp[3]) >> 4;
|
||||||
|
result_t = ((temp[3] & 0x0F) << 16) | (temp[4] << 8) | temp[5];
|
||||||
|
|
||||||
AHT10.humidity = (((temp[1] << 16) | (temp[2] << 8) | temp[3]) >> 4)* 100 / 1048576;
|
AHT10.humidity = result_h * 100 / 1048576;
|
||||||
AHT10.temperature = ((200 * (((temp[3] & 0x0F) << 16) | (temp[4] << 8) | temp[5])) / 1048576) - 50;
|
AHT10.temperature = ((200 * result_t) / 1048576) - 50;
|
||||||
|
|
||||||
if (isnan(AHT10.temperature) || isnan(AHT10.humidity)) { return false; }
|
if (isnan(AHT10.temperature) || isnan(AHT10.humidity)) { return false; }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user