Skip to content
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

FuriHal, drivers: rework gauge initialization routine #3912

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

skotopes
Copy link
Member

@skotopes skotopes commented Sep 19, 2024

!!! Warning !!!

This PR changes gauge security settings: by default gauge will be SEALED, we only unseal it for a short period of time while doing initialization routine.
This was done to prevent configuration damage and gauge transition into state where recovery becomes complex.

Downgrade from this firmware is not possible, it will break old initialization routine, you will see [ - ] instead of battery indicator.

If you must downgrade then unplug battery for a short period of time. That will reset gauge in unsealed state.

What's new

  • FuriHal: rework gauge initialization, ensure that we can rec over from any kind of internal/external issue
  • bq27220: ensure that gauge is sealed all the time except initialization
  • bq27220: reset gauge if it stuck in init phase
  • bq27220: extra delay between i2c transmissions according to Ti spec

Verification

  • Fixes issue with gauge stuck in [ - ] mode
  • Check logs, check battery stats

Checklist (For Reviewer)

  • PR has description of feature/bug or link to Confluence/Jira task
  • Description contains actions to verify feature/bugfix
  • I've built this code, uploaded it to the device and verified feature/bugfix

…over from any kind of internal/external issue
Copy link

github-actions bot commented Sep 19, 2024

Compiled f7 firmware for commit 89ef17cb:

Copy link

PVS-Studio report for commit 84eb58d7:

@skotopes skotopes changed the title FuriHal, drivers: rework gauge initialization, ensure that we can rec over from any kind of internal/external issue FuriHal, drivers: rework gauge initialization routine Sep 24, 2024
lib/drivers/bq27220.c Outdated Show resolved Hide resolved
lib/drivers/bq27220.c Outdated Show resolved Hide resolved
lib/drivers/bq27220.c Outdated Show resolved Hide resolved
lib/drivers/bq27220.c Outdated Show resolved Hide resolved
lib/drivers/bq27220.c Outdated Show resolved Hide resolved
lib/drivers/bq27220.c Outdated Show resolved Hide resolved
lib/drivers/bq27220.c Outdated Show resolved Hide resolved
lib/drivers/bq27220.c Outdated Show resolved Hide resolved
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.

2 participants