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

Disable secondary power source by default, fix battery param migration (take 2) #15985

Merged
merged 4 commits into from
Oct 20, 2020

Conversation

bkueng
Copy link
Member

@bkueng bkueng commented Oct 16, 2020

Apparently #15616 was still incorrect.

  • Fixes param migration, e.g. if BAT_N_CELLS is set, migrates to BAT1_N_CELLS.
  • disable secondary module by default. This avoids a GCS showing 2 battery indicators. Alternatively we could also check the 'connected' flag, but this is more explicit.

@DonLakeFlyer does this work for you?

Fixes #15929

updateBatteryStatus() already publishes
@dagar dagar self-requested a review October 16, 2020 13:40
@dagar dagar added the bug label Oct 16, 2020
@dagar dagar requested a review from DonLakeFlyer October 16, 2020 13:40
src/lib/battery/battery.h Outdated Show resolved Hide resolved
dagar
dagar previously approved these changes Oct 16, 2020
Copy link
Member

@dagar dagar left a comment

Choose a reason for hiding this comment

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

I'd like to get feedback from @DonLakeFlyer and test myself, but otherwise the changes look good.

@DonLakeFlyer
Copy link
Contributor

This is the first I'm hearing about a new BAT#_SOURCE parameter. The QGC Power setup currently does have that in the ui. I assume I need to add that. And then after that this looks like exactly what is needed.

But where's the change to not send telemetry for a battery with BAT#_SOURCE=disabled.

You can verify that QGC will be happy with telemetry by using daily build and you get the correct number of batteries in the toolbar. Also could someone run daily and look at Power setup to see if there is other stuff missing there?

@DonLakeFlyer
Copy link
Contributor

Are the voltage/current divider params only valid for some selection of BAT#_SOURCE? Or is that needs for all source types?

@cuhome
Copy link

cuhome commented Oct 19, 2020

@cuhome
Copy link

cuhome commented Oct 19, 2020

@dagar 可以一起解决此错误吗?

I suggest adding a BAT_can_N_CELLS parameter to fix the uavcan battery bug.

Fixes param migration, e.g. if BAT_N_CELLS is set, migrates to
BAT1_N_CELLS.
Avoid a GCS showing 2 battery indicators.
Alternatively we could also check the 'connected' flag, but this is more
explicit.
The battery migration interferes with the tests.
@bkueng
Copy link
Member Author

bkueng commented Oct 19, 2020

But where's the change to not send telemetry for a battery with BAT#_SOURCE=disabled.

No further change needed, that's already the effect of BAT#_SOURCE=disabled.

You can verify that QGC will be happy with telemetry by using daily build and you get the correct number of batteries in the toolbar.

I tested it against that. The default will now only show 1 battery, and enabling BAT2_SOURCE will show 2.

Are the voltage/current divider params only valid for some selection of BAT#_SOURCE? Or is that needs for all source types?

Currently only for Power Module (0).

Copy link
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

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

I wonder how that happened, I remember testing all cases on hardware. Must have been a last minute change after that 😬
9c4e26c#diff-0eb86e4eec709144f8f3fa953148871cd33a1b6a2332316777c39260e22848a3L191-R195
Thanks for fixing the check @bkueng !

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.

Various battery related issues with 1.11
5 participants