Skip to content

Commit f5df77e

Browse files
committed
distributedLogging.ts: fixed bug where you could get a 980 error if you a button was pressed during DistributedLoggingScreen construction.
1 parent e9f69b1 commit f5df77e

1 file changed

Lines changed: 23 additions & 7 deletions

File tree

distributedLogging.ts

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

552+
private static setupDone: boolean = false;
553+
552554
private targetIDCache: number[]
553555

554556
constructor(app: AppInterface, sensors?: Sensor[], configs?: RecordingConfig[]) {
555557
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+
556568
this.uiState = UI_STATE.SHOWING_OPTIONS
557569
this.distributedLogger = new DistributedLoggingProtocol(app, true, this)
558570

@@ -568,6 +580,8 @@ namespace microdata {
568580
this.app.pushScene(new TabularDataViewer(this.app, function() { this.app.popScene(); this.app.pushScene(new DistributedLoggingScreen(this.app)) }))
569581
}
570582
}
583+
584+
DistributedLoggingScreen.setupDone = true;
571585
}
572586

573587
callback(msg: string) {
@@ -581,13 +595,15 @@ namespace microdata {
581595
ControllerButtonEvent.Pressed,
582596
controller.B.id,
583597
() => {
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));
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+
}
591607
}
592608
}
593609
)

0 commit comments

Comments
 (0)