From c22d12c37a0a188775c3a268e30205758b86dad5 Mon Sep 17 00:00:00 2001 From: Andrej Zavgorodnij Date: Tue, 13 Jul 2021 11:55:52 +0300 Subject: [PATCH] feat: added longer end frames delay --- qr/qr.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qr/qr.go b/qr/qr.go index cc1413f5..f3dab9f4 100644 --- a/qr/qr.go +++ b/qr/qr.go @@ -22,6 +22,7 @@ const ( defaultChunkSize = 512 defaultQrRecoveryLevel = encoder.Medium defaultFramesDelay = 10 + endFramesDelay = 200 // Number of frames to show after the last frame. ) var palette = color.Palette{ @@ -94,10 +95,11 @@ func (p *CameraProcessor) WriteQR(path string, data []byte) error { if idx < lastChunkIdx { outGif.Delay = append(outGif.Delay, p.gifFramesDelay) } else { - outGif.Delay = append(outGif.Delay, p.gifFramesDelay*2) + outGif.Delay = append(outGif.Delay, endFramesDelay) } totalLen += len(c) } + f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE, 0600) if err != nil { return fmt.Errorf("failed to open file: %w", err)