mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 14:33:34 +08:00
battery_status: report remaining flight time in seconds
This allows more accurate reporting and is compliant with the MAVLink interface.
This commit is contained in:
@@ -136,7 +136,7 @@ void BATT_SMBUS::RunImpl()
|
||||
|
||||
// Read run time to empty (minutes).
|
||||
ret |= _interface->read_word(BATT_SMBUS_RUN_TIME_TO_EMPTY, result);
|
||||
new_report.run_time_to_empty = result;
|
||||
new_report.time_remaining_s = result * 60;
|
||||
|
||||
// Read average time to empty (minutes).
|
||||
ret |= _interface->read_word(BATT_SMBUS_AVERAGE_TIME_TO_EMPTY, result);
|
||||
|
||||
@@ -162,7 +162,7 @@ void Batmon::RunImpl()
|
||||
|
||||
// Read run time to empty (minutes).
|
||||
ret |= _interface->read_word(BATT_SMBUS_RUN_TIME_TO_EMPTY, result);
|
||||
new_report.run_time_to_empty = result;
|
||||
new_report.time_remaining_s = result * 60;
|
||||
|
||||
// Read average time to empty (minutes).
|
||||
ret |= _interface->read_word(BATT_SMBUS_AVERAGE_TIME_TO_EMPTY, result);
|
||||
|
||||
@@ -83,7 +83,7 @@ UavcanBatteryBridge::battery_sub_cb(const uavcan::ReceivedDataStructure<uavcan::
|
||||
// battery.priority = msg.;
|
||||
battery.capacity = msg.full_charge_capacity_wh;
|
||||
// battery.cycle_count = msg.;
|
||||
// battery.run_time_to_empty = msg.;
|
||||
// battery.time_remaining_s = msg.;
|
||||
// battery.average_time_to_empty = msg.;
|
||||
battery.serial_number = msg.model_instance_id;
|
||||
battery.id = msg.getSrcNodeID().get();
|
||||
|
||||
@@ -79,7 +79,7 @@ UavcanCBATBridge::battery_sub_cb(const uavcan::ReceivedDataStructure<cuav::equip
|
||||
// battery.priority = msg.;
|
||||
battery.capacity = msg.full_charge_capacity * 1000;
|
||||
battery.cycle_count = msg.cycle_count;
|
||||
battery.run_time_to_empty = msg.average_time_to_empty;
|
||||
battery.time_remaining_s = msg.average_time_to_empty * 60;
|
||||
battery.average_time_to_empty = msg.average_time_to_empty;
|
||||
battery.serial_number = msg.serial_number;
|
||||
battery.manufacture_date = msg.manufacture_date;
|
||||
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
* connected (partly)
|
||||
* priority
|
||||
* cycle_count
|
||||
* run_time_to_empty
|
||||
* time_remaining_s
|
||||
* average_time_to_empty
|
||||
* manufacture_date
|
||||
* max_error
|
||||
|
||||
Reference in New Issue
Block a user