[tuxdroid-svn] r4647 - in software_suite_v2/software/gadgets/tuxdroid-gadget-maxlight/trunk: execu
Status: Beta
Brought to you by:
ks156
|
From: jerome <c2m...@c2...> - 2009-05-07 08:13:29
|
Author: jerome
Date: 2009-05-07 10:13:22 +0200 (Thu, 07 May 2009)
New Revision: 4647
Modified:
software_suite_v2/software/gadgets/tuxdroid-gadget-maxlight/trunk/executables/tuxdroid-gadget-maxlight.py
software_suite_v2/software/gadgets/tuxdroid-gadget-maxlight/trunk/resources/gadget.pot
Log:
*Added a 20 seconds delay if the research takes too times
Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-maxlight/trunk/executables/tuxdroid-gadget-maxlight.py
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-maxlight/trunk/executables/tuxdroid-gadget-maxlight.py 2009-05-06 15:24:20 UTC (rev 4646)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-maxlight/trunk/executables/tuxdroid-gadget-maxlight.py 2009-05-07 08:13:22 UTC (rev 4647)
@@ -121,7 +121,6 @@
if lum > l_max: # Light Max ?
l_max = lum // 1
- sleep(0.25)
mutex.release()
return l_max # Return Light Max
@@ -133,21 +132,19 @@
Tux stop when it finds light up Modified by ks156 who wrote light
monitor gadget for TuxDroid V1 Tux turn a little, wait and turn while light < light max
'''
- tux.spinning.leftOnAsync(0.25, speed=SPV_VERYSLOW)
- sleep(1)
-
while 1:
- tux.spinning.leftOnDuring(0.1, speed=1)
- sleep(0.3)
+ tux.spinning.leftOnDuring(0.1, speed=SPV_VERYSLOW)
+ sleep(0.4)
lum = float(tux.status.requestOne('light_level')[0])
if lum >= l_stop:
tux.spinning.off()
break
- #if (int(time()) - currentTime) >= 15:
- #break;
+ if (int(time()) - currentTime) >= 20:
+ throwMessage("Sorry I'm not sure where the most of the light is coming from")
+ break;
currentTime = int(time())
@@ -180,6 +177,7 @@
elif not ( tux.status.requestOne('charger_state')[0] == 'UNPLUGGED' ) :
GadgetHelper.throwMessage("Unplug my charger first and try again.")
else:
+ start = int(time())
GadgetHelper.throwMessage("Looking for the brightest light source")
tux.eyes.open()
tux.flippers.up()
@@ -187,6 +185,8 @@
currentTime = int(time())
stop(light, currentTime) # stop
tux.flippers.down()
+ stop = int(time())
+ print( stop - start )
tux.access.release()
tux.server.disconnect()
Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-maxlight/trunk/resources/gadget.pot
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-maxlight/trunk/resources/gadget.pot 2009-05-06 15:24:20 UTC (rev 4646)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-maxlight/trunk/resources/gadget.pot 2009-05-07 08:13:22 UTC (rev 4647)
@@ -10,6 +10,9 @@
msgid "Unplug my charger first and try again."
msgstr ""
+msgid "Sorry I'm not sure where the most of the light is coming from"
+msgstr ""
+
msgid "I can't find my fish. Please, make sure I'm connected."
msgstr ""
|