From d0004409278cd7e63b5bc0a8e1b9abad0308327d Mon Sep 17 00:00:00 2001 From: korellas Date: Mon, 15 Jun 2020 12:41:17 +0900 Subject: [PATCH] sgp30 baseline write bug (#1157) (#1078) --- esphome/components/sgp30/sgp30.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/esphome/components/sgp30/sgp30.cpp b/esphome/components/sgp30/sgp30.cpp index 8c148b8e83..1ef43c1c73 100644 --- a/esphome/components/sgp30/sgp30.cpp +++ b/esphome/components/sgp30/sgp30.cpp @@ -162,11 +162,11 @@ void SGP30Component::send_env_data_() { void SGP30Component::write_iaq_baseline_(uint16_t eco2_baseline, uint16_t tvoc_baseline) { uint8_t data[7]; data[0] = SGP30_CMD_SET_IAQ_BASELINE & 0xFF; - data[1] = eco2_baseline >> 8; - data[2] = eco2_baseline & 0xFF; + data[1] = tvoc_baseline >> 8; + data[2] = tvoc_baseline & 0xFF; data[3] = sht_crc_(data[1], data[2]); - data[4] = tvoc_baseline >> 8; - data[5] = tvoc_baseline & 0xFF; + data[4] = eco2_baseline >> 8; + data[5] = eco2_baseline & 0xFF; data[6] = sht_crc_(data[4], data[5]); if (!this->write_bytes(SGP30_CMD_SET_IAQ_BASELINE >> 8, data, 7)) { ESP_LOGE(TAG, "Error applying eCO2 baseline: 0x%04X, TVOC baseline: 0x%04X", eco2_baseline, tvoc_baseline);