diff --git a/Control/firmware/Bootloader/Bootloader/main.c b/Control/firmware/Bootloader/Bootloader/main.c index 5a3ac0a..6932c00 100644 --- a/Control/firmware/Bootloader/Bootloader/main.c +++ b/Control/firmware/Bootloader/Bootloader/main.c @@ -63,7 +63,7 @@ int port_init() DDRB = 0x00; DDRD = 0x40; PORTD = 0x00; - return (PINB0 == 1); + return (PINB & 1 == 0); } int main(void) @@ -74,12 +74,11 @@ int main(void) State state_next; srec_t srec; cli(); - - bootloader_enter(); int bsel = port_init(); if (bsel) { + bootloader_enter(); uart_init(9600); uart_puts("Hendi-Control Bootloader v1.1\n"); size_t image_size = 0; @@ -211,11 +210,10 @@ int main(void) state = state_next; } } while (!leave_loop); - uart_puts("Exit bootloader!\n\n"); + bootloader_exit(); } - bootloader_exit(); /* Return to address 0x0000 */ startApplication();