-
-
Notifications
You must be signed in to change notification settings - Fork 348
Add support for BQ27441 battery monitor #323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
09b281b to
13e8674
Compare
|
Sorry, it exploded after I rebased it but now should be fine. |
src/batterymonitor.h
Outdated
| float getVoltage() const { return voltage; } | ||
| float getLevel() const { return level; } | ||
|
|
||
| String getExtendedInfo(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use std::string instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/serial/serialcommands.cpp
Outdated
| } | ||
| logger.info( | ||
| "Battery voltage: %.3f, level: %.1f%%", | ||
| "Battery voltage: %.3f, level: %.1f%%, %s", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this adds an unnecessary leading "," when anything other than the BQ chip is in use
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/defines.h
Outdated
| #if BATTERY_MONITOR == BAT_BQ27441 && I2C_SPEED > 100000 | ||
| #error BQ27441 library supports only 100 kHz I2C speed | ||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how well this requirement would work, the sensor reading speed is already somewhat the bottleneck with 400kHz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, for daily use I use trackers iwth single IMU but if I tried it with 2nd one it got laggy.
I improved the sparkfun lib to support i2c >100 kHz.
Adds support for BQ27441 battery gauge IC.
This IC is used for example in this sparkfun dev board: https://www.sparkfun.com/products/13777 and also can be used on custom PCBs.
It uses Sparkfun library for this IC: https://github.com/sparkfun/SparkFun_BQ27441_Arduino_Library, it is MIT license.
I modified this library slightly to disable
Wire.begin()call in it.