Skip to content
This repository has been archived by the owner on Jun 22, 2023. It is now read-only.

Commit

Permalink
feat: added longer end frames delay
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrej Zavgorodnij committed Jul 13, 2021
1 parent e5af341 commit c22d12c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion qr/qr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c22d12c

Please sign in to comment.