DataFlash: added logging of safety state in POWR message
This commit is contained in:
parent
ecf2c51a8b
commit
cf4ca29dbb
@ -436,12 +436,18 @@ bool DataFlash_Backend::Log_Write_Message(const char *message)
|
|||||||
void DataFlash_Class::Log_Write_Power(void)
|
void DataFlash_Class::Log_Write_Power(void)
|
||||||
{
|
{
|
||||||
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4 || CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
|
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4 || CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
|
||||||
|
uint8_t safety_and_armed = uint8_t(hal.util->safety_switch_state());
|
||||||
|
if (hal.util->get_soft_armed()) {
|
||||||
|
// encode armed state in bit 3
|
||||||
|
safety_and_armed |= 1U<<2;
|
||||||
|
}
|
||||||
struct log_POWR pkt = {
|
struct log_POWR pkt = {
|
||||||
LOG_PACKET_HEADER_INIT(LOG_POWR_MSG),
|
LOG_PACKET_HEADER_INIT(LOG_POWR_MSG),
|
||||||
time_us : AP_HAL::micros64(),
|
time_us : AP_HAL::micros64(),
|
||||||
Vcc : hal.analogin->board_voltage(),
|
Vcc : hal.analogin->board_voltage(),
|
||||||
Vservo : hal.analogin->servorail_voltage(),
|
Vservo : hal.analogin->servorail_voltage(),
|
||||||
flags : hal.analogin->power_status_flags()
|
flags : hal.analogin->power_status_flags(),
|
||||||
|
safety_and_arm : safety_and_armed
|
||||||
};
|
};
|
||||||
WriteBlock(&pkt, sizeof(pkt));
|
WriteBlock(&pkt, sizeof(pkt));
|
||||||
#endif
|
#endif
|
||||||
|
@ -357,6 +357,7 @@ struct PACKED log_POWR {
|
|||||||
float Vcc;
|
float Vcc;
|
||||||
float Vservo;
|
float Vservo;
|
||||||
uint16_t flags;
|
uint16_t flags;
|
||||||
|
uint8_t safety_and_arm;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PACKED log_EKF1 {
|
struct PACKED log_EKF1 {
|
||||||
@ -1202,7 +1203,7 @@ Format characters in the format string for binary log messages
|
|||||||
{ LOG_BARO_MSG, sizeof(log_BARO), \
|
{ LOG_BARO_MSG, sizeof(log_BARO), \
|
||||||
"BARO", BARO_FMT, BARO_LABELS, BARO_UNITS, BARO_MULTS }, \
|
"BARO", BARO_FMT, BARO_LABELS, BARO_UNITS, BARO_MULTS }, \
|
||||||
{ LOG_POWR_MSG, sizeof(log_POWR), \
|
{ LOG_POWR_MSG, sizeof(log_POWR), \
|
||||||
"POWR","QffH","TimeUS,Vcc,VServo,Flags", "svv-", "FBB-" }, \
|
"POWR","QffHB","TimeUS,Vcc,VServo,Flags,Safety", "svv--", "FBB--" }, \
|
||||||
{ LOG_CMD_MSG, sizeof(log_Cmd), \
|
{ LOG_CMD_MSG, sizeof(log_Cmd), \
|
||||||
"CMD", "QHHHfffffffB","TimeUS,CTot,CNum,CId,Prm1,Prm2,Prm3,Prm4,Lat,Lng,Alt,Frame", "s-------DUm-", "F-------GG0-" }, \
|
"CMD", "QHHHfffffffB","TimeUS,CTot,CNum,CId,Prm1,Prm2,Prm3,Prm4,Lat,Lng,Alt,Frame", "s-------DUm-", "F-------GG0-" }, \
|
||||||
{ LOG_RADIO_MSG, sizeof(log_Radio), \
|
{ LOG_RADIO_MSG, sizeof(log_Radio), \
|
||||||
|
Loading…
Reference in New Issue
Block a user