Added support for Code 39 (#1527)

This commit is contained in:
André Heuer 2021-06-29 17:40:28 +02:00 committed by GitHub
parent 76cfe7fece
commit 416c138017
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,7 +101,8 @@ Grocy.Components.BarcodeScanner.StartScanning = function()
"ean_reader", "ean_reader",
"ean_8_reader", "ean_8_reader",
"code_128_reader", "code_128_reader",
"datamatrix" "datamatrix",
"code_39_reader"
], ],
debug: { debug: {
showCanvas: Grocy.UserSettings.quagga2_debug, showCanvas: Grocy.UserSettings.quagga2_debug,
@ -174,7 +175,8 @@ Quagga.onDetected(function(result)
} }
}); });
if (Grocy.Components.BarcodeScanner.DecodedCodesErrorCount / Grocy.Components.BarcodeScanner.DecodedCodesCount < 0.15) if ((Grocy.Components.BarcodeScanner.DecodedCodesErrorCount / Grocy.Components.BarcodeScanner.DecodedCodesCount < 0.15) ||
(Grocy.Components.BarcodeScanner.DecodedCodesErrorCount == 0 && Grocy.Components.BarcodeScanner.DecodedCodesCount == 0 && result.codeResult.code.length != 0))
{ {
Grocy.Components.BarcodeScanner.StopScanning(); Grocy.Components.BarcodeScanner.StopScanning();
$(document).trigger("Grocy.BarcodeScanned", [result.codeResult.code, Grocy.Components.BarcodeScanner.CurrentTarget]); $(document).trigger("Grocy.BarcodeScanned", [result.codeResult.code, Grocy.Components.BarcodeScanner.CurrentTarget]);