mirror of https://github.com/ArduPilot/ardupilot
DataFlash: remove PX4 ESC logging code
Left the log structure in place as we really should be using it for telemetry-enabled ESCs
This commit is contained in:
parent
9e8d2d7f7d
commit
21f2b74096
|
@ -26,10 +26,6 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
||||
#include <uORB/topics/esc_status.h>
|
||||
#endif
|
||||
|
||||
#include "DFMessageWriter.h"
|
||||
|
||||
class DataFlash_Backend;
|
||||
|
|
|
@ -1512,43 +1512,6 @@ bool DataFlash_Backend::Log_Write_Mode(uint8_t mode, uint8_t reason)
|
|||
// Write ESC status messages
|
||||
void DataFlash_Class::Log_Write_ESC(void)
|
||||
{
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
||||
static int _esc_status_sub = -1;
|
||||
struct esc_status_s esc_status;
|
||||
|
||||
if (_esc_status_sub == -1) {
|
||||
// subscribe to ORB topic on first call
|
||||
_esc_status_sub = orb_subscribe(ORB_ID(esc_status));
|
||||
}
|
||||
|
||||
// check for new ESC status data
|
||||
bool esc_updated = false;
|
||||
orb_check(_esc_status_sub, &esc_updated);
|
||||
if (esc_updated && (OK == orb_copy(ORB_ID(esc_status), _esc_status_sub, &esc_status))) {
|
||||
if (esc_status.esc_count > 8) {
|
||||
esc_status.esc_count = 8;
|
||||
}
|
||||
uint64_t time_us = AP_HAL::micros64();
|
||||
for (uint8_t i = 0; i < esc_status.esc_count; i++) {
|
||||
// skip logging ESCs with a esc_address of zero, and this
|
||||
// are probably not populated. The Pixhawk itself should
|
||||
// be address zero
|
||||
if (esc_status.esc[i].esc_address != 0) {
|
||||
struct log_Esc pkt = {
|
||||
LOG_PACKET_HEADER_INIT((uint8_t)(LOG_ESC1_MSG + i)),
|
||||
time_us : time_us,
|
||||
rpm : (int32_t)(esc_status.esc[i].esc_rpm/10),
|
||||
voltage : (uint16_t)(esc_status.esc[i].esc_voltage*100.0f + .5f),
|
||||
current : (uint16_t)(esc_status.esc[i].esc_current*100.0f + .5f),
|
||||
temperature : (int16_t)(esc_status.esc[i].esc_temperature*100.0f + .5f),
|
||||
current_tot : 0
|
||||
};
|
||||
|
||||
WriteBlock(&pkt, sizeof(pkt));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_HAL_BOARD
|
||||
}
|
||||
|
||||
// Write a AIRSPEED packet
|
||||
|
|
Loading…
Reference in New Issue