From 2b058c0862c1eff8243004095a8ed3cdac870469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Poczkodi?= Date: Mon, 14 Oct 2024 00:06:02 +0200 Subject: [PATCH] formatting --- esphome/components/kt0803/kt0803.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/esphome/components/kt0803/kt0803.cpp b/esphome/components/kt0803/kt0803.cpp index 953e7dbb3d..2ec59b1bdc 100644 --- a/esphome/components/kt0803/kt0803.cpp +++ b/esphome/components/kt0803/kt0803.cpp @@ -288,21 +288,19 @@ void KT0803Component::set_pga(float value) { -15 10001 => 01111 15 */ - long pga = lround(value); + int pga = (int) std::lround(value); if (pga > 0) { pga += 19; } else if (pga < 0) { pga = -pga; } - this->state_.PGA = pga >> 2; - this->state_.PGA_LSB = pga & 3; + this->state_.PGA = (uint8_t) (pga >> 2); + this->state_.PGA_LSB = (uint8_t) (pga & 3); this->write_reg_(0x01); if (this->chip_id_ != ChipId::KT0803) { this->write_reg_(0x04); } - ESP_LOGV(TAG, "PGA %02X", (int) pga); - this->publish_pga(); } @@ -327,7 +325,7 @@ void KT0803Component::set_rfgain(float value) { return; } - long v = std::lround(value * 10); + uint16_t v = (uint16_t) std::lround(value * 10); for (size_t i = 0; i < countof(RF_GAIN_MAP); i++) { if (v <= RF_GAIN_MAP[i]) { @@ -642,7 +640,7 @@ void KT0803Component::set_alc_gain(float value) { return; } - long v = lround(value); + int v = (int) std::lround(value); if (v <= -15) { this->state_.ALCCMPGAIN = 3;