|
|
|
@ -605,8 +605,8 @@ protected:
@@ -605,8 +605,8 @@ protected:
|
|
|
|
|
bat_msg.battery_function = MAV_BATTERY_FUNCTION_ALL; |
|
|
|
|
bat_msg.type = MAV_BATTERY_TYPE_LIPO; |
|
|
|
|
bat_msg.temperature = INT16_MAX; |
|
|
|
|
for (unsigned i = 0; i < (sizeof(bat_msg.voltages) / sizeof(bat_msg.voltages[0])); i++) { |
|
|
|
|
if (i < battery_status.cell_count) { |
|
|
|
|
for (unsigned int i = 0; i < (sizeof(bat_msg.voltages) / sizeof(bat_msg.voltages[0])); i++) { |
|
|
|
|
if ((int)i < battery_status.cell_count) { |
|
|
|
|
bat_msg.voltages[i] = (battery_status.voltage_v / battery_status.cell_count) * 1000.0f; |
|
|
|
|
} else { |
|
|
|
|
bat_msg.voltages[i] = UINT16_MAX; |
|
|
|
|