[tuxdroid-svn] r858 - in software/gadgets/micro_monitor/trunk: . micro_monitor micro_monitor/Script
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2008-01-21 11:14:18
|
Author: Paul_R Date: 2008-01-21 12:14:11 +0100 (Mon, 21 Jan 2008) New Revision: 858 Modified: software/gadgets/micro_monitor/trunk/micro_monitor.tgf software/gadgets/micro_monitor/trunk/micro_monitor/Scripts/Python/GUI/widget/other.pyp software/gadgets/micro_monitor/trunk/micro_monitor/Scripts/Python/notify.pyp software/gadgets/micro_monitor/trunk/micro_monitor/about.xml Log: * Fixed some bug with the notifications functions. Sometimes, the notification's actuator don't quit... But I don't know why. I've added a timeout to quit the actuator after 15s. I've also reviewed the functions which determine if the threshold has been reached, etc... * Increased the recording time. Now, the level must be under the threshold for 2 seconds before the recording stops. Modified: software/gadgets/micro_monitor/trunk/micro_monitor/Scripts/Python/GUI/widget/other.pyp =================================================================== --- software/gadgets/micro_monitor/trunk/micro_monitor/Scripts/Python/GUI/widget/other.pyp 2008-01-18 15:53:27 UTC (rev 857) +++ software/gadgets/micro_monitor/trunk/micro_monitor/Scripts/Python/GUI/widget/other.pyp 2008-01-21 11:14:11 UTC (rev 858) @@ -410,6 +410,7 @@ self.__time = '' self.__duration = 0.0 self.__start_flag = False + self.TIMEOUT = 2 ########################################################### @@ -426,18 +427,25 @@ self.__timer = time.time() + 0.5 self.__notify = True self.actuator = True - + ## if no notification is running ... if self.__notify: val_act = ((self.val_table_pos[len(self.val_table_pos)-1])*100) / (self.RANGE/2) - if val_act < self.threshold and self.__dog_stop == False: - self.__timer = time.time() + 0.1 + ## Only verify these values if the spy mode is enabled + if self.spy_enabled: + if val_act < self.threshold and self.__dog_stop == False: + self.__timer = time.time() + self.TIMEOUT + self.__dog_stop = True + elif val_act > self.threshold and self.__dog_stop == True: + self.__dog_stop = False + ##else __dog_stop = True + else: self.__dog_stop = True - elif val_act > self.threshold and self.__dog_stop == True: - self.__dog_stop = False - + + if self.__timer <= time.time() and self.__dog_stop: - self.__notify = False - self.notify = True + if _me.get_var('notified') == True: + self.__notify = False + self.notify = True if self.__start_timeout: if self.__start_delay < time.time(): @@ -508,7 +516,7 @@ val_act = ((self.val_table_pos[len(self.val_table_pos)-1])*100) / (self.RANGE/2) if val_act < self.threshold and self.__stop == False: - self.__delay_to_stop = time.time() + 0.1 + self.__delay_to_stop = time.time() + self.TIMEOUT self.__stop = True elif val_act > self.threshold and self.__stop: self.__stop = False Modified: software/gadgets/micro_monitor/trunk/micro_monitor/Scripts/Python/notify.pyp =================================================================== --- software/gadgets/micro_monitor/trunk/micro_monitor/Scripts/Python/notify.pyp 2008-01-18 15:53:27 UTC (rev 857) +++ software/gadgets/micro_monitor/trunk/micro_monitor/Scripts/Python/notify.pyp 2008-01-21 11:14:11 UTC (rev 858) @@ -1,3 +1,5 @@ +import time + def notify_checker(): if _me.get_param('measure'): measure = _me.get_param('measure') @@ -10,18 +12,19 @@ return False def notify_actuator(): + timeout = time.time() + 15 measure = _me.get_param('measure') if _me.get_param('chkDogDefault') == False: tux.cmd.wings_on_free(8) for i in range(5): tux.cmd.sound_play(14) try: - while tux.status.sound_play()[1] != 0: + while tux.status.sound_play()[1] != 0 or timeout < time.time(): tux.sys.wait(0.1) except: - while tux.status.flash_status()[0] != 0: + while tux.status.flash_status()[0] != 0 or timeout < time.time(): tux.sys.wait(0.1) - tux.sys.wait(1) + tux.sys.wait(1) else: path = _me.get_param('dogBehavior') path = path.replace('%20', ' ') Modified: software/gadgets/micro_monitor/trunk/micro_monitor/about.xml =================================================================== --- software/gadgets/micro_monitor/trunk/micro_monitor/about.xml 2008-01-18 15:53:27 UTC (rev 857) +++ software/gadgets/micro_monitor/trunk/micro_monitor/about.xml 2008-01-21 11:14:11 UTC (rev 858) @@ -4,5 +4,5 @@ <gadget_description type='str'> </gadget_description> <gadget_name type='str'>micro_monitor</gadget_name> - <gadget_version type='str'>0.0.1</gadget_version> + <gadget_version type='str'>0.0.2</gadget_version> </about> Modified: software/gadgets/micro_monitor/trunk/micro_monitor.tgf =================================================================== (Binary files differ) |