camera-5.1: catch error in start_check_auto_torch

This commit is contained in:
Fam Zheng 2025-12-15 09:17:21 +00:00
parent 6174b2af43
commit 8aafe16bf6

View File

@ -192,15 +192,19 @@ function do_handle_frame() {
async function start_check_auto_torch(qrcode)
{
should_check_auto_torch = false;
var r = await fetch("https://themblem.com/api/v1/check-auto-torch/?qrcode=" + encodeURIComponent(qrcode), {
method: "GET",
});
var d = await r.json();
debug_log(JSON.stringify(d));
if (d.enable_auto_torch && !torch) {
toggle_torch();
try {
var r = await fetch("https://themblem.com/api/v1/check-auto-torch/?qrcode=" + encodeURIComponent(qrcode), {
method: "GET",
});
var d = await r.json();
debug_log(JSON.stringify(d));
if (d.enable_auto_torch && !torch) {
toggle_torch();
}
camera_sensitivity = d.camera_sensitivity || 1.0;
} catch (e) {
debug_log("start_check_auto_torch exception: " + e);
}
camera_sensitivity = d.camera_sensitivity || 1.0;
setTimeout(() => {
done_checking_auto_torch = true;
}, 200);