mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-15 10:30:35 +08:00
blockparam: added support for external parameter copy
This commit is contained in:
@@ -82,9 +82,10 @@ BlockParamBase::BlockParamBase(Block *parent, const char *name, bool parent_pref
|
||||
|
||||
template <class T>
|
||||
BlockParam<T>::BlockParam(Block *block, const char *name,
|
||||
bool parent_prefix) :
|
||||
bool parent_prefix, T *extern_address) :
|
||||
BlockParamBase(block, name, parent_prefix),
|
||||
_val()
|
||||
_val(),
|
||||
_extern_address(extern_address)
|
||||
{
|
||||
update();
|
||||
}
|
||||
@@ -93,12 +94,25 @@ template <class T>
|
||||
T BlockParam<T>::get() { return _val; }
|
||||
|
||||
template <class T>
|
||||
void BlockParam<T>::set(T val) { _val = val; }
|
||||
void BlockParam<T>::set(T val)
|
||||
{
|
||||
_val = val;
|
||||
|
||||
if (_extern_address != NULL) {
|
||||
*_extern_address = val;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void BlockParam<T>::update()
|
||||
{
|
||||
if (_handle != PARAM_INVALID) { param_get(_handle, &_val); }
|
||||
if (_handle != PARAM_INVALID) {
|
||||
param_get(_handle, &_val);
|
||||
|
||||
if (_extern_address != NULL) {
|
||||
*_extern_address = _val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
||||
Reference in New Issue
Block a user