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

Commit

Permalink
Merge pull request #162 from lidofinance/feat/longer-end-frames-delay
Browse files Browse the repository at this point in the history
feat: added longer end frames delay
  • Loading branch information
zavgorodnii authored Jul 13, 2021
2 parents e5af341 + c22d12c commit f766b7c
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 f766b7c

Please sign in to comment.