Sat, 17 Dec 2011 17:06:06 +0100
added test option without communication
slotUI/SlotCli.py | file | annotate | diff | comparison | revisions |
--- a/slotUI/SlotCli.py Sat Dec 17 16:47:04 2011 +0100 +++ b/slotUI/SlotCli.py Sat Dec 17 17:06:06 2011 +0100 @@ -27,7 +27,7 @@ SOUNDS = { "countdown_start": os.path.abspath(SOUNDPREFIX + "sound/countdown.mp3"), "race_start": os.path.abspath(SOUNDPREFIX + "sound/racestart.mp3"), - "race_prepare": os.path.abspath(SOUNDPREFIX + "sound/siren.mp3"), + "race_prepare": os.path.abspath(SOUNDPREFIX + "sound/prepare.mp3"), "lap_record": os.path.abspath(SOUNDPREFIX + "sound/laprecord.mp3"), "fuel_warning1": os.path.abspath(SOUNDPREFIX + "sound/fuel1.mp3"), "fuel_warning2": os.path.abspath(SOUNDPREFIX + "sound/fuel2.mp3"), @@ -76,6 +76,7 @@ ] self.reset_slots() self.sysclk = 0.00 + self.sysclk_last = 0.00 self.bestlap = 9999999.00 self.test = test self.laplimit = 999; @@ -399,15 +400,17 @@ trigger_sound("resume") - if (self.sysclk_last != self.sysclk) and ((self.sysclk / 60) >= self.timelimit): - # we have time limit reached! - trigger_sound("win") - # get the one with position 1 - for slot in self.slots: - if slot["position"] == 1: - slot["status"] = "WINNER!" - self.box.query("+") # stop race - + if (self.sysclk_last > 0) and (self.sysclk_last != self.sysclk) and ((self.sysclk / 60) >= self.timelimit): + self.sysclk_last = self.sysclk + # we have time limit reached! + trigger_sound("win") + # get the one with position 1 + for slot in self.slots: + if slot["position"] == 1: + slot["status"] = "WINNER!" + self.box.query("+") # stop race + self.sysclk_last = self.sysclk + self.scr.addstr(17,31,