diff options
author | Kristian Lauszus <lauszus@gmail.com> | 2012-10-01 04:33:26 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2012-11-30 15:32:11 +0100 |
commit | 0c0dc27de7ce2228f08d3c85c69c98edfd013d6d (patch) | |
tree | 7acb9ea0355039ed45a32bdad0a88cf765e9df2f /bootloaders/caterina/Caterina.c | |
parent | 0a40c644719ebe3434b4d66276cbd0ae205c7159 (diff) |
Improved Leonardo bootloader
The power-on reset detection didn't work properly, but has now been
fixed
Diffstat (limited to 'bootloaders/caterina/Caterina.c')
-rwxr-xr-x | bootloaders/caterina/Caterina.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bootloaders/caterina/Caterina.c b/bootloaders/caterina/Caterina.c index abcba2b..9860b3a 100755 --- a/bootloaders/caterina/Caterina.c +++ b/bootloaders/caterina/Caterina.c @@ -123,11 +123,11 @@ int main(void) if (mcusr_state & (1<<EXTRF)) {
// External reset - we should continue to self-programming mode.
- } else if (mcusr_state == (1<<PORF) && pgm_read_word(0) != 0xFFFF) {
+ } else if ((mcusr_state & (1<<PORF)) && (pgm_read_word(0) != 0xFFFF)) {
// After a power-on reset skip the bootloader and jump straight to sketch
// if one exists.
StartSketch();
- } else if ((mcusr_state == (1<<WDRF)) && (bootKeyPtrVal != bootKey) && (pgm_read_word(0) != 0xFFFF)) {
+ } else if ((mcusr_state & (1<<WDRF)) && (bootKeyPtrVal != bootKey) && (pgm_read_word(0) != 0xFFFF)) {
// If it looks like an "accidental" watchdog reset then start the sketch.
StartSketch();
}
|