Skip to content

Commit cb68129

Browse files
committed
startup() -> startup(controlSetupFn?: () => void), as per user-interface-base#v0.0.23, useful for telling CursorScene to setup buttons differently.
1 parent 97a9598 commit cb68129

5 files changed

Lines changed: 16 additions & 34 deletions

File tree

app.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ namespace microdata {
3030
reportEvent("app.start")
3131

3232
this.sceneManager = new SceneManager()
33-
datalogger.includeTimestamp(FlashLogTimeStampFormat.None)
33+
datalogger.includeTimestamp(FlashLogTimeStampFormat.None);
3434

3535
const arcadeShieldConnected = shieldhelpers.shieldPresent();
3636
if (arcadeShieldConnected)
3737
this.pushScene(new microdata.Home(this));
38-
// else
39-
// new HeadlessMode(this);
38+
else
39+
new DistributedLoggingProtocol(this, false);
4040
}
4141

4242
public pushScene(scene: Scene) {

distributedLogging.ts

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -549,22 +549,10 @@ namespace microdata {
549549
public static streamingDone: boolean = true
550550
private static streamDataBack: boolean = true
551551

552-
private static setupDone: boolean = false;
553-
554552
private targetIDCache: number[]
555553

556554
constructor(app: AppInterface, sensors?: Sensor[], configs?: RecordingConfig[]) {
557555
super(app)
558-
559-
// This DistributedLoggingScreen can take a while to start on account of the DistributedLoggingProtocol.
560-
// Because of this it is important to unbind the buttons so that they cannot be invoked during setup.
561-
control.onEvent(ControllerButtonEvent.Pressed, controller.up.id, () => { });
562-
control.onEvent(ControllerButtonEvent.Pressed, controller.down.id, () => { });
563-
control.onEvent(ControllerButtonEvent.Pressed, controller.left.id, () => { });
564-
control.onEvent(ControllerButtonEvent.Pressed, controller.right.id, () => { });
565-
control.onEvent(ControllerButtonEvent.Pressed, controller.A.id, () => { });
566-
control.onEvent(ControllerButtonEvent.Pressed, controller.B.id, () => { });
567-
568556
this.uiState = UI_STATE.SHOWING_OPTIONS
569557
this.distributedLogger = new DistributedLoggingProtocol(app, true, this)
570558

@@ -580,30 +568,26 @@ namespace microdata {
580568
this.app.pushScene(new TabularDataViewer(this.app, function() { this.app.popScene(); this.app.pushScene(new DistributedLoggingScreen(this.app)) }))
581569
}
582570
}
583-
584-
DistributedLoggingScreen.setupDone = true;
585571
}
586572

587573
callback(msg: string) {
588574
DistributedLoggingScreen.streamingDone = true
589575
}
590576

591-
/* override */ startup(controlSetupFn?: () => void) {
577+
/* override */ startup(controlSetupfn: () => void) {
592578
super.startup()
593579

594580
control.onEvent(
595581
ControllerButtonEvent.Pressed,
596582
controller.B.id,
597583
() => {
598-
if (DistributedLoggingScreen.setupDone) {
599-
if (this.uiState != UI_STATE.SHOWING_OPTIONS) {
600-
this.uiState = UI_STATE.SHOWING_OPTIONS
601-
this.cursor.visible = true
602-
}
603-
else if (DistributedLoggingScreen.streamingDone) {
604-
this.app.popScene()
605-
this.app.pushScene(new Home(this.app));
606-
}
584+
if (this.uiState != UI_STATE.SHOWING_OPTIONS) {
585+
this.uiState = UI_STATE.SHOWING_OPTIONS
586+
this.cursor.visible = true
587+
}
588+
else if (DistributedLoggingScreen.streamingDone) {
589+
this.app.popScene()
590+
this.app.pushScene(new Home(this.app));
607591
}
608592
}
609593
)

home.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace microdata {
4040
y,
4141
onClick: () => {
4242
this.app.popScene()
43-
// this.app.pushScene(new SensorSelect(this.app, CursorSceneEnum.RecordingConfigSelect))
43+
this.app.pushScene(new SensorSelect(this.app, CursorSceneEnum.RecordingConfigSelect))
4444
// this.app.pushScene(new LoggingModeSelection(this.app))
4545
},
4646
}),

loggingModeSelection.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
namespace microdata {
32
import Screen = user_interface_base.Screen
43
import Scene = user_interface_base.Scene
@@ -54,7 +53,7 @@ namespace microdata {
5453
super(app)
5554
}
5655

57-
/* override */ startup(controlSetupFn?: () => {}) {
56+
/* override */ startup(controlSetupFn?: () => void) {
5857
super.startup()
5958
control.onEvent(
6059
ControllerButtonEvent.Pressed,
@@ -118,7 +117,7 @@ namespace microdata {
118117
this.experimentIntervalUnitsIndex = (this.experimentIntervalUnitsIndex + 1) % EXPERIMENT_UNITS.length;
119118
}
120119
}
121-
basic.pause(100)
120+
basic.pause(200)
122121
}
123122
// Reset binding
124123
control.onEvent(ControllerButtonEvent.Released, controller.up.id, () => { })
@@ -153,7 +152,7 @@ namespace microdata {
153152
this.experimentIntervalUnitsIndex = (((this.experimentIntervalUnitsIndex - 1) % len) + len) % len;
154153
}
155154
}
156-
basic.pause(100)
155+
basic.pause(200)
157156
}
158157
// Reset binding
159158
control.onEvent(ControllerButtonEvent.Released, controller.down.id, () => { })
@@ -775,4 +774,3 @@ namespace microdata {
775774
}
776775
}
777776
}
778-

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"dependencies": {
3-
"pxt-microbit": "^7.1.13"
3+
"pxt-microbit": "^7.1.56"
44
}
55
}

0 commit comments

Comments
 (0)