summaryrefslogtreecommitdiff
path: root/src/ipa/rpi/controller/rpi/agc.cpp
diff options
context:
space:
mode:
authorDavid Plowman <david.plowman@raspberrypi.com>2023-10-18 15:05:54 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2023-10-24 14:11:33 +0100
commit02eea043f2a4d976c2c40e5bc382096c3a536632 (patch)
tree077095349fcb1d29ac8de1eae6e591a7ecd45937 /src/ipa/rpi/controller/rpi/agc.cpp
parent78a2d00c79b22445b5ad0f57dda3947d9bcd005b (diff)
ipa: rpi: agc: Make AGC controls affect all channels
We need to be able to do things like enable/disable AGC for all the channels, so most of the AGC controls are updated to be applied to all channels. There are a couple of exceptions, such as setting explicit shutter/gain values, which apply only to channel 0. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/ipa/rpi/controller/rpi/agc.cpp')
-rw-r--r--src/ipa/rpi/controller/rpi/agc.cpp51
1 files changed, 25 insertions, 26 deletions
diff --git a/src/ipa/rpi/controller/rpi/agc.cpp b/src/ipa/rpi/controller/rpi/agc.cpp
index 32eb3624..6549dedd 100644
--- a/src/ipa/rpi/controller/rpi/agc.cpp
+++ b/src/ipa/rpi/controller/rpi/agc.cpp
@@ -74,22 +74,22 @@ int Agc::checkChannel(unsigned int channelIndex) const
return 0;
}
-void Agc::disableAuto(unsigned int channelIndex)
+void Agc::disableAuto()
{
- if (checkChannel(channelIndex))
- return;
+ LOG(RPiAgc, Debug) << "disableAuto";
- LOG(RPiAgc, Debug) << "disableAuto for channel " << channelIndex;
- channelData_[channelIndex].channel.disableAuto();
+ /* All channels are enabled/disabled together. */
+ for (auto &data : channelData_)
+ data.channel.disableAuto();
}
-void Agc::enableAuto(unsigned int channelIndex)
+void Agc::enableAuto()
{
- if (checkChannel(channelIndex))
- return;
+ LOG(RPiAgc, Debug) << "enableAuto";
- LOG(RPiAgc, Debug) << "enableAuto for channel " << channelIndex;
- channelData_[channelIndex].channel.enableAuto();
+ /* All channels are enabled/disabled together. */
+ for (auto &data : channelData_)
+ data.channel.enableAuto();
}
unsigned int Agc::getConvergenceFrames() const
@@ -118,14 +118,13 @@ void Agc::setEv(unsigned int channelIndex, double ev)
channelData_[channelIndex].channel.setEv(ev);
}
-void Agc::setFlickerPeriod(unsigned int channelIndex, Duration flickerPeriod)
+void Agc::setFlickerPeriod(Duration flickerPeriod)
{
- if (checkChannel(channelIndex))
- return;
+ LOG(RPiAgc, Debug) << "setFlickerPeriod " << flickerPeriod;
- LOG(RPiAgc, Debug) << "setFlickerPeriod " << flickerPeriod
- << " for channel " << channelIndex;
- channelData_[channelIndex].channel.setFlickerPeriod(flickerPeriod);
+ /* Flicker period will be the same across all channels. */
+ for (auto &data : channelData_)
+ data.channel.setFlickerPeriod(flickerPeriod);
}
void Agc::setMaxShutter(Duration maxShutter)
@@ -162,22 +161,22 @@ void Agc::setMeteringMode(std::string const &meteringModeName)
data.channel.setMeteringMode(meteringModeName);
}
-void Agc::setExposureMode(unsigned int channelIndex, std::string const &exposureModeName)
+void Agc::setExposureMode(std::string const &exposureModeName)
{
- if (checkChannel(channelIndex))
- return;
+ LOG(RPiAgc, Debug) << "setExposureMode " << exposureModeName;
- LOG(RPiAgc, Debug) << "setExposureMode " << exposureModeName
- << " for channel " << channelIndex;
- channelData_[channelIndex].channel.setExposureMode(exposureModeName);
+ /* Exposure mode will be the same across all channels. */
+ for (auto &data : channelData_)
+ data.channel.setExposureMode(exposureModeName);
}
-void Agc::setConstraintMode(unsigned int channelIndex, std::string const &constraintModeName)
+void Agc::setConstraintMode(std::string const &constraintModeName)
{
- if (checkChannel(channelIndex))
- return;
+ LOG(RPiAgc, Debug) << "setConstraintMode " << constraintModeName;
- channelData_[channelIndex].channel.setConstraintMode(constraintModeName);
+ /* Constraint mode will be the same across all channels. */
+ for (auto &data : channelData_)
+ data.channel.setConstraintMode(constraintModeName);
}
template<typename T>