mirror of https://github.com/ArduPilot/ardupilot
DataFlash: implement a printf-like Log_Write_MessageF method
This commit is contained in:
parent
385d1c1951
commit
608d6d0a5f
|
@ -7,6 +7,8 @@
|
|||
|
||||
DataFlash_Class *DataFlash_Class::_instance;
|
||||
|
||||
extern const AP_HAL::HAL& hal;
|
||||
|
||||
const AP_Param::GroupInfo DataFlash_Class::var_info[] = {
|
||||
// @Param: _BACKEND_TYPE
|
||||
// @DisplayName: DataFlash Backend Storage type
|
||||
|
@ -251,6 +253,18 @@ bool DataFlash_Class::logging_failed() const
|
|||
return backends[0]->logging_failed();
|
||||
}
|
||||
|
||||
void DataFlash_Class::Log_Write_MessageF(const char *fmt, ...)
|
||||
{
|
||||
char msg[64] {};
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
hal.util->vsnprintf(msg, sizeof(msg), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
Log_Write_Message(msg);
|
||||
}
|
||||
|
||||
#define FOR_EACH_BACKEND(methodcall) \
|
||||
do { \
|
||||
for (uint8_t i=0; i<_next_backend; i++) { \
|
||||
|
|
|
@ -129,6 +129,7 @@ public:
|
|||
bool Log_Write_MavCmd(uint16_t cmd_total, const mavlink_mission_item_t& mav_cmd);
|
||||
void Log_Write_Radio(const mavlink_radio_t &packet);
|
||||
void Log_Write_Message(const char *message);
|
||||
void Log_Write_MessageF(const char *fmt, ...);
|
||||
void Log_Write_CameraInfo(enum LogMessages msg, const AP_AHRS &ahrs, const AP_GPS &gps, const Location ¤t_loc);
|
||||
void Log_Write_Camera(const AP_AHRS &ahrs, const AP_GPS &gps, const Location ¤t_loc);
|
||||
void Log_Write_Trigger(const AP_AHRS &ahrs, const AP_GPS &gps, const Location ¤t_loc);
|
||||
|
|
Loading…
Reference in New Issue