Update Gio version. Remove ticker as we already invalidate on

any Bluetooth event.
This commit is contained in:
Greg 2019-10-25 14:58:07 -04:00
parent f04f3b1ffb
commit 299600b537
1 changed files with 6 additions and 6 deletions

12
main.go
View File

@ -7,7 +7,6 @@ import (
"log"
"os"
"path"
"time"
"git.wow.st/gmp/ble"
@ -21,7 +20,7 @@ import (
"gioui.org/widget"
"gioui.org/widget/material"
_ "gioui.org/font/gofont"
"gioui.org/font/gofont"
)
type conf struct {
@ -74,6 +73,7 @@ func eventloop() {
app.Size(unit.Dp(400), unit.Dp(400)),
app.Title("HRM"),
)
gofont.Register()
th := material.NewTheme()
gtx := &layout.Context{Queue: w.Queue()}
@ -117,7 +117,10 @@ func eventloop() {
c3 := f.Rigid(gtx, func() {
lst := &layout.List{Axis: layout.Vertical}
lst.Layout(gtx, len(periphs), func(i int) {
th.Button(periphs[i].Name).Layout(gtx, btns[i])
gtx.Constraints.Width.Min = gtx.Constraints.Width.Max
layout.UniformInset(unit.Dp(2)).Layout(gtx, func() {
th.Button(periphs[i].Name).Layout(gtx, btns[i])
})
if btns[i].Clicked(gtx) {
b.StopScan()
periph = periphs[i]
@ -185,7 +188,6 @@ func eventloop() {
page = offpage
tick := time.NewTicker(time.Second / 30)
events := b.Events()
for {
@ -251,8 +253,6 @@ func eventloop() {
hr = hrDecode(e.Data)
}
w.Invalidate() // refresh on any Bluetooth event
case <-tick.C:
w.Invalidate()
case e := <-w.Events():
switch e := e.(type) {
case system.DestroyEvent: