Skip to content

Commit

Permalink
Fix current sensor (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi authored May 23, 2022
1 parent 3944c36 commit d9e9311
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/jbd_bms/jbd_bms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ void JbdBms::on_hardware_info_data_(const std::vector<uint8_t> &data) {
float total_voltage = jbd_get_16bit(0) * 0.01f;
this->publish_state_(this->total_voltage_sensor_, total_voltage);

float current = jbd_get_16bit(2) * 0.01f;
float current = (float) ((int16_t) jbd_get_16bit(2)) * 0.01f;
this->publish_state_(this->current_sensor_, current);
this->publish_state_(this->power_sensor_, total_voltage * current);
this->publish_state_(this->capacity_remaining_sensor_, (float) jbd_get_16bit(4) * 0.01f);
Expand Down

0 comments on commit d9e9311

Please sign in to comment.