mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 07:03:34 +08:00
extend support for Battery status message
Signed-off-by: Claudio Micheli <claudio@auterion.com>
This commit is contained in:
committed by
Beat Küng
parent
bb1177d504
commit
d122513197
@@ -38,21 +38,10 @@
|
||||
#include <lib/parameters/param.h>
|
||||
#include <uORB/Subscription.hpp>
|
||||
#include <uORB/topics/system_power.h>
|
||||
#include <math.h>
|
||||
|
||||
using namespace time_literals;
|
||||
|
||||
unsigned int countSetBits(unsigned int n)
|
||||
{
|
||||
unsigned int count = 0;
|
||||
|
||||
while (n) {
|
||||
count += n & 1;
|
||||
n >>= 1;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
bool PreFlightCheck::powerCheck(orb_advert_t *mavlink_log_pub, const vehicle_status_s &status, const bool report_fail,
|
||||
const bool prearm)
|
||||
{
|
||||
@@ -100,7 +89,7 @@ bool PreFlightCheck::powerCheck(orb_advert_t *mavlink_log_pub, const vehicle_sta
|
||||
}
|
||||
|
||||
|
||||
const int power_module_count = countSetBits(system_power.brick_valid);
|
||||
const int power_module_count = math::countSetBits(system_power.brick_valid);
|
||||
|
||||
if (power_module_count < required_power_module_count) {
|
||||
success = false;
|
||||
|
||||
Reference in New Issue
Block a user