Skip to content

Commit 6a52a35

Browse files
committed
loggingModeSelection.ts: Interval mode rework.
1 parent 3960e92 commit 6a52a35

2 files changed

Lines changed: 491 additions & 143 deletions

File tree

home.ts

Lines changed: 236 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -1,146 +1,245 @@
1-
namespace microdata {
2-
import Screen = user_interface_base.Screen
3-
import CursorScene = user_interface_base.CursorScene
4-
import Button = user_interface_base.Button
5-
import ButtonStyles = user_interface_base.ButtonStyles
6-
import AppInterface = user_interface_base.AppInterface
7-
import CursorSceneEnum = user_interface_base.CursorSceneEnum
8-
import font = user_interface_base.font
1+
namespace microdata {
2+
import Screen = user_interface_base.Screen
3+
import CursorScene = user_interface_base.CursorScene
4+
import Button = user_interface_base.Button
5+
import ButtonStyles = user_interface_base.ButtonStyles
6+
import AppInterface = user_interface_base.AppInterface
7+
import CursorSceneEnum = user_interface_base.CursorSceneEnum
8+
import font = user_interface_base.font
9+
10+
export class Home extends CursorScene {
11+
constructor(app: AppInterface) {
12+
super(app)
13+
}
14+
15+
/* override */ startup() {
16+
super.startup()
17+
18+
const y = 25
19+
20+
this.navigator.setBtns([[
21+
new Button({
22+
parent: null,
23+
style: ButtonStyles.Transparent,
24+
icon: "linear_graph_1",
25+
ariaId: "Real-time Data",
26+
x: -58,
27+
y,
28+
onClick: () => {
29+
this.app.popScene()
30+
this.app.pushScene(new SensorSelect(this.app,
31+
num.LiveDataViewer))
32+
},
33+
}),
34+
35+
new Button({
36+
parent: null,
37+
style: ButtonStyles.Transparent,
38+
icon: "edit_program",
39+
ariaId: "Log Data",
40+
x: -20,
41+
y,
42+
onClick: () => {
43+
this.app.popScene()
44+
// this.app.pushScene(new SensorSelect(this.app,
45+
rdingConfigSelect))
46+
this.app.pushScene(new LoggingModeSelection(this.app))
47+
},
48+
}),
49+
50+
new Button({
51+
parent: null,
52+
style: ButtonStyles.Transparent,
53+
icon: "radio_set_group",
54+
ariaId: "Command Mode",
55+
x: 20,
56+
y,
57+
ick: () => {
58+
this.app.popScene()
59+
this.app.pushScene(new
60+
DistributedLoggingScreen(this.app))
61+
},
62+
63+
64+
new Button({
65+
parent: null,
66+
style: ButtonStyles.Transparent,
67+
icon: "largeDisk",
68+
ariaId: "View Data",
69+
x: 58,
70+
y,
71+
onClick: () => {
72+
this.app.popScene()
73+
this.app.pushScene(new DataViewSelect(this.app))
74+
},
75+
})
76+
77+
}
78+
79+
private drawVersion() {
80+
nt = bitmaps.font5
81+
const text = "v1.7.3"
82+
rint(
83+
text,
84+
IGHT_EDGE - (font.charWidth * text.length),
85+
Screen.BOTTOM_EDGE - font.charHeight - 2,
86+
87+
font
88+
)
89+
90+
91+
set = -Screen.HEIGHT >> 1
92+
draw() {
93+
en.fillRect(
94+
Screen.LEFT_EDGE,
95+
Screen.TOP_EDGE,
96+
Screen.WIDTH,
97+
Screen.HEIGHT,
98+
0xc
99+
100+
101+
crobitLogo = icons.get("microbitLogo")
102+
const microdataLogo = icons.get("microdataLogo")
103+
104+
this.yOffset = Math.min(0, this.yOffset + 2)
105+
= control.millis()
106+
const dy = this.yOffset == 0 ? (Math.idiv(t, 800) & 1) - 1 : 0
107+
rgin = 2
108+
const OFFSET = (Screen.HEIGHT >> 1) - microdataLogo.height - margin
109+
110+
const y = Screen.TOP_EDGE + OFFSET //+ dy
111+
rawTransparentImage(
112+
microdataLogo,
113+
EFT_EDGE + ((Screen.WIDTH - microdataLogo.width) >>
114+
1)// + dy
115+
116+
y + this.yOffset
117+
)
118+
119+
Screen.drawTransparentImage(
120+
microbitLogo,
121+
Screen.LEFT_EDGE +
122+
((Screen.WIDTH - microbitLogo.width) >> 1) + dy
123+
,
124+
y - microdataLogo.height + this.yOffset + margin
125+
)
126+
127+
if (!this.yOffset) {
128+
en.print(
129+
"Mini-measurer",
130+
Screen.LEFT_EDGE +
131+
((Screen.WIDTH + microdataLogo.width) >> 1)
132+
+ dy
133+
-
134+
font.charWidth * "Mini-measurer".length,
135+
Screen.TOP_EDGE +
136+
OFFSET +
137+
microdataLogo.height +
138+
dy +
139+
this.yOffset +
140+
141+
0xb,
142+
143+
)
144+
145+
146+
.navigator.drawComponents();
147+
this.drawVersion()
148+
super.draw()
149+
}
9150

10-
export class Home extends CursorScene {
11-
constructor(app: AppInterface) {
12-
super(app)
13-
}
151+
}
14152

15-
/* override */ startup() {
16-
super.startup()
153+
154+
155+
156+
157+
158+
159+
160+
161+
162+
163+
164+
165+
166+
167+
168+
169+
170+
171+
172+
173+
17174

18-
const y = 25
175+
176+
177+
178+
179+
19180

20-
this.navigator.setBtns([[
21-
new Button({
22-
parent: null,
23-
style: ButtonStyles.Transparent,
24-
icon: "linear_graph_1",
25-
ariaId: "Real-time Data",
26-
x: -58,
27-
y,
28-
onClick: () => {
29-
this.app.popScene()
30-
this.app.pushScene(new SensorSelect(this.app, CursorSceneEnum.LiveDataViewer))
31-
},
32-
}),
181+
182+
183+
184+
33185

34-
new Button({
35-
parent: null,
36-
style: ButtonStyles.Transparent,
37-
icon: "edit_program",
38-
ariaId: "Log Data",
39-
x: -20,
40-
y,
41-
onClick: () => {
42-
this.app.popScene()
43-
// this.app.pushScene(new SensorSelect(this.app, CursorSceneEnum.RecordingConfigSelect))
44-
this.app.pushScene(new LoggingModeSelection(this.app))
45-
},
46-
}),
186+
187+
188+
189+
190+
47191

48-
new Button({
49-
parent: null,
50-
style: ButtonStyles.Transparent,
51-
icon: "radio_set_group",
52-
ariaId: "Command Mode",
53-
x: 20,
54-
y,
55-
onClick: () => {
56-
this.app.popScene()
57-
this.app.pushScene(new DistributedLoggingScreen(this.app))
58-
},
59-
}),
192+
193+
194+
195+
196+
197+
198+
60199

61-
new Button({
62-
parent: null,
63-
style: ButtonStyles.Transparent,
64-
icon: "largeDisk",
65-
ariaId: "View Data",
66-
x: 58,
67-
y,
68-
onClick: () => {
69-
this.app.popScene()
70-
this.app.pushScene(new DataViewSelect(this.app))
71-
},
72-
})
73-
]])
74-
}
200+
201+
202+
203+
204+
205+
206+
207+
208+
209+
210+
211+
212+
213+
214+
215+
216+
217+
218+
219+
220+
221+
75222

76-
private drawVersion() {
77-
const font = bitmaps.font5
78-
const text = "v1.7.3"
79-
Screen.print(
80-
text,
81-
Screen.RIGHT_EDGE - (font.charWidth * text.length),
82-
Screen.BOTTOM_EDGE - font.charHeight - 2,
83-
0xb,
84-
font
85-
)
86-
}
223+
224+
225+
226+
227+
87228

88-
private yOffset = -Screen.HEIGHT >> 1
89-
draw() {
90-
Screen.fillRect(
91-
Screen.LEFT_EDGE,
92-
Screen.TOP_EDGE,
93-
Screen.WIDTH,
94-
Screen.HEIGHT,
95-
0xc
96-
)
97-
98-
const microbitLogo = icons.get("microbitLogo")
99-
const microdataLogo = icons.get("microdataLogo")
100-
101-
this.yOffset = Math.min(0, this.yOffset + 2)
102-
const t = control.millis()
103-
const dy = this.yOffset == 0 ? (Math.idiv(t, 800) & 1) - 1 : 0
104-
const margin = 2
105-
const OFFSET = (Screen.HEIGHT >> 1) - microdataLogo.height - margin - 9
106-
const y = Screen.TOP_EDGE + OFFSET //+ dy
107-
Screen.drawTransparentImage(
108-
microdataLogo,
109-
Screen.LEFT_EDGE + ((Screen.WIDTH - microdataLogo.width) >> 1)// + dy
110-
,
111-
y + this.yOffset
112-
)
113-
114-
Screen.drawTransparentImage(
115-
microbitLogo,
116-
Screen.LEFT_EDGE +
117-
((Screen.WIDTH - microbitLogo.width) >> 1) + dy
118-
,
119-
y - microdataLogo.height + this.yOffset + margin
120-
)
121-
122-
if (!this.yOffset) {
123-
Screen.print(
124-
"Mini-measurer",
125-
Screen.LEFT_EDGE +
126-
((Screen.WIDTH + microdataLogo.width) >> 1)
127-
+ dy
128-
-
129-
font.charWidth * "Mini-measurer".length,
130-
Screen.TOP_EDGE +
131-
OFFSET +
132-
microdataLogo.height +
133-
dy +
134-
this.yOffset +
135-
3,
136-
0xb,
137-
font
138-
)
139-
}
140-
141-
this.navigator.drawComponents();
142-
this.drawVersion()
143-
super.draw()
144-
}
145-
}
146-
}
229+
230+
231+
232+
233+
234+
235+
236+
237+
238+
239+
240+
241+
242+
243+
244+
245+

0 commit comments

Comments
 (0)