mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 11:46:31 +00:00
parent
7581439133
commit
4b884679e6
@ -46,10 +46,9 @@ struct HIH6 {
|
|||||||
bool Hih6Read(void)
|
bool Hih6Read(void)
|
||||||
{
|
{
|
||||||
Wire.beginTransmission(HIH6_ADDR);
|
Wire.beginTransmission(HIH6_ADDR);
|
||||||
// Wire.write(0x00); // Select data register
|
|
||||||
if (Wire.endTransmission() != 0) { return false; } // In case of error
|
if (Wire.endTransmission() != 0) { return false; } // In case of error
|
||||||
|
|
||||||
// delay(40); // Wait for Valid data or use Stale data
|
delay(40); // Wait for Valid data (Stale data doesn't work. See #6808)
|
||||||
|
|
||||||
uint8_t data[4];
|
uint8_t data[4];
|
||||||
Wire.requestFrom(HIH6_ADDR, 4);
|
Wire.requestFrom(HIH6_ADDR, 4);
|
||||||
@ -76,10 +75,12 @@ bool Hih6Read(void)
|
|||||||
void Hih6Detect(void)
|
void Hih6Detect(void)
|
||||||
{
|
{
|
||||||
if (Hih6.type) { return; }
|
if (Hih6.type) { return; }
|
||||||
|
if (I2cActive(HIH6_ADDR)) { return; }
|
||||||
|
|
||||||
if (uptime < 2) { delay(20); } // Skip entering power on comand mode
|
if (uptime < 2) { delay(20); } // Skip entering power on comand mode
|
||||||
Hih6.type = Hih6Read();
|
Hih6.type = Hih6Read();
|
||||||
if (Hih6.type) {
|
if (Hih6.type) {
|
||||||
|
I2cSetActive(HIH6_ADDR);
|
||||||
AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, Hih6.types, HIH6_ADDR);
|
AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, Hih6.types, HIH6_ADDR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user