slotUI/slotCli.py

changeset 139
7127e7082ee0
parent 137
94d71156517b
child 143
cb514887cf17
equal deleted inserted replaced
138:a570dd24a413 139:7127e7082ee0
18 import SimpleXMLRPCServer 18 import SimpleXMLRPCServer
19 import xmlrpclib 19 import xmlrpclib
20 import threading 20 import threading
21 21
22 22
23 VERSION = "1.8.1" 23 VERSION = "1.8.2"
24 MAXSLOTS = 6 24 MAXSLOTS = 6
25 TERM = { 25 TERM = {
26 "caption": "\033[1;37m\033[1;44m", 26 "caption": "\033[1;37m\033[1;44m",
27 "text": "\033[1;30m", 27 "text": "\033[1;30m",
28 } 28 }
605 self.slot[slot]["status"] = "IN-RACE" 605 self.slot[slot]["status"] = "IN-RACE"
606 trigger_event("pitlane_exit", slot + 1) 606 trigger_event("pitlane_exit", slot + 1)
607 607
608 self.render_slots() 608 self.render_slots()
609 609
610 if rx == "!RACE PREPARE": 610 if rx == "!PRE":
611 # reset current race status 611 # reset current race status
612 # and display PREPARE PHASE 612 # and display PREPARE PHASE
613 self.reset_slots() 613 self.reset_slots()
614 for slot in range(MAXSLOTS): 614 for slot in range(MAXSLOTS):
615 self.slot[slot]["status"] = "Prepare" 615 self.slot[slot]["status"] = "Prepare"
616 trigger_event("race_prepare") 616 trigger_event("race_prepare")
617 617
618 if rx == "!RACE START": 618 if rx == "!GO":
619 # race start!
619 for slot in range(MAXSLOTS): 620 for slot in range(MAXSLOTS):
620 if self.slot[slot]["status"] == "~~~~~~~~~~": 621 if self.slot[slot]["status"] == "~~~~~~~~~~":
621 self.slot[slot]["status"] = "Idle" 622 self.slot[slot]["status"] = "Idle"
622 trigger_event("race_start") 623 trigger_event("race_start")
623 self.raceactive = True 624 self.raceactive = True
624 625
625 if rx == "!COUNTDOWN": 626 if rx == "!SET":
626 # countdown initiated 627 # countdown initiated
627 for slot in range(MAXSLOTS): 628 for slot in range(MAXSLOTS):
628 self.slot[slot]["status"] = "~~~~~~~~~~" 629 self.slot[slot]["status"] = "~~~~~~~~~~"
629 trigger_event("countdown_start") 630 trigger_event("countdown_start")
630 631
631 if rx == "!PANIC": 632 if rx == "!STOP":
632 # panic mode 633 # panic mode, race stopped
633 trigger_event("panic") 634 trigger_event("panic")
634 635
635 if rx == "!SHORTCUT": 636 if rx == "!OC":
636 # panic mode 637 # panic mode, overcurrent
637 trigger_event("panic_shortcut") 638 trigger_event("panic_shortcut")
638 639
639 if rx == "!RESUME": 640 if rx == "!RESUME":
640 # panic mode 641 # panic mode reset - race goes on normally
641 trigger_event("resume") 642 trigger_event("resume")
642 643
643 644
644 if ((self.timelimit > 0) and (self.raceactive) and 645 if ((self.timelimit > 0) and (self.raceactive) and
645 (self.sysclk_last != self.sysclk) and 646 (self.sysclk_last != self.sysclk) and

mercurial