Skip to content

Commit

Permalink
remove array parameter from 'cv_to_pv_type'
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrauch committed Aug 5, 2024
1 parent 6d3965c commit bf1fa07
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/CameraNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ CameraNode::declareParameters()
RCLCPP_DEBUG_STREAM(get_logger(),
"declare " << id->name() << " with default " << rclcpp::to_string(value));
if (value.get_type() == rclcpp::ParameterType::PARAMETER_NOT_SET) {
declare_parameter(id->name(), cv_to_pv_type(id->type(), extent > 0), param_descr);
declare_parameter(id->name(), cv_to_pv_type(id), param_descr);
}
else {
declare_parameter(id->name(), value, param_descr);
Expand Down
9 changes: 5 additions & 4 deletions src/cv_to_pv.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "cv_to_pv.hpp"
#include "type_extent.hpp"
#include "types.hpp"
#include <cstdint>
#include <libcamera/base/span.h>
Expand Down Expand Up @@ -109,10 +110,10 @@ cv_to_pv(const libcamera::ControlValue &value)
}

rclcpp::ParameterType
cv_to_pv_type(const libcamera::ControlType &type, const bool is_array)
cv_to_pv_type(const libcamera::ControlId *const id)
{
if (!is_array) {
switch (type) {
if (get_extent(id) == 0) {
switch (id->type()) {
case libcamera::ControlType::ControlTypeNone:
return rclcpp::ParameterType::PARAMETER_NOT_SET;
case libcamera::ControlType::ControlTypeBool:
Expand All @@ -132,7 +133,7 @@ cv_to_pv_type(const libcamera::ControlType &type, const bool is_array)
}
}
else {
switch (type) {
switch (id->type()) {
case libcamera::ControlType::ControlTypeNone:
return rclcpp::ParameterType::PARAMETER_NOT_SET;
case libcamera::ControlType::ControlTypeBool:
Expand Down
2 changes: 1 addition & 1 deletion src/cv_to_pv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ rclcpp::ParameterValue
cv_to_pv(const libcamera::ControlValue &value);

rclcpp::ParameterType
cv_to_pv_type(const libcamera::ControlType &type, const bool is_array);
cv_to_pv_type(const libcamera::ControlId *const id);

0 comments on commit bf1fa07

Please sign in to comment.