@@ -9,7 +9,7 @@ namespace microdata {
99 * Choose between:
1010 * Resetting Datalogger
1111 * A tabular view of the recorded data
12- * A graph of the recorded data
12+ * Jacdac light experiment
1313 */
1414 export class DataViewSelect extends CursorScene {
1515 private dataloggerEmpty : boolean
@@ -18,7 +18,7 @@ namespace microdata {
1818 super ( app ) ;
1919 }
2020
21- /* override */ startup ( ) {
21+ /* override */ startup ( ) {
2222 super . startup ( )
2323 basic . pause ( 50 ) ;
2424
@@ -27,72 +27,76 @@ namespace microdata {
2727
2828 const y = Screen . HEIGHT * 0.234 // y = 30 on an Arcade Shield of height 128 pixels
2929
30- this . navigator . setBtns ( [ [
31- new Button ( {
30+ let btns : Button [ ] [ ] = [ [ ] ] ;
31+
32+ if ( this . dataloggerEmpty ) {
33+ btns [ 0 ] . push ( new Button ( {
3234 parent : null ,
3335 style : ButtonStyles . Transparent ,
34- icon : "largeDisk " ,
35- ariaId : "View Data" ,
36+ icon : "edit_program " ,
37+ ariaId : "Log Data" ,
3638 x : - 50 ,
3739 y,
3840 onClick : ( ) => {
3941 this . app . popScene ( )
40- this . app . pushScene ( new TabularDataViewer ( this . app , ( ) => { this . app . popScene ( ) ; this . app . pushScene ( new DataViewSelect ( this . app ) ) } ) )
42+ this . app . pushScene ( new SensorSelect ( this . app , MicroDataSceneEnum . RecordingConfigSelect ) )
4143 } ,
42- } ) ,
43-
44- new Button ( {
44+ } ) )
45+ } else {
46+ btns [ 0 ] . push ( new Button ( {
4547 parent : null ,
4648 style : ButtonStyles . Transparent ,
47- icon : "linear_graph_1 " ,
48- ariaId : "View Graph " ,
49- x : 0 ,
49+ icon : "largeDisk " ,
50+ ariaId : "View Data " ,
51+ x : - 50 ,
5052 y,
5153 onClick : ( ) => {
5254 this . app . popScene ( )
53- this . app . pushScene ( new GraphGenerator ( this . app ) )
54- } ,
55- } ) ,
55+ this . app . pushScene ( new TabularDataViewer ( this . app , ( ) => { this . app . popScene ( ) ; this . app . pushScene ( new DataViewSelect ( this . app ) ) } ) )
56+ }
57+ } ) )
58+ }
5659
57- new Button ( {
58- parent : null ,
59- style : ButtonStyles . Transparent ,
60- icon : "largeSettingsGear" ,
61- ariaId : "Reset Datalogger" ,
62- x : 50 ,
63- y,
64- onClick : ( ) => {
65- datalogger . deleteLog ( )
66- this . dataloggerEmpty = true
67-
68- context . onEvent (
69- ControllerButtonEvent . Pressed ,
70- controller . A . id ,
71- ( ) => {
72- this . app . popScene ( )
73- this . app . pushScene ( new SensorSelect ( this . app , MicroDataSceneEnum . RecordingConfigSelect ) )
74- }
75- )
76- } ,
77- } )
78- ] ] )
60+ btns [ 0 ] . push ( new Button ( {
61+ parent : null ,
62+ style : ButtonStyles . Transparent ,
63+ icon : "linear_graph_1" ,
64+ ariaId : "Jacdac Light Experiment" ,
65+ x : 0 ,
66+ y,
67+ onClick : ( ) => {
68+ this . app . popScene ( )
69+ this . app . pushScene ( new JacdacLightExperiment ( this . app ) )
70+ } ,
71+ } ) )
72+
73+ btns [ 0 ] . push ( new Button ( {
74+ parent : null ,
75+ style : ButtonStyles . Transparent ,
76+ icon : "largeSettingsGear" ,
77+ ariaId : "Reset Datalogger" ,
78+ x : 50 ,
79+ y,
80+ onClick : ( ) => {
81+ datalogger . deleteLog ( )
82+ this . dataloggerEmpty = true
83+
84+ context . onEvent (
85+ ControllerButtonEvent . Pressed ,
86+ controller . A . id ,
87+ ( ) => {
88+ this . app . popScene ( )
89+ this . app . pushScene ( new SensorSelect ( this . app , MicroDataSceneEnum . RecordingConfigSelect ) )
90+ }
91+ )
92+ } ,
93+ } ) )
94+ this . navigator . setBtns ( btns )
7995
8096 //---------
8197 // Control:
8298 //---------
8399
84- // No data in log (first row are headers)
85- if ( this . dataloggerEmpty ) {
86- context . onEvent (
87- ControllerButtonEvent . Pressed ,
88- controller . A . id ,
89- ( ) => {
90- this . app . popScene ( )
91- this . app . pushScene ( new SensorSelect ( this . app , MicroDataSceneEnum . RecordingConfigSelect ) )
92- }
93- )
94- }
95-
96100 context . onEvent (
97101 ControllerButtonEvent . Pressed ,
98102 controller . B . id ,
@@ -114,15 +118,14 @@ namespace microdata {
114118
115119 if ( this . dataloggerEmpty ) {
116120 screen ( ) . printCenter ( "No data has been recorded" , 5 )
117- screen ( ) . printCenter ( "Press A to Record some!" , Screen . HALF_HEIGHT )
118- return ;
121+ screen ( ) . printCenter ( "Log Data to collect some!" , Screen . HALF_HEIGHT - 30 )
119122 }
120123
121124 else {
122- screen ( ) . printCenter ( "Recorded Data Options" , 5 )
123- this . navigator . drawComponents ( ) ;
125+ screen ( ) . printCenter ( "View Data, Experiment or Clear Data" , 5 )
124126 }
125127
128+ this . navigator . drawComponents ( ) ;
126129 super . draw ( )
127130 }
128131 }
0 commit comments