From 59c6240e1477210f9ffbd1b4f8c3febc466ec67d Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Tue, 24 May 2022 07:16:35 +0200 Subject: [PATCH] Use explicit type --- components/ant_bms/ant_bms.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/ant_bms/ant_bms.cpp b/components/ant_bms/ant_bms.cpp index ad05239..3bb642b 100644 --- a/components/ant_bms/ant_bms.cpp +++ b/components/ant_bms/ant_bms.cpp @@ -111,7 +111,7 @@ void AntBms::on_status_data_(const std::vector &data) { this->publish_state_(this->cells_[i].cell_voltage_sensor_, (float) ant_get_16bit(i * 2 + 6) * 0.001f); } // 70 0x00 0x00 0x00 0x00: Current 0.0 A 0.1 A - float current = ((int) ant_get_32bit(70)) * 0.1f; + float current = ((int32_t) ant_get_32bit(70)) * 0.1f; this->publish_state_(this->current_sensor_, current); // 74 0x64: SOC 100 % 1.0 % this->publish_state_(this->soc_sensor_, (float) data[74]); @@ -175,7 +175,7 @@ void AntBms::on_status_data_(const std::vector &data) { if (this->supports_new_commands_) { this->publish_state_(this->power_sensor_, total_voltage * current); } else { - this->publish_state_(this->power_sensor_, (float) (int) ant_get_32bit(111)); + this->publish_state_(this->power_sensor_, (float) (int32_t) ant_get_32bit(111)); } // 115 0x0D: Cell with the highest voltage Cell 13 this->publish_state_(this->max_voltage_cell_sensor_, (float) data[115]);