universal7885: CameraLightSensor: Be more sensitive

This commit is contained in:
roynatech2544 2022-04-13 17:27:15 +09:00
commit 7a9bbf0e14
No known key found for this signature in database
GPG key ID: 50ABF73F0D19445D

View file

@ -151,7 +151,8 @@ class CameraLightSensorService : Service() {
} catch (e: IllegalStateException) { } catch (e: IllegalStateException) {
Log.w(TAG, "onReady: Session is NULL") Log.w(TAG, "onReady: Session is NULL")
} }
cameraDevice!!.close() session.close() cameraDevice!!.close()
session.close()
} catch (e: Exception) { } catch (e: Exception) {
Log.e(TAG, "Camera is in use") Log.e(TAG, "Camera is in use")
e.printStackTrace() e.printStackTrace()
@ -301,7 +302,7 @@ class CameraLightSensorService : Service() {
"AdjustBrightness: OldVal = " + oldbrightness + " NewVal = " + "AdjustBrightness: OldVal = " + oldbrightness + " NewVal = " +
brightness + " Adjusting.." brightness + " Adjusting.."
) )
var newbrightness = brightness var newbrightness = 2 * brightness - oldbrightness
if (newbrightness > 255) { if (newbrightness > 255) {
newbrightness = 255 newbrightness = 255
} else if (newbrightness < 0) { } else if (newbrightness < 0) {