Skip to content

Commit

Permalink
Fix: JK BMS: BMS name is second part of product ID
Browse files Browse the repository at this point in the history
  • Loading branch information
schlimmchen committed Apr 18, 2024
1 parent 4cd690d commit 1d4bea2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/BatteryStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,12 @@ void JkBmsBatteryStats::updateFrom(JkBms::DataPointContainer const& dp)
_manufacturer = "JKBMS";
auto oProductId = dp.get<Label::ProductId>();
if (oProductId.has_value()) {
_manufacturer = oProductId->c_str();
// the first twelve chars are expected to be the "User Private Data"
// setting (see smartphone app). the remainder is expected be the BMS
// name, which can be changed at will using the smartphone app. so
// there is not always a "JK" in this string. if there is, we still cut
// the string there to avoid possible regressions.
_manufacturer = oProductId->substr(12).c_str();
auto pos = oProductId->rfind("JK");
if (pos != std::string::npos) {
_manufacturer = oProductId->substr(pos).c_str();
Expand Down
Binary file modified webapp_dist/js/app.js.gz
Binary file not shown.

0 comments on commit 1d4bea2

Please sign in to comment.