# HG changeset patch # User Malte Bayer # Date 1322910610 -3600 # Node ID d12d095e32825fde43e9bd336123b06329bef043 # Parent c261350bb39431320d9a57b283cf08b1d5c3b53a some code cleanup diff -r c261350bb394 -r d12d095e3282 blackbox/lowlevel.c --- a/blackbox/lowlevel.c Sat Dec 03 11:55:01 2011 +0100 +++ b/blackbox/lowlevel.c Sat Dec 03 12:10:10 2011 +0100 @@ -7,6 +7,10 @@ #include "driver/rs232.h" #include "lowlevel.h" +void blinkdelay(void) { + _delay_ms(50); +} + void LED(uint8_t num, uint8_t state) { switch (num) { case 1: switch (state) { @@ -49,7 +53,7 @@ DDRD = 0; PORTD = 0; - RS232_init(); // initialize RS485 interface + RS232_init(); // initialize RS232 interface initADC(); SFIOR = 0; @@ -76,16 +80,16 @@ DDR(RAIL_POWER_PORT) |= _BV(RAIL_POWER); // display init sequence on LEDs - LED(1, 1); _delay_ms(50); - LED(2, 1); _delay_ms(50); - LED(3, 1); _delay_ms(50); - LED(4, 1); _delay_ms(50); - LED(5, 1); _delay_ms(50); - LED(1, 0); _delay_ms(50); - LED(2, 0); _delay_ms(50); - LED(3, 0); _delay_ms(50); - LED(4, 0); _delay_ms(50); - LED(5, 0); _delay_ms(50); + LED(1, 1); blinkdelay(); + LED(2, 1); blinkdelay(); + LED(3, 1); blinkdelay(); + LED(4, 1); blinkdelay(); + LED(5, 1); blinkdelay(); + LED(1, 0); blinkdelay(); + LED(2, 0); blinkdelay(); + LED(3, 0); blinkdelay(); + LED(4, 0); blinkdelay(); + LED(5, 0); // setup response receiver timer @@ -111,9 +115,6 @@ } -void blinkdelay(void) { - _delay_ms(100); -} void check_rails_shortcut(void) { // check for short circuit on the rails diff -r c261350bb394 -r d12d095e3282 blackbox/main.c --- a/blackbox/main.c Sat Dec 03 11:55:01 2011 +0100 +++ b/blackbox/main.c Sat Dec 03 12:10:10 2011 +0100 @@ -125,7 +125,7 @@ case 4: tmp = (1<<5); break; // todo regler 5 case 5: tmp = (1<<5); break; // todo regler 6 } - tmp |= 0b1000000000 | (controller << 6); + tmp |= (0b1000000000 | (controller << 6)); if ( (PIN(SW_FUEL_PORT) & _BV(SW_FUEL)) != 0) tmp |= 1; // benzinstand aktiv - tankmodusschalter return insert_queue(tmp, 9);