batmon: switch to battery_info.serial_number

This commit is contained in:
Matthias Grob 2025-05-26 18:10:28 +02:00 committed by Silvan Fuhrer
parent 2237bfa9a9
commit 3ec684153a

View File

@ -191,7 +191,6 @@ void Batmon::RunImpl()
if (ret == PX4_OK) {
new_report.capacity = _batt_capacity;
new_report.cycle_count = _cycle_count;
new_report.serial_number = _serial_number;
new_report.max_cell_voltage_delta = _max_cell_voltage_delta;
new_report.cell_count = _cell_count;
new_report.state_of_health = _state_of_health;
@ -220,6 +219,12 @@ void Batmon::RunImpl()
orb_publish_auto(ORB_ID(battery_status), &_batt_topic, &new_report, &instance);
_last_report = new_report;
battery_info_s battery_info{};
battery_info.timestamp = new_report.timestamp;
battery_info.id = new_report.id;
snprintf(battery_info.serial_number, sizeof(battery_info.serial_number), "%" PRIu16, _serial_number);
orb_publish_auto(ORB_ID(battery_info), &_battery_info_topic, &battery_info, &instance);
}
}