|
@@ -415,12 +415,16 @@ int CCamera::SetLEDIntensity(int _intrel)
|
|
|
|
|
|
|
|
bool CCamera::getCameraInitSuccessful(void)
|
|
bool CCamera::getCameraInitSuccessful(void)
|
|
|
{
|
|
{
|
|
|
|
|
+ ScopedCameraOperationLock operationLock(m_cameraOperationMutex);
|
|
|
|
|
+ if (!operationLock.acquired()) return false;
|
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
|
return cameraLock.acquired() && CCstatus.CameraInitSuccessful;
|
|
return cameraLock.acquired() && CCstatus.CameraInitSuccessful;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
esp_err_t CCamera::setSensorDatenFromCCstatus(void)
|
|
esp_err_t CCamera::setSensorDatenFromCCstatus(void)
|
|
|
{
|
|
{
|
|
|
|
|
+ ScopedCameraOperationLock operationLock(m_cameraOperationMutex);
|
|
|
|
|
+ if (!operationLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
|
if (!cameraLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
if (!cameraLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
|
const esp_err_t result = ApplySettings(CCstatus);
|
|
const esp_err_t result = ApplySettings(CCstatus);
|
|
@@ -435,6 +439,8 @@ esp_err_t CCamera::setSensorDatenFromCCstatus(void)
|
|
|
|
|
|
|
|
esp_err_t CCamera::ApplySettings(CameraSettings &settings)
|
|
esp_err_t CCamera::ApplySettings(CameraSettings &settings)
|
|
|
{
|
|
{
|
|
|
|
|
+ ScopedCameraOperationLock operationLock(m_cameraOperationMutex);
|
|
|
|
|
+ if (!operationLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
|
if (!cameraLock.acquired())
|
|
if (!cameraLock.acquired())
|
|
|
{
|
|
{
|
|
@@ -509,6 +515,8 @@ esp_err_t CCamera::ApplySettings(CameraSettings &settings)
|
|
|
|
|
|
|
|
esp_err_t CCamera::ApplyPreviewSettings(const CameraSettings &settings)
|
|
esp_err_t CCamera::ApplyPreviewSettings(const CameraSettings &settings)
|
|
|
{
|
|
{
|
|
|
|
|
+ ScopedCameraOperationLock operationLock(m_cameraOperationMutex);
|
|
|
|
|
+ if (!operationLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
|
if (!cameraLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
if (!cameraLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
|
CameraSettings previewSettings = settings;
|
|
CameraSettings previewSettings = settings;
|
|
@@ -532,6 +540,8 @@ esp_err_t CCamera::ApplyPreviewSettings(const CameraSettings &settings)
|
|
|
|
|
|
|
|
esp_err_t CCamera::RestoreCommittedSettingsIfNeeded(void)
|
|
esp_err_t CCamera::RestoreCommittedSettingsIfNeeded(void)
|
|
|
{
|
|
{
|
|
|
|
|
+ ScopedCameraOperationLock operationLock(m_cameraOperationMutex);
|
|
|
|
|
+ if (!operationLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
|
if (!cameraLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
if (!cameraLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
|
if (!m_temporarySettingsActive) return ESP_OK;
|
|
if (!m_temporarySettingsActive) return ESP_OK;
|
|
@@ -547,6 +557,8 @@ esp_err_t CCamera::RestoreCommittedSettingsIfNeeded(void)
|
|
|
|
|
|
|
|
esp_err_t CCamera::getSensorDatenToCCstatus(void)
|
|
esp_err_t CCamera::getSensorDatenToCCstatus(void)
|
|
|
{
|
|
{
|
|
|
|
|
+ ScopedCameraOperationLock operationLock(m_cameraOperationMutex);
|
|
|
|
|
+ if (!operationLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
|
if (!cameraLock.acquired())
|
|
if (!cameraLock.acquired())
|
|
|
{
|
|
{
|
|
@@ -609,6 +621,8 @@ esp_err_t CCamera::getSensorDatenToCCstatus(void)
|
|
|
// on the OV5640, gainceiling must be set with the real value (x2>>>gainceilingLevel = 2, .... x128>>>gainceilingLevel = 128)
|
|
// on the OV5640, gainceiling must be set with the real value (x2>>>gainceilingLevel = 2, .... x128>>>gainceilingLevel = 128)
|
|
|
int CCamera::SetCamGainceiling(sensor_t *s, gainceiling_t gainceilingLevel)
|
|
int CCamera::SetCamGainceiling(sensor_t *s, gainceiling_t gainceilingLevel)
|
|
|
{
|
|
{
|
|
|
|
|
+ ScopedCameraOperationLock operationLock(m_cameraOperationMutex);
|
|
|
|
|
+ if (!operationLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
|
if (!cameraLock.acquired())
|
|
if (!cameraLock.acquired())
|
|
|
{
|
|
{
|
|
@@ -632,6 +646,8 @@ int CCamera::SetCamGainceiling(sensor_t *s, gainceiling_t gainceilingLevel)
|
|
|
|
|
|
|
|
void CCamera::SetCamSharpness(bool autoSharpnessEnabled, int sharpnessLevel)
|
|
void CCamera::SetCamSharpness(bool autoSharpnessEnabled, int sharpnessLevel)
|
|
|
{
|
|
{
|
|
|
|
|
+ ScopedCameraOperationLock operationLock(m_cameraOperationMutex);
|
|
|
|
|
+ if (!operationLock.acquired()) return;
|
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
|
if (!cameraLock.acquired())
|
|
if (!cameraLock.acquired())
|
|
|
{
|
|
{
|
|
@@ -679,6 +695,8 @@ void CCamera::SetCamSharpness(bool autoSharpnessEnabled, int sharpnessLevel)
|
|
|
|
|
|
|
|
void CCamera::SetCamSpecialEffect(sensor_t *s, int specialEffect)
|
|
void CCamera::SetCamSpecialEffect(sensor_t *s, int specialEffect)
|
|
|
{
|
|
{
|
|
|
|
|
+ ScopedCameraOperationLock operationLock(m_cameraOperationMutex);
|
|
|
|
|
+ if (!operationLock.acquired()) return;
|
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
|
if (!cameraLock.acquired())
|
|
if (!cameraLock.acquired())
|
|
|
{
|
|
{
|
|
@@ -700,6 +718,8 @@ void CCamera::SetCamSpecialEffect(sensor_t *s, int specialEffect)
|
|
|
|
|
|
|
|
void CCamera::SetCamContrastBrightness(sensor_t *s, int _contrast, int _brightness)
|
|
void CCamera::SetCamContrastBrightness(sensor_t *s, int _contrast, int _brightness)
|
|
|
{
|
|
{
|
|
|
|
|
+ ScopedCameraOperationLock operationLock(m_cameraOperationMutex);
|
|
|
|
|
+ if (!operationLock.acquired()) return;
|
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
|
if (!cameraLock.acquired())
|
|
if (!cameraLock.acquired())
|
|
|
{
|
|
{
|
|
@@ -742,6 +762,8 @@ void CCamera::SanitizeZoomParams(const CameraSettings &settings, int imageSize,
|
|
|
|
|
|
|
|
esp_err_t CCamera::SetZoomSize(const CameraSettings &settings)
|
|
esp_err_t CCamera::SetZoomSize(const CameraSettings &settings)
|
|
|
{
|
|
{
|
|
|
|
|
+ ScopedCameraOperationLock operationLock(m_cameraOperationMutex);
|
|
|
|
|
+ if (!operationLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
|
if (!cameraLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
if (!cameraLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
|
|
|
|
|
@@ -800,6 +822,8 @@ esp_err_t CCamera::SetZoomSize(const CameraSettings &settings)
|
|
|
|
|
|
|
|
esp_err_t CCamera::SetQualityZoomSize(CameraSettings &settings)
|
|
esp_err_t CCamera::SetQualityZoomSize(CameraSettings &settings)
|
|
|
{
|
|
{
|
|
|
|
|
+ ScopedCameraOperationLock operationLock(m_cameraOperationMutex);
|
|
|
|
|
+ if (!operationLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
|
if (!cameraLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
if (!cameraLock.acquired()) return ESP_ERR_TIMEOUT;
|
|
|
|
|
|
|
@@ -821,6 +845,8 @@ esp_err_t CCamera::SetQualityZoomSize(CameraSettings &settings)
|
|
|
|
|
|
|
|
void CCamera::SetCamWindow(sensor_t *s, int frameSizeX, int frameSizeY, int xOffset, int yOffset, int xTotal, int yTotal, int xOutput, int yOutput, int imageVflip)
|
|
void CCamera::SetCamWindow(sensor_t *s, int frameSizeX, int frameSizeY, int xOffset, int yOffset, int xTotal, int yTotal, int xOutput, int yOutput, int imageVflip)
|
|
|
{
|
|
{
|
|
|
|
|
+ ScopedCameraOperationLock operationLock(m_cameraOperationMutex);
|
|
|
|
|
+ if (!operationLock.acquired()) return;
|
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
ScopedCameraLock cameraLock(m_cameraMutex);
|
|
|
if (!cameraLock.acquired())
|
|
if (!cameraLock.acquired())
|
|
|
{
|
|
{
|