Beispiel #1
0
void GCS_MAVLINK::send_battery_status(const AP_BattMonitor &battery){
	uint16_t voltages[10];
	memset(voltages, 0, sizeof(uint16_t)*10);
	voltages[0] = battery.voltage()/1000;
	mavlink_msg_battery_status_send(chan,
			0,
			MAV_BATTERY_FUNCTION_ALL,
			MAV_BATTERY_TYPE_LIPO,
			INT16_MAX,
			voltages,
			battery.current_amps()*100,
			battery.current_total_mah(),
			-1,
			battery.capacity_remaining_pct());
}
Beispiel #2
0
static void mavlink_send_battery_status(struct transport_tx *trans, struct link_device *dev)
{
  static uint16_t voltages[10];
  // we simply only set one cell for now
  voltages[0] = electrical.vsupply * 100;
  /// TODO: check what all these fields are supposed to represent
  mavlink_msg_battery_status_send(MAVLINK_COMM_0,
                                  0, // id
                                  0, // battery_function
                                  0, // type
                                  INT16_MAX, // unknown temperature
                                  voltages, // cell voltages
                                  electrical.current / 10,
                                  electrical.consumed,
                                  electrical.energy, // check scaling
                                  -1); // remaining percentage not estimated
  MAVLinkSendMessage();
}