mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-06 02:50:34 +08:00
Control lib update.
This commit is contained in:
@@ -65,6 +65,7 @@ BlockParamBase::BlockParamBase(Block *parent, const char *name, bool parent_pref
|
||||
|
||||
} else if (parent_prefix) {
|
||||
snprintf(fullname, blockNameLengthMax, "%s_%s", parentName, name);
|
||||
|
||||
} else {
|
||||
strncpy(fullname, name, blockNameLengthMax);
|
||||
}
|
||||
@@ -74,15 +75,17 @@ BlockParamBase::BlockParamBase(Block *parent, const char *name, bool parent_pref
|
||||
|
||||
_handle = param_find(fullname);
|
||||
|
||||
if (_handle == PARAM_INVALID)
|
||||
if (_handle == PARAM_INVALID) {
|
||||
printf("error finding param: %s\n", fullname);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
BlockParam<T>::BlockParam(Block *block, const char *name,
|
||||
bool parent_prefix) :
|
||||
bool parent_prefix) :
|
||||
BlockParamBase(block, name, parent_prefix),
|
||||
_val() {
|
||||
_val()
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -93,13 +96,15 @@ template <class T>
|
||||
void BlockParam<T>::set(T val) { _val = val; }
|
||||
|
||||
template <class T>
|
||||
void BlockParam<T>::update() {
|
||||
if (_handle != PARAM_INVALID) param_get(_handle, &_val);
|
||||
void BlockParam<T>::update()
|
||||
{
|
||||
if (_handle != PARAM_INVALID) { param_get(_handle, &_val); }
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void BlockParam<T>::commit() {
|
||||
if (_handle != PARAM_INVALID) param_set(_handle, &_val);
|
||||
void BlockParam<T>::commit()
|
||||
{
|
||||
if (_handle != PARAM_INVALID) { param_set(_handle, &_val); }
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
||||
Reference in New Issue
Block a user