pace: ensure redraw of gps level
parent
2273ad46d6
commit
82b41a0f20
|
|
@ -56,13 +56,19 @@ const drawGpsLvl = (l: Layout.RenderedHierarchy) => {
|
||||||
const layout = new Layout({
|
const layout = new Layout({
|
||||||
type: "h",
|
type: "h",
|
||||||
c: [
|
c: [
|
||||||
{
|
({
|
||||||
type: "custom",
|
type: "custom",
|
||||||
render: drawGpsLvl,
|
render: drawGpsLvl,
|
||||||
|
id: "gpslvl",
|
||||||
filly: 1,
|
filly: 1,
|
||||||
width: 10,
|
width: 10,
|
||||||
bgCol: g.theme.bg, // automatically clears before render()
|
bgCol: g.theme.bg, // automatically clears before render()
|
||||||
},
|
redraw: -1, // see below gps updating
|
||||||
|
} as unknown as {
|
||||||
|
// hack to avoid a more complex id-mapping Layout inference
|
||||||
|
type: "custom",
|
||||||
|
render: (_: Layout.RenderedHierarchy) => void
|
||||||
|
}),
|
||||||
{
|
{
|
||||||
type: "v",
|
type: "v",
|
||||||
c: [
|
c: [
|
||||||
|
|
@ -298,7 +304,13 @@ Bangle.on('tap', e => {
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
Bangle.setGPSPower(1, "pace");
|
Bangle.setGPSPower(1, "pace");
|
||||||
Bangle.on("GPS", gps => latestGps = gps);
|
Bangle.on("GPS", gps => {
|
||||||
|
const newSats = gps?.satellites;
|
||||||
|
const l = layout["gpslvl"] as unknown as Layout.RenderedHierarchy | undefined;
|
||||||
|
if(l && newSats !== latestGps?.satellites)
|
||||||
|
(l as any).redraw = newSats; // force a redraw
|
||||||
|
latestGps = gps;
|
||||||
|
});
|
||||||
|
|
||||||
g.clearRect(Bangle.appRect);
|
g.clearRect(Bangle.appRect);
|
||||||
draw();
|
draw();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue