Fix error state for stroboscope and SOS

This commit is contained in:
Ensar Sarajčić 2023-10-17 13:03:08 +02:00
parent b0ea8d8ef2
commit 18c8bf3c7a

View File

@ -272,12 +272,12 @@ class MyCameraImpl private constructor(private val context: Context, private var
handleCameraSetup() handleCameraSetup()
while (!shouldStroboscopeStop) { while (!shouldStroboscopeStop) {
try { try {
cameraFlash.runOrToast { cameraFlash!!.run {
toggleFlashlight(true) toggleFlashlight(true)
} }
val onDuration = if (isStroboSOS) SOS[sosIndex++ % SOS.size] else stroboFrequency val onDuration = if (isStroboSOS) SOS[sosIndex++ % SOS.size] else stroboFrequency
Thread.sleep(onDuration) Thread.sleep(onDuration)
cameraFlash.runOrToast { cameraFlash!!.run {
toggleFlashlight(false) toggleFlashlight(false)
} }
val offDuration = if (isStroboSOS) SOS[sosIndex++ % SOS.size] else stroboFrequency val offDuration = if (isStroboSOS) SOS[sosIndex++ % SOS.size] else stroboFrequency