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 |