Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2014-06-11 16:32:37 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2014-06-16 15:26:38 (GMT)
commit28da248a2bbc1e0f7b816e02ba0fb7db317e3c59 (patch)
tree9b1bf03f717a43daf2c3f741b03fe74fa86c6bd4
parentfe454e524d09d0a2234ea2d3587436480b4d1078 (diff)
Add logging to debug the accelerometer parameters
-rw-r--r--game.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/game.py b/game.py
index 5648241..06b77bd 100644
--- a/game.py
+++ b/game.py
@@ -312,7 +312,9 @@ class MazeGame(Gtk.DrawingArea):
def _read_accelerometer(self):
x, y, z = self._accelerometer.read_position()
- logging.error('read_acceleromter %s', (x, y, z))
+
+ debug_msg = "x %s, y %s, z %s | " % (x, y, z)
+
TRIGGER = 100
if abs(x) < TRIGGER:
x = 0
@@ -340,6 +342,8 @@ class MazeGame(Gtk.DrawingArea):
if x == 0 and y == 0:
player.direction = (0, 0)
+ debug_msg = debug_msg + "direction %s %s | " % (player.direction)
+
oldposition = player.position
newposition = player.animate(self.maze, False)
if oldposition != newposition:
@@ -360,6 +364,10 @@ class MazeGame(Gtk.DrawingArea):
next_read = 20
self._start_accelerometer(delay=next_read)
+ debug_msg = debug_msg + "next_read %s" % next_read
+
+ logging.error('debug_msg %s', debug_msg)
+
return False
def _start_accelerometer(self, delay=200):