Skip to content

Battery fix#3

Open
HydrogenRb wants to merge 4 commits into
Pamir-AI:mainfrom
HydrogenRb:battery_fix
Open

Battery fix#3
HydrogenRb wants to merge 4 commits into
Pamir-AI:mainfrom
HydrogenRb:battery_fix

Conversation

@HydrogenRb
Copy link
Copy Markdown

Battery.py
Add a time.sleep_ms(10) after select Block. The Chip need time to handle this.
Internal registers are stored as big-endian
Example:
Command: block = bytearray(bq._rd(0x40, 32))
获取了数据:
[DEEP] Raw State block (0x52,0): A8 05 0B 0B 0B B8 0B 0B 0B 0B B8 0C 80 0C 80 0C 80 01 00 64 10 04 00 AC CC 51 3A A6 85 4C 41 AF
参考值:0x0BB8是3000

@HydrogenRb
Copy link
Copy Markdown
Author

更新了fix battery.py这个class
之前的大bug是:remaining从i2c(0x1c)读出,但是那个寄存器中是0%~100%代表了电量百分比
之前的缺漏是:缺少通过i2c read其他寄存器的方法
目前的用法:
例1.通过i2c_get_DesignCapacity()验证内部设置是否正确
if(i2c_get_DesignCapacity() == 3000) {正确}
例2.通过i2c_get_FullChargeCapacity()获得系统内部测量校准出来的容量。比如说,贴着7 22 TEST的电池,测出来的是7750mAh左右
例3.通过i2c_get_StateOfCharge()获得内部计算的电量百分比

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant