diff --git a/components/heltec_balancer_ble/number/heltec_number.cpp b/components/heltec_balancer_ble/number/heltec_number.cpp index 79b7f7ea..35d86ef1 100644 --- a/components/heltec_balancer_ble/number/heltec_number.cpp +++ b/components/heltec_balancer_ble/number/heltec_number.cpp @@ -14,7 +14,7 @@ void HeltecNumber::control(float value) { uint32_t payload = (this->holding_register_ == 0x01 || this->holding_register_ == 0x16) ? (uint32_t) value : ieee_float_(value); if (this->parent_->send_command(FUNCTION_WRITE, COMMAND_WRITE_REGISTER, this->holding_register_, payload)) { - this->publish_state(state); + this->publish_state(value); } } diff --git a/components/jk_bms_ble/number/jk_number.cpp b/components/jk_bms_ble/number/jk_number.cpp index 78635cfc..e5cb126d 100644 --- a/components/jk_bms_ble/number/jk_number.cpp +++ b/components/jk_bms_ble/number/jk_number.cpp @@ -11,7 +11,7 @@ void JkNumber::control(float value) { if (this->parent_->get_protocol_version() == PROTOCOL_VERSION_JK04 && this->jk04_holding_register_) { uint32_t payload = (uint32_t) (value * this->factor_); if (this->parent_->write_register(this->jk04_holding_register_, payload, sizeof(payload))) { - this->publish_state(state); + this->publish_state(value); } return; } @@ -19,7 +19,7 @@ void JkNumber::control(float value) { if (this->parent_->get_protocol_version() == PROTOCOL_VERSION_JK02_24S && this->jk02_holding_register_) { uint32_t payload = (uint32_t) (value * this->factor_); if (this->parent_->write_register(this->jk02_holding_register_, payload, sizeof(payload))) { - this->publish_state(state); + this->publish_state(value); } return; } @@ -27,7 +27,7 @@ void JkNumber::control(float value) { if (this->parent_->get_protocol_version() == PROTOCOL_VERSION_JK02_32S && this->jk02_32s_holding_register_) { uint32_t payload = (uint32_t) (value * this->factor_); if (this->parent_->write_register(this->jk02_32s_holding_register_, payload, sizeof(payload))) { - this->publish_state(state); + this->publish_state(value); } return; }