@@ -810,10 +810,10 @@ void Af::prepare(Metadata *imageMetadata)
else
status.pauseState = AfPauseState::Running;
- if (scanState_ == ScanState::Idle)
- status.state = AfState::Idle;
- else if (mode_ == AfModeAuto)
+ if (mode_ == AfModeAuto && scanState_ != ScanState::Idle)
status.state = AfState::Scanning;
+ else if (mode_ == AfModeManual)
+ status.state = AfState::Idle;
else
status.state = reportState_;
status.lensSetting = initted_ ? std::optional<int>(cfg_.map.eval(fsmooth_))
@@ -954,8 +954,10 @@ void Af::pause(AfAlgorithm::AfPause pause)
scanState_ = ScanState::Trigger;
} else if (pause != AfPauseResume && !pauseFlag_) {
pauseFlag_ = true;
- if (pause == AfPauseImmediate || scanState_ < ScanState::Coarse1)
- goIdle();
+ if (pause == AfPauseImmediate || scanState_ < ScanState::Coarse1) {
+ scanState_ = ScanState::Idle;
+ scanData_.clear();
+ }
}
}
}
A previous change introduced a bug in which it reported AfStateIdle when idle in Auto mode, when it should continue to report the most recent AF cycle's outcome (AfStateFocused or AfStateFailed). Also fix the Pause method so it won't reset state to AfStateIdle when paused in Continuous AF mode (to match documented behaviour). Fixes: ea5f451c5660 ("ipa: rpi: controller: AutoFocus bidirectional scanning") Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Tested-by: David Plowman <david.plowman@raspberrypi.com> --- src/ipa/rpi/controller/rpi/af.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)