Skip to content

Commit

Permalink
fix: send ui updates non blocking
Browse files Browse the repository at this point in the history
  • Loading branch information
jon4hz committed Jul 27, 2022
1 parent 03a52e8 commit 95f3ab4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions flipperzero/flipper.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type Model struct {
func New(fz *FlipperZero) tea.Model {
m := &Model{
Style: lipgloss.NewStyle().Background(lipgloss.Color("#FF8C00")).Foreground(lipgloss.Color("#000000")),
updates: make(chan string, 64),
updates: make(chan string),
fz: fz,
}

Expand Down Expand Up @@ -116,7 +116,9 @@ func (m Model) updateScreen(frame flipper.ScreenFrame) {
s.WriteString(l.String())
s.WriteByte('\n')
}
m.updates <- s.String()
go func() {
m.updates <- s.String()
}()
}

func listenScreenUpdate(u <-chan string) tea.Cmd {
Expand Down

0 comments on commit 95f3ab4

Please sign in to comment.