Skip to content

Commit 044ceaa

Browse files
njhollinghurstdavidplowman
authored andcommitted
ipa: rpi: Fix bug in AfState reporting
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). Signed-off-by: Nick Hollinghurst <[email protected]>
1 parent 3a7e9d3 commit 044ceaa

File tree

1 file changed

+7
-5
lines changed
  • src/ipa/rpi/controller/rpi

1 file changed

+7
-5
lines changed

src/ipa/rpi/controller/rpi/af.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -810,10 +810,10 @@ void Af::prepare(Metadata *imageMetadata)
810810
else
811811
status.pauseState = AfPauseState::Running;
812812

813-
if (scanState_ == ScanState::Idle)
814-
status.state = AfState::Idle;
815-
else if (mode_ == AfModeAuto)
813+
if (mode_ == AfModeAuto && scanState_ != ScanState::Idle)
816814
status.state = AfState::Scanning;
815+
else if (mode_ == AfModeManual)
816+
status.state = AfState::Idle;
817817
else
818818
status.state = reportState_;
819819
status.lensSetting = initted_ ? std::optional<int>(cfg_.map.eval(fsmooth_))
@@ -954,8 +954,10 @@ void Af::pause(AfAlgorithm::AfPause pause)
954954
scanState_ = ScanState::Trigger;
955955
} else if (pause != AfPauseResume && !pauseFlag_) {
956956
pauseFlag_ = true;
957-
if (pause == AfPauseImmediate || scanState_ < ScanState::Coarse1)
958-
goIdle();
957+
if (pause == AfPauseImmediate || scanState_ < ScanState::Coarse1) {
958+
scanState_ = ScanState::Idle;
959+
scanData_.clear();
960+
}
959961
}
960962
}
961963
}

0 commit comments

Comments
 (0)