[Mud-builder-commits] r287 - trunk/packages/attitude.pkg

jaffa at garage.maemo.org jaffa at garage.maemo.org
Sat Aug 22 19:25:30 EEST 2009


Author: jaffa
Date: 2009-08-22 19:25:29 +0300 (Sat, 22 Aug 2009)
New Revision: 287

Modified:
   trunk/packages/attitude.pkg/main.py
   trunk/packages/attitude.pkg/mud.xml
Log:
Update to 0.0.7 of Attitude: averages results from accelerometers to avoid noise

Modified: trunk/packages/attitude.pkg/main.py
===================================================================
--- trunk/packages/attitude.pkg/main.py	2009-08-22 16:24:41 UTC (rev 286)
+++ trunk/packages/attitude.pkg/main.py	2009-08-22 16:25:29 UTC (rev 287)
@@ -25,7 +25,10 @@
     
     rotation = None
     boundary = None
-    freq     = 10
+    freq     = 4
+    count    = 0
+    average  = 3
+    total    = (0, 0, 0)
 
     ground = None
     sky    = None
@@ -71,6 +74,14 @@
         returns x, y, z tuple. The values should be in the range -1000 - 1000."""
         
         (x, y, z) = self.provider.position()
+        self.total = (self.total[0] + x, self.total[1] + y, self.total[2] + z)
+        if (++self.count % self.average <> 0):
+          return self.visible
+
+        (x, y, z) = (self.total[0] / self.average, self.total[1] / self.average, self.total[2] / self.average)
+        self.total = (0, 0, 0)
+        self.count = 0
+
         boundary = max(min(z / 1000.0, 1), -1)
         rotation = atan2(x, -y)
         

Modified: trunk/packages/attitude.pkg/mud.xml
===================================================================
--- trunk/packages/attitude.pkg/mud.xml	2009-08-22 16:24:41 UTC (rev 286)
+++ trunk/packages/attitude.pkg/mud.xml	2009-08-22 16:25:29 UTC (rev 287)
@@ -2,7 +2,7 @@
 <package>
   <fetch type="command">
     <command>
-      PKGDIR=attitude-0.0.6
+      PKGDIR=attitude-0.0.7
       mkdir "${PKGDIR}"
       cp "${MUD_PACKAGES_DIR}/attitude.pkg/"*.py "${PKGDIR}/"
       cp "${MUD_PACKAGES_DIR}/attitude.pkg/"{Makefile,attitude} "${PKGDIR}/"
@@ -10,6 +10,7 @@
   </fetch>
   <deb>
     <depends>python-imaging | python2.5-imaging, python-osso | python2.5-osso, python-hildon | python2.5-hildon</depends>
+    <architecture>any</architecture>
     <section>user/graphics</section>
     <maintainer>Andrew Flegg &lt;andrew at bleb.org&gt;</maintainer>
     <description>An artificial horizon and spirit level.



More information about the Mud-builder-commits mailing list