APM:Libraries
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
AP_Param Class Reference

#include <AP_Param.h>

Inheritance diagram for AP_Param:
[legend]
Collaboration diagram for AP_Param:
[legend]

Classes

struct  ConversionInfo
 
struct  EEPROM_header
 
struct  GroupInfo
 
struct  GroupNesting
 
struct  Info
 
struct  param_defaults_struct
 
struct  Param_header
 
struct  param_override
 
struct  ParamToken
 

Public Types

enum  { CONVERT_FLAG_REVERSE =1, CONVERT_FLAG_FORCE =2 }
 

Public Member Functions

 AP_Param (const struct Info *info)
 
 AP_Param ()
 
void copy_name_info (const struct AP_Param::Info *info, const struct GroupInfo *ginfo, const struct GroupNesting &group_nesting, uint8_t idx, char *buffer, size_t bufferSize, bool force_scalar=false) const
 
void copy_name_token (const ParamToken &token, char *buffer, size_t bufferSize, bool force_scalar=false) const
 
void notify () const
 
bool save (bool force_save=false)
 
bool load (void)
 
void set_float (float value, enum ap_var_type var_type)
 
float cast_to_float (enum ap_var_type type) const
 cast a variable to a float given its type More...
 
bool configured_in_defaults_file (void) const
 
bool configured_in_storage (void) const
 
bool configured (void) const
 

Static Public Member Functions

static bool setup ()
 
static bool initialised (void)
 
static uint32_t group_id (const struct GroupInfo *grpinfo, uint32_t base, uint8_t i, uint8_t shift)
 
static AP_Paramfind (const char *name, enum ap_var_type *ptype)
 
static bool set_default_by_name (const char *name, float value)
 
static bool set_by_name (const char *name, float value)
 
static bool set_and_save_by_name (const char *name, float value)
 
static AP_Paramfind_by_index (uint16_t idx, enum ap_var_type *ptype, ParamToken *token)
 
static bool find_key_by_pointer_group (const void *ptr, uint16_t vindex, const struct GroupInfo *group_info, ptrdiff_t offset, uint16_t &key)
 
static bool find_key_by_pointer (const void *ptr, uint16_t &key)
 
static AP_Paramfind_object (const char *name)
 
static bool load_all (bool check_defaults_file=true)
 
static void reload_defaults_file (bool panic_on_error=true)
 
static void load_object_from_eeprom (const void *object_pointer, const struct GroupInfo *group_info)
 
static void set_value (enum ap_var_type type, void *ptr, float def_value)
 
static void setup_object_defaults (const void *object_pointer, const struct GroupInfo *group_info)
 
static bool set_object_value (const void *object_pointer, const struct GroupInfo *group_info, const char *name, float value)
 
static void setup_sketch_defaults (void)
 
static bool find_old_parameter (const struct ConversionInfo *info, AP_Param *value)
 
static void convert_old_parameters (const struct ConversionInfo *conversion_table, uint8_t table_size, uint8_t flags=0)
 
static void convert_old_parameter (const struct ConversionInfo *info, float scaler, uint8_t flags=0)
 
static void convert_parent_class (uint8_t param_key, void *object_pointer, const struct AP_Param::GroupInfo *group_info)
 
static void erase_all (void)
 
static AP_Paramfirst (ParamToken *token, enum ap_var_type *ptype)
 
static AP_Paramnext (ParamToken *token, enum ap_var_type *ptype)
 
static AP_Paramnext_scalar (ParamToken *token, enum ap_var_type *ptype)
 
static bool check_var_info (void)
 
static uint16_t count_parameters (void)
 
static void set_hide_disabled_groups (bool value)
 
static void set_frame_type_flags (uint16_t flags_to_set)
 
static bool check_frame_type (uint16_t flags)
 

Private Member Functions

const struct Infofind_var_info_group (const struct GroupInfo *group_info, uint16_t vindex, uint32_t group_base, uint8_t group_shift, ptrdiff_t group_offset, uint32_t *group_element, const struct GroupInfo *&group_ret, struct GroupNesting &group_nesting, uint8_t *idx) const
 
const struct Infofind_var_info (uint32_t *group_element, const struct GroupInfo *&group_ret, struct GroupNesting &group_nesting, uint8_t *idx) const
 
const struct Infofind_var_info_token (const ParamToken &token, uint32_t *group_element, const struct GroupInfo *&group_ret, struct GroupNesting &group_nesting, uint8_t *idx) const
 
void add_vector3f_suffix (char *buffer, size_t buffer_size, uint8_t idx) const
 
void send_parameter (const char *name, enum ap_var_type param_header_type, uint8_t idx) const
 

Static Private Member Functions

static bool check_group_info (const struct GroupInfo *group_info, uint16_t *total_size, uint8_t max_bits, uint8_t prefix_length)
 
static bool duplicate_key (uint16_t vindex, uint16_t key)
 
static bool adjust_group_offset (uint16_t vindex, const struct GroupInfo &group_info, ptrdiff_t &new_offset)
 
static bool get_base (const struct Info &info, ptrdiff_t &base)
 
static const struct GroupInfoget_group_info (const struct GroupInfo &ginfo)
 get group_info pointer based on flags More...
 
static const struct GroupInfoget_group_info (const struct Info &ginfo)
 get group_info pointer based on flags More...
 
static const struct Infofind_by_header_group (struct Param_header phdr, void **ptr, uint16_t vindex, const struct GroupInfo *group_info, uint32_t group_base, uint8_t group_shift, ptrdiff_t group_offset)
 
static const struct Infofind_by_header (struct Param_header phdr, void **ptr)
 
static AP_Paramfind_group (const char *name, uint16_t vindex, ptrdiff_t group_offset, const struct GroupInfo *group_info, enum ap_var_type *ptype)
 
static void write_sentinal (uint16_t ofs)
 
static uint16_t get_key (const Param_header &phdr)
 
static void set_key (Param_header &phdr, uint16_t key)
 
static bool is_sentinal (const Param_header &phrd)
 
static bool scan (const struct Param_header *phdr, uint16_t *pofs)
 
static uint8_t type_size (enum ap_var_type type)
 
static void eeprom_write_check (const void *ptr, uint16_t ofs, uint8_t size)
 
static AP_Paramnext_group (uint16_t vindex, const struct GroupInfo *group_info, bool *found_current, uint32_t group_base, uint8_t group_shift, ptrdiff_t group_offset, ParamToken *token, enum ap_var_type *ptype)
 
static float get_default_value (const AP_Param *object_ptr, const float *def_value_ptr)
 
static bool parse_param_line (char *line, char **vname, float &value)
 
static bool count_embedded_param_defaults (uint16_t &count, bool panic_on_error)
 
static void load_embedded_param_defaults (bool panic_on_error)
 

Static Private Attributes

static const uint8_t _group_level_shift = 6
 
static const uint8_t _group_bits = 18
 
static const uint16_t _sentinal_key = 0x1FF
 
static const uint8_t _sentinal_type = 0x1F
 
static const uint8_t _sentinal_group = 0xFF
 
static uint16_t _frame_type_flags
 
static const param_defaults_struct param_defaults_data
 
static StorageAccess _storage
 
static uint16_t _num_vars
 
static uint16_t _parameter_count
 
static const struct Info_var_info
 
static struct param_overrideparam_overrides = nullptr
 
static uint16_t num_param_overrides = 0
 
static const uint8_t k_EEPROM_magic0 = 0x50
 
static const uint8_t k_EEPROM_magic1 = 0x41
 "AP" More...
 
static const uint8_t k_EEPROM_revision = 6
 current format revision More...
 
static bool _hide_disabled_groups = true
 

Detailed Description

Base class for variables.

Provides naming and lookup services for variables.

Definition at line 139 of file AP_Param.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
CONVERT_FLAG_REVERSE 
CONVERT_FLAG_FORCE 

Definition at line 363 of file AP_Param.h.

Constructor & Destructor Documentation

◆ AP_Param() [1/2]

AP_Param::AP_Param ( const struct Info info)
inline

Definition at line 182 of file AP_Param.h.

◆ AP_Param() [2/2]

AP_Param::AP_Param ( )
inline

Definition at line 191 of file AP_Param.h.

Member Function Documentation

◆ add_vector3f_suffix()

void AP_Param::add_vector3f_suffix ( char *  buffer,
size_t  buffer_size,
uint8_t  idx 
) const
private

add a _X, _Y, _Z suffix to the name of a Vector3f element

Parameters
buffer
buffer_size
idxSuffix: 0 –> _X; 1 –> _Y; 2 –> _Z; (other –> undefined)

Definition at line 698 of file AP_Param.cpp.

Referenced by copy_name_info().

Here is the caller graph for this function:

◆ adjust_group_offset()

bool AP_Param::adjust_group_offset ( uint16_t  vindex,
const struct GroupInfo group_info,
ptrdiff_t &  new_offset 
)
staticprivate

Definition at line 326 of file AP_Param.cpp.

Referenced by find_by_header_group(), find_group(), find_key_by_pointer_group(), find_var_info_group(), load_object_from_eeprom(), and next_group().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cast_to_float()

float AP_Param::cast_to_float ( enum ap_var_type  type) const

cast a variable to a float given its type

Definition at line 1587 of file AP_Param.cpp.

Referenced by convert_old_parameter(), GCS_MAVLINK::handle_param_set(), DataFlash_Backend::Log_Write_Parameter(), GCS_MAVLINK::queued_param_send(), save(), and send_parameter().

Here is the caller graph for this function:

◆ check_frame_type()

bool AP_Param::check_frame_type ( uint16_t  flags)
static

Definition at line 151 of file AP_Param.cpp.

Referenced by next(), next_group(), and set_frame_type_flags().

Here is the caller graph for this function:

◆ check_group_info()

bool AP_Param::check_group_info ( const struct GroupInfo group_info,
uint16_t *  total_size,
uint8_t  max_bits,
uint8_t  prefix_length 
)
staticprivate

Definition at line 161 of file AP_Param.cpp.

Referenced by check_var_info().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_var_info()

bool AP_Param::check_var_info ( void  )
static

Definition at line 250 of file AP_Param.cpp.

Here is the call graph for this function:

◆ configured()

bool AP_Param::configured ( void  ) const
inline

Definition at line 405 of file AP_Param.h.

Referenced by AP_ParamT< T, PT >::set_default().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ configured_in_defaults_file()

bool AP_Param::configured_in_defaults_file ( void  ) const

Definition at line 1169 of file AP_Param.cpp.

Referenced by configured().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ configured_in_storage()

bool AP_Param::configured_in_storage ( void  ) const

Definition at line 1139 of file AP_Param.cpp.

Referenced by configured(), convert_old_parameter(), load_embedded_param_defaults(), and parse_param_line().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_old_parameter()

void AP_Param::convert_old_parameter ( const struct ConversionInfo info,
float  scaler,
uint8_t  flags = 0 
)
static

Definition at line 1628 of file AP_Param.cpp.

Referenced by convert_old_parameters(), and AP_BattMonitor::convert_params().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_old_parameters()

void AP_Param::convert_old_parameters ( const struct ConversionInfo conversion_table,
uint8_t  table_size,
uint8_t  flags = 0 
)
static

Definition at line 1686 of file AP_Param.cpp.

Here is the call graph for this function:

◆ convert_parent_class()

void AP_Param::convert_parent_class ( uint8_t  param_key,
void *  object_pointer,
const struct AP_Param::GroupInfo group_info 
)
static

Definition at line 1700 of file AP_Param.cpp.

Here is the call graph for this function:

◆ copy_name_info()

void AP_Param::copy_name_info ( const struct AP_Param::Info info,
const struct GroupInfo ginfo,
const struct GroupNesting group_nesting,
uint8_t  idx,
char *  buffer,
size_t  bufferSize,
bool  force_scalar = false 
) const

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.

Note that if the combination of names is larger than the buffer, the result in the buffer will be truncated.

Parameters
tokentoken giving current variable
bufferThe destination buffer
bufferSizeTotal size of the destination buffer.

Definition at line 729 of file AP_Param.cpp.

Referenced by copy_name_token(), notify(), and save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ copy_name_token()

void AP_Param::copy_name_token ( const ParamToken token,
char *  buffer,
size_t  bufferSize,
bool  force_scalar = false 
) const

Copy the variable's name, prefixed by any containing group name, to a buffer.

Uses token to look up AP_Param::Info for the variable

Definition at line 714 of file AP_Param.cpp.

Referenced by DataFlash_Backend::Log_Write_Parameter(), GCS_MAVLINK::queued_param_send(), and set_and_save_by_name().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ count_embedded_param_defaults()

bool AP_Param::count_embedded_param_defaults ( uint16_t &  count,
bool  panic_on_error 
)
staticprivate

Definition at line 1918 of file AP_Param.cpp.

Referenced by load_embedded_param_defaults().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ count_parameters()

uint16_t AP_Param::count_parameters ( void  )
static

Definition at line 2090 of file AP_Param.cpp.

Referenced by configured(), GCS_MAVLINK::handle_param_request_list(), GCS_MAVLINK::param_io_timer(), and GCS::send_parameter_value().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ duplicate_key()

bool AP_Param::duplicate_key ( uint16_t  vindex,
uint16_t  key 
)
staticprivate

Definition at line 215 of file AP_Param.cpp.

Referenced by check_var_info().

Here is the caller graph for this function:

◆ eeprom_write_check()

void AP_Param::eeprom_write_check ( const void *  ptr,
uint16_t  ofs,
uint8_t  size 
)
staticprivate

Definition at line 90 of file AP_Param.cpp.

Referenced by erase_all(), save(), and write_sentinal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ erase_all()

void AP_Param::erase_all ( void  )
static

Erase all variables in EEPROM.

Definition at line 109 of file AP_Param.cpp.

Referenced by HALSITL::SITL_State::_parse_command_line(), GCS_MAVLINK::handle_command_long_message(), and setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find()

AP_Param * AP_Param::find ( const char *  name,
enum ap_var_type ptype 
)
static

Find a variable by name.

If the variable has no name, it cannot be found by this interface.

Parameters
nameThe full name of the variable to be found.
Returns
A pointer to the variable, or nullptr if it does not exist.

Definition at line 821 of file AP_Param.cpp.

Referenced by HALSITL::SITL_State::_set_param_default(), SITL::Aircraft::Aircraft(), AP_Proximity_SITL::AP_Proximity_SITL(), convert_old_parameter(), count_embedded_param_defaults(), GCS_MAVLINK::handle_param_set(), load_embedded_param_defaults(), GCS_MAVLINK::param_io_timer(), parse_param_line(), set_and_save_by_name(), set_by_name(), and set_default_by_name().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_by_header()

const struct AP_Param::Info * AP_Param::find_by_header ( struct Param_header  phdr,
void **  ptr 
)
staticprivate

Definition at line 417 of file AP_Param.cpp.

Referenced by load_all(), and load_object_from_eeprom().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_by_header_group()

const struct AP_Param::Info * AP_Param::find_by_header_group ( struct Param_header  phdr,
void **  ptr,
uint16_t  vindex,
const struct GroupInfo group_info,
uint32_t  group_base,
uint8_t  group_shift,
ptrdiff_t  group_offset 
)
staticprivate

Definition at line 366 of file AP_Param.cpp.

Referenced by find_by_header().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_by_index()

AP_Param * AP_Param::find_by_index ( uint16_t  idx,
enum ap_var_type ptype,
ParamToken token 
)
static

Find a variable by index.

Parameters
idxThe index of the variable
Returns
A pointer to the variable, or nullptr if it does not exist.

Definition at line 856 of file AP_Param.cpp.

Referenced by GCS_MAVLINK::param_io_timer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_group()

AP_Param * AP_Param::find_group ( const char *  name,
uint16_t  vindex,
ptrdiff_t  group_offset,
const struct GroupInfo group_info,
enum ap_var_type ptype 
)
staticprivate

Definition at line 757 of file AP_Param.cpp.

Referenced by find().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_key_by_pointer()

bool AP_Param::find_key_by_pointer ( const void *  ptr,
uint16_t &  key 
)
static

Definition at line 912 of file AP_Param.cpp.

Referenced by load_object_from_eeprom().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_key_by_pointer_group()

bool AP_Param::find_key_by_pointer_group ( const void *  ptr,
uint16_t  vindex,
const struct GroupInfo group_info,
ptrdiff_t  offset,
uint16_t &  key 
)
static

Find a variable by pointer

Parameters
pPointer to variable
Returns
key for variable

Definition at line 872 of file AP_Param.cpp.

Referenced by find_key_by_pointer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_object()

AP_Param * AP_Param::find_object ( const char *  name)
static

Find a object in the top level var_info table

If the variable has no name, it cannot be found by this interface.

Parameters
nameThe full name of the variable to be found.

Definition at line 939 of file AP_Param.cpp.

Referenced by HALSITL::SITL_State::_sitl_setup(), SITL::Aircraft::Aircraft(), AP_Baro_SITL::AP_Baro_SITL(), AP_Beacon_SITL::AP_Beacon_SITL(), AP_Compass_SITL::AP_Compass_SITL(), AP_OpticalFlow_SITL::AP_OpticalFlow_SITL(), AP_Proximity_SITL::AP_Proximity_SITL(), AP_RPM_SITL::AP_RPM_SITL(), AP_IRLock_SITL::init(), AP_InertialSensor_SITL::init_sensor(), SITL::Vicon::init_sitl_pointer(), SITL::ADSB::update(), and AP_AHRS_NavEKF::update_SITL().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_old_parameter()

bool AP_Param::find_old_parameter ( const struct ConversionInfo info,
AP_Param value 
)
static

Definition at line 1606 of file AP_Param.cpp.

Referenced by convert_old_parameter(), convert_parent_class(), SRV_Channels::upgrade_motors_servo(), and SRV_Channels::upgrade_parameters().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_var_info()

const struct AP_Param::Info * AP_Param::find_var_info ( uint32_t *  group_element,
const struct GroupInfo *&  group_ret,
struct GroupNesting group_nesting,
uint8_t *  idx 
) const
private

Definition at line 519 of file AP_Param.cpp.

Referenced by configured_in_defaults_file(), configured_in_storage(), load(), notify(), and save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_var_info_group()

const struct AP_Param::Info * AP_Param::find_var_info_group ( const struct GroupInfo group_info,
uint16_t  vindex,
uint32_t  group_base,
uint8_t  group_shift,
ptrdiff_t  group_offset,
uint32_t *  group_element,
const struct GroupInfo *&  group_ret,
struct GroupNesting group_nesting,
uint8_t *  idx 
) const
private

Definition at line 448 of file AP_Param.cpp.

Referenced by find_var_info(), and find_var_info_token().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_var_info_token()

const struct AP_Param::Info * AP_Param::find_var_info_token ( const ParamToken token,
uint32_t *  group_element,
const struct GroupInfo *&  group_ret,
struct GroupNesting group_nesting,
uint8_t *  idx 
) const
private

Definition at line 561 of file AP_Param.cpp.

Referenced by copy_name_token(), and next_scalar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ first()

AP_Param * AP_Param::first ( ParamToken token,
enum ap_var_type ptype 
)
static

Returns the first variable

Returns
The first variable in _var_info, or nullptr if there are none.

Definition at line 1387 of file AP_Param.cpp.

Referenced by count_parameters(), find_by_index(), GCS_MAVLINK::handle_param_request_list(), DFMessageWriter_DFLogStart::reset(), and set_and_save_by_name().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_base()

bool AP_Param::get_base ( const struct Info info,
ptrdiff_t &  base 
)
staticprivate

Definition at line 353 of file AP_Param.cpp.

Referenced by adjust_group_offset(), find(), find_by_header(), find_by_header_group(), find_group(), find_key_by_pointer_group(), find_object(), find_var_info(), find_var_info_group(), find_var_info_token(), first(), load(), next_group(), and setup_sketch_defaults().

Here is the caller graph for this function:

◆ get_default_value()

float AP_Param::get_default_value ( const AP_Param object_ptr,
const float *  def_value_ptr 
)
staticprivate

Definition at line 2041 of file AP_Param.cpp.

Referenced by load(), save(), setup_object_defaults(), and setup_sketch_defaults().

Here is the caller graph for this function:

◆ get_group_info() [1/2]

const struct AP_Param::GroupInfo * AP_Param::get_group_info ( const struct GroupInfo ginfo)
staticprivate

get group_info pointer based on flags

Definition at line 230 of file AP_Param.cpp.

Referenced by check_group_info(), check_var_info(), find(), find_by_header(), find_by_header_group(), find_group(), find_key_by_pointer(), find_key_by_pointer_group(), find_var_info(), find_var_info_group(), find_var_info_token(), load_object_from_eeprom(), next(), and next_group().

Here is the caller graph for this function:

◆ get_group_info() [2/2]

const struct AP_Param::GroupInfo * AP_Param::get_group_info ( const struct Info ginfo)
staticprivate

get group_info pointer based on flags

Definition at line 241 of file AP_Param.cpp.

◆ get_key()

uint16_t AP_Param::get_key ( const Param_header phdr)
staticprivate

Definition at line 626 of file AP_Param.cpp.

Referenced by find_by_header(), is_sentinal(), load_object_from_eeprom(), and scan().

Here is the caller graph for this function:

◆ group_id()

uint32_t AP_Param::group_id ( const struct GroupInfo grpinfo,
uint32_t  base,
uint8_t  i,
uint8_t  shift 
)
static

Definition at line 131 of file AP_Param.cpp.

Referenced by find_by_header_group(), find_var_info_group(), and next_group().

Here is the caller graph for this function:

◆ initialised()

bool AP_Param::initialised ( void  )
static

Definition at line 315 of file AP_Param.cpp.

◆ is_sentinal()

bool AP_Param::is_sentinal ( const Param_header phrd)
staticprivate

Definition at line 643 of file AP_Param.cpp.

Referenced by load_all(), load_object_from_eeprom(), and scan().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load()

bool AP_Param::load ( void  )

Load the variable from EEPROM.

Returns
True if the variable was loaded successfully.

Definition at line 1076 of file AP_Param.cpp.

Here is the call graph for this function:

◆ load_all()

bool AP_Param::load_all ( bool  check_defaults_file = true)
static

Load all variables from EEPROM

This function performs a best-efforts attempt to load all of the variables from EEPROM. If some fail to load, their values will remain as they are.

Returns
False if any variable failed to load

Definition at line 1272 of file AP_Param.cpp.

Here is the call graph for this function:

◆ load_embedded_param_defaults()

void AP_Param::load_embedded_param_defaults ( bool  panic_on_error)
staticprivate

Definition at line 1972 of file AP_Param.cpp.

Referenced by reload_defaults_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_object_from_eeprom()

void AP_Param::load_object_from_eeprom ( const void *  object_pointer,
const struct GroupInfo group_info 
)
static

Definition at line 1335 of file AP_Param.cpp.

Referenced by RangeFinder::detect_instance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ next()

AP_Param * AP_Param::next ( ParamToken token,
enum ap_var_type ptype 
)
static

Returns the next variable in _var_info, recursing into groups as needed

Definition at line 1481 of file AP_Param.cpp.

Referenced by next_scalar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ next_group()

AP_Param * AP_Param::next_group ( uint16_t  vindex,
const struct GroupInfo group_info,
bool *  found_current,
uint32_t  group_base,
uint8_t  group_shift,
ptrdiff_t  group_offset,
ParamToken token,
enum ap_var_type ptype 
)
staticprivate

Returns the next variable in a group, recursing into groups as needed

Definition at line 1408 of file AP_Param.cpp.

Referenced by next().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ next_scalar()

AP_Param * AP_Param::next_scalar ( ParamToken token,
enum ap_var_type ptype 
)
static

Returns the next scalar variable in _var_info, recursing into groups as needed

Returns the next scalar in _var_info, recursing into groups as needed

Definition at line 1535 of file AP_Param.cpp.

Referenced by count_parameters(), find_by_index(), DFMessageWriter_DFLogStart::process(), GCS_MAVLINK::queued_param_send(), and set_and_save_by_name().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ notify()

void AP_Param::notify ( ) const

Notify GCS of current parameter value

Definition at line 954 of file AP_Param.cpp.

Referenced by AP_ParamT< T, PT >::set_and_notify(), and AP_ParamV< T, PT >::set_and_notify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_param_line()

bool AP_Param::parse_param_line ( char *  line,
char **  vname,
float &  value 
)
staticprivate

Definition at line 1762 of file AP_Param.cpp.

Referenced by count_embedded_param_defaults(), and load_embedded_param_defaults().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reload_defaults_file()

void AP_Param::reload_defaults_file ( bool  panic_on_error = true)
static

reoad the hal.util defaults file. Called after pointer parameters have been allocated

Definition at line 1307 of file AP_Param.cpp.

Referenced by load_all().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save()

bool AP_Param::save ( bool  force_save = false)

Save the current value of the variable to EEPROM.

Parameters
force_saveIf true then force save even if default
Returns
True if the variable was saved successfully.

Definition at line 982 of file AP_Param.cpp.

Referenced by convert_old_parameter(), GCS_MAVLINK::handle_param_set(), AP_ParamT< T, PT >::set_and_save(), AP_ParamV< T, PT >::set_and_save(), and AP_ParamT< T, PT >::set_and_save_ifchanged().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scan()

bool AP_Param::scan ( const struct Param_header phdr,
uint16_t *  pofs 
)
staticprivate

Definition at line 667 of file AP_Param.cpp.

Referenced by configured_in_storage(), find_old_parameter(), load(), and save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_parameter()

void AP_Param::send_parameter ( const char *  name,
enum ap_var_type  param_header_type,
uint8_t  idx 
) const
private

Definition at line 2052 of file AP_Param.cpp.

Referenced by notify(), and save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_and_save_by_name()

bool AP_Param::set_and_save_by_name ( const char *  name,
float  value 
)
static

set and save a value by name

Parameters
nameThe full name of the variable to be found.
valueThe new value
Returns
true if the variable is found

Definition at line 2171 of file AP_Param.cpp.

Here is the call graph for this function:

◆ set_by_name()

bool AP_Param::set_by_name ( const char *  name,
float  value 
)
static

set a value by name

Parameters
nameThe full name of the variable to be found.
valueThe new value
Returns
true if the variable is found

Definition at line 2141 of file AP_Param.cpp.

Here is the call graph for this function:

◆ set_default_by_name()

bool AP_Param::set_default_by_name ( const char *  name,
float  value 
)
static

set a default value by name

Parameters
nameThe full name of the variable to be found.
valueThe default value
Returns
true if the variable is found

Definition at line 2111 of file AP_Param.cpp.

Referenced by SITL::FlightAxis::FlightAxis(), AP_BoardConfig::px4_setup_pwm(), and SITL::XPlane::XPlane().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_float()

void AP_Param::set_float ( float  value,
enum ap_var_type  var_type 
)

Definition at line 1726 of file AP_Param.cpp.

Referenced by GCS_MAVLINK::handle_param_set(), load_embedded_param_defaults(), and parse_param_line().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_frame_type_flags()

static void AP_Param::set_frame_type_flags ( uint16_t  flags_to_set)
inlinestatic

Definition at line 413 of file AP_Param.h.

Here is the call graph for this function:

◆ set_hide_disabled_groups()

static void AP_Param::set_hide_disabled_groups ( bool  value)
inlinestatic

Definition at line 410 of file AP_Param.h.

Referenced by HALSITL::SITL_State::_parse_command_line().

Here is the caller graph for this function:

◆ set_key()

void AP_Param::set_key ( Param_header phdr,
uint16_t  key 
)
staticprivate

Definition at line 634 of file AP_Param.cpp.

Referenced by configured_in_storage(), find_old_parameter(), load(), save(), and write_sentinal().

Here is the caller graph for this function:

◆ set_object_value()

bool AP_Param::set_object_value ( const void *  object_pointer,
const struct GroupInfo group_info,
const char *  name,
float  value 
)
static

Definition at line 1231 of file AP_Param.cpp.

Referenced by set_object_value_and_report(), and setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_value()

void AP_Param::set_value ( enum ap_var_type  type,
void *  ptr,
float  def_value 
)
static

Definition at line 1191 of file AP_Param.cpp.

Referenced by convert_old_parameter(), load(), set_object_value(), setup_object_defaults(), and setup_sketch_defaults().

Here is the caller graph for this function:

◆ setup()

bool AP_Param::setup ( void  )
static

Definition at line 296 of file AP_Param.cpp.

Referenced by setup_sketch_defaults().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_object_defaults()

void AP_Param::setup_object_defaults ( const void *  object_pointer,
const struct GroupInfo group_info 
)
static

Definition at line 1214 of file AP_Param.cpp.

Referenced by AC_AttitudeControl::AC_AttitudeControl(), AC_AttitudeControl_Heli::AC_AttitudeControl_Heli(), AC_AttitudeControl_Multi::AC_AttitudeControl_Multi(), AC_AttitudeControl_Sub::AC_AttitudeControl_Sub(), AC_Avoid::AC_Avoid(), AC_Circle::AC_Circle(), AC_Fence::AC_Fence(), AC_InputManager::AC_InputManager(), AC_InputManager_Heli::AC_InputManager_Heli(), AC_Loiter::AC_Loiter(), AC_P::AC_P(), AC_PI_2D::AC_PI_2D(), AC_PID::AC_PID(), AC_PID_2D::AC_PID_2D(), AC_PosControl::AC_PosControl(), AC_PrecLand::AC_PrecLand(), AC_Sprayer::AC_Sprayer(), AC_WPNav::AC_WPNav(), AP_ADSB::AP_ADSB(), AP_AdvancedFailsafe::AP_AdvancedFailsafe(), AP_AHRS::AP_AHRS(), AP_Airspeed::AP_Airspeed(), AP_Arming::AP_Arming(), AP_Avoidance::AP_Avoidance(), AP_Baro::AP_Baro(), AP_BattMonitor::AP_BattMonitor(), AP_BattMonitor_Params::AP_BattMonitor_Params(), AP_Beacon::AP_Beacon(), AP_BoardConfig::AP_BoardConfig(), AP_Button::AP_Button(), AP_Camera::AP_Camera(), AP_Follow::AP_Follow(), AP_GPS::AP_GPS(), AP_Gripper::AP_Gripper(), AP_ICEngine::AP_ICEngine(), AP_InertialSensor::AP_InertialSensor(), AP_L1_Control::AP_L1_Control(), AP_Landing::AP_Landing(), AP_Landing_Deepstall::AP_Landing_Deepstall(), AP_LandingGear::AP_LandingGear(), AP_LeakDetector::AP_LeakDetector(), AP_Mission::AP_Mission(), AP_Motors6DOF::AP_Motors6DOF(), AP_MotorsHeli::AP_MotorsHeli(), AP_MotorsHeli_Dual::AP_MotorsHeli_Dual(), AP_MotorsHeli_Quad::AP_MotorsHeli_Quad(), AP_MotorsHeli_Single::AP_MotorsHeli_Single(), AP_MotorsMulticopter::AP_MotorsMulticopter(), AP_Mount::AP_Mount(), AP_Notify::AP_Notify(), AP_Parachute::AP_Parachute(), AP_PitchController::AP_PitchController(), AP_Proximity::AP_Proximity(), AP_Rally::AP_Rally(), AP_RangeFinder_Wasp::AP_RangeFinder_Wasp(), AP_Relay::AP_Relay(), AP_RollController::AP_RollController(), AP_RPM::AP_RPM(), AP_RSSI::AP_RSSI(), AP_SBusOut::AP_SBusOut(), AP_Scheduler::AP_Scheduler(), AP_SerialManager::AP_SerialManager(), AP_SmartRTL::AP_SmartRTL(), AP_SteerController::AP_SteerController(), AP_TECS::AP_TECS(), AP_Tuning::AP_Tuning(), AP_VisualOdom::AP_VisualOdom(), AP_Volz_Protocol::AP_Volz_Protocol(), AP_WheelEncoder::AP_WheelEncoder(), AP_Winch::AP_Winch(), AP_YawController::AP_YawController(), AR_AttitudeControl::AR_AttitudeControl(), AP_InertialSensor::BatchSampler::BatchSampler(), Compass::Compass(), Compass_PerMotor::Compass_PerMotor(), DataFlash_Class::DataFlash_Class(), GCS_MAVLINK::GCS_MAVLINK(), JSButton::JSButton(), NavEKF2::NavEKF2(), NavEKF3::NavEKF3(), NotchFilterVector3fParam::NotchFilterVector3fParam(), OpticalFlow::OpticalFlow(), PID::PID(), RangeFinder::RangeFinder(), RC_Channel::RC_Channel(), RC_Channels::RC_Channels(), RCMapper::RCMapper(), SITL::SITL::SITL(), SoaringController::SoaringController(), SoloGimbalEKF::SoloGimbalEKF(), SRV_Channel::SRV_Channel(), and SRV_Channels::SRV_Channels().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_sketch_defaults()

void AP_Param::setup_sketch_defaults ( void  )
static

Definition at line 1254 of file AP_Param.cpp.

Here is the call graph for this function:

◆ type_size()

uint8_t AP_Param::type_size ( enum ap_var_type  type)
staticprivate

Definition at line 602 of file AP_Param.cpp.

Referenced by check_group_info(), check_var_info(), convert_old_parameter(), convert_parent_class(), find_old_parameter(), load(), load_all(), load_object_from_eeprom(), save(), and scan().

Here is the caller graph for this function:

◆ write_sentinal()

void AP_Param::write_sentinal ( uint16_t  ofs)
staticprivate

Definition at line 98 of file AP_Param.cpp.

Referenced by erase_all(), and save().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _frame_type_flags

uint16_t AP_Param::_frame_type_flags
staticprivate

Definition at line 477 of file AP_Param.h.

Referenced by check_frame_type(), and set_frame_type_flags().

◆ _group_bits

const uint8_t AP_Param::_group_bits = 18
staticprivate

Definition at line 471 of file AP_Param.h.

Referenced by check_group_info(), find_by_header_group(), and find_var_info_group().

◆ _group_level_shift

const uint8_t AP_Param::_group_level_shift = 6
staticprivate

◆ _hide_disabled_groups

bool AP_Param::_hide_disabled_groups = true
staticprivate

Definition at line 610 of file AP_Param.h.

Referenced by eeprom_write_check(), next_scalar(), and set_hide_disabled_groups().

◆ _num_vars

uint16_t AP_Param::_num_vars
staticprivate

◆ _parameter_count

uint16_t AP_Param::_parameter_count
staticprivate

Definition at line 592 of file AP_Param.h.

Referenced by count_parameters(), load_object_from_eeprom(), and save().

◆ _sentinal_group

const uint8_t AP_Param::_sentinal_group = 0xFF
staticprivate

Definition at line 475 of file AP_Param.h.

Referenced by is_sentinal(), and write_sentinal().

◆ _sentinal_key

const uint16_t AP_Param::_sentinal_key = 0x1FF
staticprivate

Definition at line 473 of file AP_Param.h.

Referenced by is_sentinal(), and write_sentinal().

◆ _sentinal_type

const uint8_t AP_Param::_sentinal_type = 0x1F
staticprivate

Definition at line 474 of file AP_Param.h.

Referenced by is_sentinal(), and write_sentinal().

◆ _storage

StorageAccess AP_Param::_storage
staticprivate

◆ _var_info

const AP_Param::Info * AP_Param::_var_info
staticprivate

◆ k_EEPROM_magic0

const uint8_t AP_Param::k_EEPROM_magic0 = 0x50
staticprivate

Definition at line 606 of file AP_Param.h.

Referenced by erase_all(), and setup().

◆ k_EEPROM_magic1

const uint8_t AP_Param::k_EEPROM_magic1 = 0x41
staticprivate

"AP"

Definition at line 607 of file AP_Param.h.

Referenced by erase_all(), and setup().

◆ k_EEPROM_revision

const uint8_t AP_Param::k_EEPROM_revision = 6
staticprivate

current format revision

Definition at line 608 of file AP_Param.h.

Referenced by erase_all(), and setup().

◆ num_param_overrides

uint16_t AP_Param::num_param_overrides = 0
staticprivate

◆ param_defaults_data

const AP_Param::param_defaults_struct AP_Param::param_defaults_data
staticprivate
Initial value:
= {
"PARMDEF",
{ 0x55, 0x37, 0xf4, 0xa0, 0x38, 0x5d, 0x48, 0x5b },
0
}

Definition at line 489 of file AP_Param.h.

Referenced by count_embedded_param_defaults(), load_embedded_param_defaults(), and reload_defaults_file().

◆ param_overrides

struct AP_Param::param_override * AP_Param::param_overrides = nullptr
staticprivate

The documentation for this class was generated from the following files: