From cdf55d7c709242ced9b0e3749f9651ccb6bcee25 Mon Sep 17 00:00:00 2001 From: haudamekki <38363966+haudamekki@users.noreply.github.com> Date: Thu, 31 Oct 2024 09:01:55 +0100 Subject: [PATCH] Update gp8211.cpp --- esphome/components/gp8211/gp8211.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/components/gp8211/gp8211.cpp b/esphome/components/gp8211/gp8211.cpp index f2e9e47024..124e7f1f5b 100644 --- a/esphome/components/gp8211/gp8211.cpp +++ b/esphome/components/gp8211/gp8211.cpp @@ -8,7 +8,9 @@ static const char *const TAG = "gp8211"; static const uint8_t RANGE_REGISTER = 0x01; -void GP8211::setup() { this->write_register(RANGE_REGISTER, &this->voltage_, 1); } +void GP8211::setup() { + this->write_register(RANGE_REGISTER, reinterpret_cast(&this->voltage_), sizeof(this->voltage_)); +} void GP8211::dump_config() { ESP_LOGCONFIG(TAG, "GP8211:");