Fix ccs811 begin result check

This commit is contained in:
alex 2018-09-01 19:57:10 +02:00
parent 6d640cbd78
commit e5186e602e
1 changed files with 2 additions and 3 deletions

View File

@ -47,13 +47,12 @@ void CCS811Update() // Perform every n second
tcnt = 0; tcnt = 0;
CCS811_ready = 0; CCS811_ready = 0;
if (!CCS811_type) { if (!CCS811_type) {
sint8_t res = ccs.begin(CCS811_ADDRESS); if (ccs.begin(CCS811_ADDRESS)) { // ccs.begin returns true in case of success
if (!res) {
CCS811_type = 1; CCS811_type = 1;
snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "CCS811", 0x5A); snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "CCS811", 0x5A);
AddLog(LOG_LEVEL_DEBUG); AddLog(LOG_LEVEL_DEBUG);
} else { } else {
//snprintf_P(log_data, sizeof(log_data), "CCS811 init failed: %d",res); //snprintf_P(log_data, sizeof(log_data), "CCS811 init failed");
//AddLog(LOG_LEVEL_DEBUG); //AddLog(LOG_LEVEL_DEBUG);
} }
} else { } else {