@@ -64,12 +64,12 @@ namespace microdata {
6464 this . guiStateAnswer =
6565 ( this . guiStateAnswer == GUI_STATE_USER_ANSWER . CHANGING_EXPERIMENT_LENGTH ) ?
6666 this . guiStateAnswer = GUI_STATE_USER_ANSWER . CHANGING_EXPERIMENT_LENGTH_UNITS :
67- this . guiStateAnswer = GUI_STATE_USER_ANSWER . CHANGING_EXPERIMENT_LENGTH
67+ this . guiStateAnswer = GUI_STATE_USER_ANSWER . CHANGING_EXPERIMENT_LENGTH ;
6868 } else {
6969 this . guiStateAnswer =
7070 ( this . guiStateAnswer == GUI_STATE_USER_ANSWER . CHANGING_EXPERIMENT_INTERVAL ) ?
7171 this . guiStateAnswer = GUI_STATE_USER_ANSWER . CHANGING_EXPERIMENT_INTERVAL_UNITS :
72- this . guiStateAnswer = GUI_STATE_USER_ANSWER . CHANGING_EXPERIMENT_INTERVAL
72+ this . guiStateAnswer = GUI_STATE_USER_ANSWER . CHANGING_EXPERIMENT_INTERVAL ;
7373 }
7474 }
7575 )
@@ -86,8 +86,8 @@ namespace microdata {
8686 } else {
8787 this . guiStateAnswer =
8888 ( this . guiStateAnswer == GUI_STATE_USER_ANSWER . CHANGING_EXPERIMENT_INTERVAL ) ?
89- this . guiStateAnswer = GUI_STATE_USER_ANSWER . CHANGING_EXPERIMENT_INTERVAL_UNITS :
90- this . guiStateAnswer = GUI_STATE_USER_ANSWER . CHANGING_EXPERIMENT_INTERVAL
89+ this . guiStateAnswer = GUI_STATE_USER_ANSWER . CHANGING_EXPERIMENT_INTERVAL_UNITS :
90+ this . guiStateAnswer = GUI_STATE_USER_ANSWER . CHANGING_EXPERIMENT_INTERVAL
9191 }
9292 }
9393 )
@@ -115,7 +115,7 @@ namespace microdata {
115115 if ( this . guiStateAnswer == GUI_STATE_USER_ANSWER . CHANGING_EXPERIMENT_INTERVAL ) {
116116 this . experimentInterval += 1 ;
117117 } else {
118- this . experimentIntervalUnitsIndex = ( this . experimentIntervalUnitsIndex + 1 ) % EXPERIMENT_UNITS . length ; ;
118+ this . experimentIntervalUnitsIndex = ( this . experimentIntervalUnitsIndex + 1 ) % EXPERIMENT_UNITS . length ;
119119 }
120120 }
121121 basic . pause ( 100 )
@@ -143,14 +143,14 @@ namespace microdata {
143143 this . experimentLength = Math . max ( 1 , this . experimentLength - 1 ) ;
144144 } else {
145145 const len = EXPERIMENT_UNITS . length ;
146- this . experimentLengthUnitsIndex = ( ( ( this . experimentLengthUnitsIndex - 1 ) % len ) + len ) % len
146+ this . experimentLengthUnitsIndex = ( ( ( this . experimentLengthUnitsIndex - 1 ) % len ) + len ) % len ;
147147 }
148148 } else {
149149 if ( this . guiStateAnswer == GUI_STATE_USER_ANSWER . CHANGING_EXPERIMENT_INTERVAL ) {
150150 this . experimentInterval = Math . max ( 1 , this . experimentInterval - 1 ) ;
151151 } else {
152152 const len = EXPERIMENT_UNITS . length ;
153- this . experimentIntervalUnitsIndex = ( ( ( this . experimentIntervalUnitsIndex - 1 ) % len ) + len ) % len
153+ this . experimentIntervalUnitsIndex = ( ( ( this . experimentIntervalUnitsIndex - 1 ) % len ) + len ) % len ;
154154 }
155155 }
156156 basic . pause ( 100 )
@@ -164,22 +164,32 @@ namespace microdata {
164164 ControllerButtonEvent . Pressed ,
165165 controller . A . id ,
166166 ( ) => {
167- basic . showLeds ( `
168- . . . . .
169- . # . # .
170- . . . . .
171- # . . . #
172- . # # # .
173- ` )
167+ if ( this . guiStateQuestion == GUI_STATE_QUESTION . ASKING_HOW_LONG ) {
168+ this . guiStateQuestion = GUI_STATE_QUESTION . ASKING_INTERVAL
169+ this . guiStateAnswer = GUI_STATE_USER_ANSWER . CHANGING_EXPERIMENT_INTERVAL
170+ } else {
171+ basic . showLeds ( `
172+ . . . . .
173+ . # . # .
174+ . . . . .
175+ # . . . #
176+ . # # # .
177+ ` )
178+ }
174179 }
175180 )
176181
177182 control . onEvent (
178183 ControllerButtonEvent . Pressed ,
179184 controller . B . id ,
180185 ( ) => {
181- this . app . popScene ( ) ;
182- this . app . pushScene ( new LoggingModeSelection ( this . app ) )
186+ if ( this . guiStateQuestion == GUI_STATE_QUESTION . ASKING_HOW_LONG ) {
187+ this . app . popScene ( ) ;
188+ this . app . pushScene ( new LoggingModeSelection ( this . app ) )
189+ } else {
190+ this . guiStateQuestion = GUI_STATE_QUESTION . ASKING_HOW_LONG
191+ this . guiStateAnswer = GUI_STATE_USER_ANSWER . CHANGING_EXPERIMENT_LENGTH
192+ }
183193 }
184194 )
185195 }
@@ -210,10 +220,17 @@ namespace microdata {
210220 6
211221 ) // End of Sensor name Box
212222
223+ const firstColValue : string =
224+ ( this . guiStateQuestion == GUI_STATE_QUESTION . ASKING_HOW_LONG ) ?
225+ this . experimentLength . toString ( ) :
226+ this . experimentInterval . toString ( ) ;
227+
228+ const secondColValue : string =
229+ ( this . guiStateQuestion == GUI_STATE_QUESTION . ASKING_HOW_LONG ) ?
230+ EXPERIMENT_UNITS [ this . experimentLengthUnitsIndex ] :
231+ EXPERIMENT_UNITS [ this . experimentIntervalUnitsIndex ] ;
213232
214- const firstColValue : string = this . experimentLength . toString ( )
215233 const colSpacingValue : string = ( firstColValue . length % 2 ) ? " " : " " ;
216- const secondColValue : string = EXPERIMENT_UNITS [ this . experimentLengthUnitsIndex ]
217234
218235 const totalLength = firstColValue . length + colSpacingValue . length + secondColValue . length ;
219236 const xCenteringOffset = ( screen ( ) . width - ( totalLength * textFont . charWidth ) ) >> 1 ;
@@ -280,15 +297,15 @@ namespace microdata {
280297 screen ( ) . fillRect (
281298 boxXOffset ,
282299 22 ,
283- 90 ,
300+ 108 ,
284301 26 ,
285302 15
286303 )
287304
288305 screen ( ) . fillRect (
289306 boxXOffset ,
290307 22 ,
291- 90 ,
308+ 108 ,
292309 26 - 2 ,
293310 6
294311 )
@@ -301,8 +318,13 @@ namespace microdata {
301318 1
302319 ) // Bulletpoint
303320
321+ const question =
322+ ( this . guiStateQuestion == GUI_STATE_QUESTION . ASKING_HOW_LONG ) ?
323+ "How long is\nyour experiment?" :
324+ "How long between\nmeasurements?"
325+
304326 screen ( ) . print (
305- "How long your\nexperiment?" ,
327+ question ,
306328 boxXOffset + 10 ,
307329 25 ,
308330 ) // End of Question
0 commit comments