alexforencich / xboot

XBoot Extensible Bootloader
125 stars 69 forks source link

USE_LED ... LED not lit when USE_ENTER_DELAY = no and USE_ENTER_PIN = yes #41

Open sloped-soarer opened 4 years ago

sloped-soarer commented 4 years ago

Entry USE_ENTER_DELAY = no USE_ENTER_PIN = yes USE_ENTER_UART = no USE_ENTER_I2C = no USE_ENTER_FIFO = no

Communication USE_LED = yes USE_UART = yes

What appears to be happening is that the LED is lit during initialisation and then turned off when the bootloader in entered by the toggle code. The line val = get_char(); appears to be blocking and so the LED remains off until the bootloader processes some serial input.

Suggest moving the LED toggling code below val = get_char(); so that a positive visual indication is given that the bootloader has been entered.

e.g.

// Main bootloader
while (in_bootloader) { val = get_char();

ifdef USE_LED

ifdef __AVR_XMEGA__

            LED_PORT.OUTTGL = (1 << LED_PIN);

else // __AVR_XMEGA__

            LED_PORT ^= (1 << LED_PIN);

endif // __AVR_XMEGA__

endif // USE_LED

....

Thanks for the work so far on this project.