@@ -203,10 +203,6 @@ def __init__(self):
203203 "button_a" : False ,
204204 "button_b" : False ,
205205 "pressed_buttons" : set (),
206- "acceleration" : {"x" : 0 , "y" : 0 , "z" : 0 },
207- "color_sensor" : {"r" : 0 , "g" : 0 , "b" : 0 , "c" : 0 },
208- "magnetometer" : {"x" : 0 , "y" : 0 , "z" : 0 },
209- "gyro" : {"x" : 0 , "y" : 0 , "z" : 0 },
210206 "sea_level_pressure" : 1013.25 ,
211207 "temperature" : 0 ,
212208 "proximity" : 0 ,
@@ -216,6 +212,23 @@ def __init__(self):
216212 "pixel" : neopixel .NeoPixel (
217213 pin = CONSTANTS .CLUE_PIN , n = 1 , pixel_order = neopixel .RGB
218214 ),
215+ # Accelerometer
216+ "motion_x" : 0 ,
217+ "motion_y" : 0 ,
218+ "motion_z" : 0 ,
219+ # Light/color sensor
220+ "light_r" : 0 ,
221+ "light_g" : 0 ,
222+ "light_b" : 0 ,
223+ "light_c" : 0 ,
224+ # Magnetometer
225+ "magnet_x" : 0 ,
226+ "magnet_y" : 0 ,
227+ "magnet_z" : 0 ,
228+ # Gyroscope
229+ "gyro_x" : 0 ,
230+ "gyro_y" : 0 ,
231+ "gyro_z" : 0 ,
219232 }
220233
221234 @property
@@ -268,9 +281,9 @@ def acceleration(self):
268281 print("Accel: {:.2f} {:.2f} {:.2f}".format(*clue.acceleration))
269282 """
270283 return (
271- self .__state ["acceleration" ][ "x " ],
272- self .__state ["acceleration" ][ "y " ],
273- self .__state ["acceleration" ][ "z " ],
284+ self .__state ["motion_x " ],
285+ self .__state ["motion_y " ],
286+ self .__state ["motion_z " ],
274287 )
275288
276289 @property
@@ -285,10 +298,10 @@ def color(self):
285298 print("Color: R: {} G: {} B: {} C: {}".format(*clue.color))
286299 """
287300 return (
288- self .__state ["color_sensor" ][ "r " ],
289- self .__state ["color_sensor" ][ "g " ],
290- self .__state ["color_sensor" ][ "b " ],
291- self .__state ["color_sensor" ][ "c " ],
301+ self .__state ["light_r " ],
302+ self .__state ["light_g " ],
303+ self .__state ["light_b " ],
304+ self .__state ["light_c " ],
292305 )
293306
294307 @property
@@ -313,9 +326,9 @@ def magnetic(self):
313326 print("Magnetic: {:.3f} {:.3f} {:.3f}".format(*clue.magnetic))
314327 """
315328 return (
316- self .__state ["magnetometer" ][ "x " ],
317- self .__state ["magnetometer" ][ "y " ],
318- self .__state ["magnetometer" ][ "z " ],
329+ self .__state ["magnet_x " ],
330+ self .__state ["magnet_y " ],
331+ self .__state ["magnet_z " ],
319332 )
320333
321334 @property
@@ -338,9 +351,9 @@ def gyro(self):
338351 print("Gyro: {:.2f} {:.2f} {:.2f}".format(*clue.gyro))
339352 """
340353 return (
341- self .__state ["gyro" ][ "x " ],
342- self .__state ["gyro" ][ "y " ],
343- self .__state ["gyro" ][ "z " ],
354+ self .__state ["gyro_x " ],
355+ self .__state ["gyro_y " ],
356+ self .__state ["gyro_z " ],
344357 )
345358
346359 @property
0 commit comments