ipa: rpi: controller: Replace Pwl::readYaml() with YamlObject::get()

Now that deserializing a Pwl object from YAML data is possible using the
YamlObject::get() function, replace all usage of Pwl::readYaml() to
prepare for its removal.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> # On Raspberry Pi 4
This commit is contained in:
Laurent Pinchart 2024-06-13 03:45:32 +03:00
parent 13a8fbeb5c
commit b781955c6a
8 changed files with 20 additions and 16 deletions

View file

@ -130,7 +130,8 @@ int AgcConstraint::read(const libcamera::YamlObject &params)
return -EINVAL;
qHi = *value;
return yTarget.readYaml(params["y_target"]);
yTarget = params["y_target"].get<ipa::Pwl>(ipa::Pwl{});
return yTarget.empty() ? -EINVAL : 0;
}
static std::tuple<int, AgcConstraintMode>
@ -237,9 +238,9 @@ int AgcConfig::read(const libcamera::YamlObject &params)
return ret;
}
ret = yTarget.readYaml(params["y_target"]);
if (ret)
return ret;
yTarget = params["y_target"].get<ipa::Pwl>(ipa::Pwl{});
if (yTarget.empty())
return -EINVAL;
speed = params["speed"].get<double>(0.2);
startupFrames = params["startup_frames"].get<uint16_t>(10);