From 6f080742b8d89ff473909ab7fde5ea8209a7bca4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 17 Feb 2012 15:12:48 +1100 Subject: [PATCH] AP_Param: added an initialised() method this will be used by the compass code --- libraries/AP_Common/AP_Param.cpp | 6 ++++++ libraries/AP_Common/AP_Param.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/libraries/AP_Common/AP_Param.cpp b/libraries/AP_Common/AP_Param.cpp index 15e3119c4c..e3d73c3059 100644 --- a/libraries/AP_Common/AP_Param.cpp +++ b/libraries/AP_Common/AP_Param.cpp @@ -206,6 +206,12 @@ bool AP_Param::setup(const AP_Param::Info *info, uint8_t num_vars, uint16_t eepr return true; } +// check if AP_Param has been initialised +bool AP_Param::initialised(void) +{ + return _var_info != NULL; +} + // find the info structure given a header and a group_info table // return the Info structure and a pointer to the variables storage const struct AP_Param::Info *AP_Param::find_by_header_group(struct Param_header phdr, void **ptr, diff --git a/libraries/AP_Common/AP_Param.h b/libraries/AP_Common/AP_Param.h index 5d2de07d97..0cee4be55c 100644 --- a/libraries/AP_Common/AP_Param.h +++ b/libraries/AP_Common/AP_Param.h @@ -80,6 +80,9 @@ public: // wrong version is found static bool setup(const struct Info *info, uint8_t num_vars, uint16_t eeprom_size); + // return true if AP_Param has been initialised via setup() + static bool initialised(void); + /// Copy the variable's name, prefixed by any containing group name, to a buffer. /// /// If the variable has no name, the buffer will contain an empty string.