[sgp30] Fix serial number truncation from 48-bit to 24-bit (#14478)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jonathan Swoboda
2026-03-04 18:18:28 -05:00
committed by GitHub
parent 55103c0652
commit b6d7e8e14d

View File

@@ -41,7 +41,9 @@ void SGP30Component::setup() {
this->mark_failed();
return;
}
this->serial_number_ = encode_uint24(raw_serial_number[0], raw_serial_number[1], raw_serial_number[2]);
this->serial_number_ = (static_cast<uint64_t>(raw_serial_number[0]) << 32) |
(static_cast<uint64_t>(raw_serial_number[1]) << 16) |
static_cast<uint64_t>(raw_serial_number[2]);
ESP_LOGD(TAG, "Serial number: %" PRIu64, this->serial_number_);
// Featureset identification for future use