# HG changeset patch # User Malte Bayer # Date 1324125340 -3600 # Node ID 7ed95dbadf1f123475f2ba3323ffa2f28d20afba # Parent 4b5b4c7ba03dc4ef9f35980284fe276f5db300c7 added remote start button press diff -r 4b5b4c7ba03d -r 7ed95dbadf1f blackbox/main.c --- a/blackbox/main.c Sat Dec 17 13:24:20 2011 +0100 +++ b/blackbox/main.c Sat Dec 17 13:35:40 2011 +0100 @@ -175,6 +175,32 @@ return 0; } +void startbutton(void) { + // start button press active + if (mode == 0) { + mode = 1; // set wait for race start mode + reset_vars(); + LED(1, 1); + LED(2, 1); + LED(3, 1); + LED(4, 1); + LED(5, 1); + RS232_puts_p(prepare); + } else if (mode == 1) { + // Initiate race countdown + sysclk.value = 0; + countdown = 5; + countdown_loops = COUNTDOWN_DELAY; + mode = 2; + LED(1, 0); + LED(2, 0); + LED(3, 0); + LED(4, 0); + LED(5, 0); + RS232_puts_p(countdownstart); + } +} + ISR ( USART_RXC_vect ) { uint8_t tmp; char c = UDR; @@ -246,6 +272,11 @@ RS232_puts_p(ok); break; + case '#': // remote start button press + RS232_puts_p(ok); + startbutton(); + break; + case '+': // toggle panic mode RS232_puts_p(ok); if (mode != 0xff) { @@ -569,6 +600,7 @@ } else slot[idx].seccnt++; } + int main(void) { @@ -602,31 +634,7 @@ btn_start = (PIN(SW_START_PORT) & _BV(SW_START)); if (old_start != btn_start) { // start button changed - if (btn_start == 0) { - // start button press active - if (mode == 0) { - mode = 1; // set wait for race start mode - reset_vars(); - LED(1, 1); - LED(2, 1); - LED(3, 1); - LED(4, 1); - LED(5, 1); - RS232_puts_p(prepare); - } else if (mode == 1) { - // Initiate race countdown - sysclk.value = 0; - countdown = 5; - countdown_loops = COUNTDOWN_DELAY; - mode = 2; - LED(1, 0); - LED(2, 0); - LED(3, 0); - LED(4, 0); - LED(5, 0); - RS232_puts_p(countdownstart); - } - } + if (btn_start == 0) startbutton(); old_start = btn_start; } diff -r 4b5b4c7ba03d -r 7ed95dbadf1f slotUI/SlotCli.py --- a/slotUI/SlotCli.py Sat Dec 17 13:24:20 2011 +0100 +++ b/slotUI/SlotCli.py Sat Dec 17 13:35:40 2011 +0100 @@ -168,6 +168,7 @@ key = self.scr.getch() if key == ord('q'): break elif key == ord(' '): self.box.query("+") # panic / resume + elif key == 10: self.box.query("#") # remote start button press elif key == ord('1'): self.readName(0) elif key == ord('2'): self.readName(1) elif key == ord('3'): self.readName(2)