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

AP_BattMonitor: Adds smart battery shutdown framework and TI BQ battery monitor #27288

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

IanBurwell
Copy link
Contributor

Adds ability to command shutdown of a smart-battery system via PREFLIGHT_REBOOT_SHUTDOWN, with an example BattMonitor backend that supports being commanded to poweroff.
We use the TI BQ40Z60 and BQ40Z60 chips at GreenSight in our Dreamer line of drones, and use this shutdown functionality to allow full system shutdown from a companion computer.
Note that the TI BQ BattMonitor backend also includes logic to reset the chip's emergency shutdown flag upon successful boot. This is used to ensure the battery stays on after charging is initiated.

Similar functionality was also implemented in a sibling PR that uses LUA but which lacks the broader framework for battery shutdown.

@IanBurwell
Copy link
Contributor Author

Sibling PR: #27287

Copy link
Member

@IamPete1 IamPete1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should hook into the existing battery power off stuff somehow.

// Check's each smart battery instance for its powering off state and broadcasts notifications
void AP_BattMonitor::checkPoweringOff(void)

That is for the shutdown signal coming in from the battery rather than the other way round. But we probably should send that mavlink MAV_CMD_POWER_OFF_INITIATED in this case too.

libraries/AP_BattMonitor/AP_BattMonitor_SMBus_TIBQ.cpp Outdated Show resolved Hide resolved
libraries/AP_BattMonitor/AP_BattMonitor_SMBus_TIBQ.h Outdated Show resolved Hide resolved
libraries/GCS_MAVLink/GCS_Common.cpp Outdated Show resolved Hide resolved
libraries/GCS_MAVLink/GCS_Common.cpp Outdated Show resolved Hide resolved
libraries/GCS_MAVLink/GCS_Common.cpp Outdated Show resolved Hide resolved
libraries/AP_BattMonitor/AP_BattMonitor.cpp Outdated Show resolved Hide resolved
libraries/AP_BattMonitor/AP_BattMonitor.cpp Outdated Show resolved Hide resolved
libraries/AP_BattMonitor/AP_BattMonitor.cpp Outdated Show resolved Hide resolved
libraries/AP_BattMonitor/AP_BattMonitor.cpp Outdated Show resolved Hide resolved
libraries/AP_BattMonitor/AP_BattMonitor.cpp Outdated Show resolved Hide resolved
Copy link
Member

@IamPete1 IamPete1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the shutdown functionality unique to the TI BQ? Or is the new driver really just a flag to say that its SMBus battery that can shutdown?

libraries/AP_BattMonitor/AP_BattMonitor.cpp Outdated Show resolved Hide resolved
libraries/AP_BattMonitor/AP_BattMonitor_SMBus_TIBQ.cpp Outdated Show resolved Hide resolved
libraries/GCS_MAVLink/GCS_Common.cpp Outdated Show resolved Hide resolved
libraries/GCS_MAVLink/GCS_Common.cpp Show resolved Hide resolved
Copy link
Collaborator

@Hwurzburg Hwurzburg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to update

// @Values: 0:Disabled,3:Analog Voltage Only,4:Analog Voltage and Current,5:Solo,6:Bebop,7:SMBus-Generic,8:DroneCAN-BatteryInfo,9:ESC,10:Sum Of Selected Monitors,11:FuelFlow,12:FuelLevelPWM,13:SMBUS-SUI3,14:SMBUS-SUI6,15:NeoDesign,16:SMBus-Maxell,17:Generator-Elec,18:Generator-Fuel,19:Rotoye,20:MPPT,21:INA2XX,22:LTC2946,23:Torqeedo,24:FuelLevelAnalog,25:Synthetic Current and Analog Voltage,26:INA239_SPI,27:EFI,28:AD7091R5,29:Scripting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants