AP_Logger: allow compilation with HAL_LOGGING_ENABLED false

This commit is contained in:
Peter Barker 2023-07-14 10:58:06 +10:00 committed by Andrew Tridgell
parent 5ae4355e26
commit 486cbb7890
2 changed files with 17 additions and 3 deletions

View File

@ -5,6 +5,8 @@
#include "AP_Logger_config.h"
#if HAL_LOGGING_ENABLED
#include <AP_HAL/AP_HAL.h>
#include <AP_Common/AP_Common.h>
#include <AP_Param/AP_Param.h>
@ -609,3 +611,13 @@ private:
namespace AP {
AP_Logger &logger();
};
#define LOGGER_WRITE_ERROR(subsys, err) AP::logger().Write_Error(subsys, err)
#define LOGGER_WRITE_EVENT(evt) AP::logger().Write_Event(evt)
#else
#define LOGGER_WRITE_ERROR(subsys, err)
#define LOGGER_WRITE_EVENT(evt)
#endif // HAL_LOGGING_ENABLED

View File

@ -17,13 +17,15 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <GCS_MAVLink/GCS_config.h>
#include <AP_Logger/AP_Logger_config.h>
#if HAL_LOGGING_ENABLED && HAL_GCS_ENABLED
#include <AP_HAL/AP_HAL.h>
#include <AP_Logger/AP_Logger.h>
#include <GCS_MAVLink/GCS.h> // for LOG_ENTRY
#if HAL_GCS_ENABLED
extern const AP_HAL::HAL& hal;
/**
@ -327,4 +329,4 @@ bool AP_Logger::handle_log_send_data()
return true;
}
#endif
#endif // HAL_LOGGING_ENABLED && HAL_GCS_ENABLED