diff --git a/stk500v2/main.cpp b/stk500v2/main.cpp index a5fa85a..c8f0b35 100644 --- a/stk500v2/main.cpp +++ b/stk500v2/main.cpp @@ -340,15 +340,15 @@ static inline void performChipErase() }; constexpr auto getBootloaderSize = []() -> uint16_t { - const auto extendedFuse = boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS); + const auto highFuse = boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS); constexpr auto BOOTSZ0 = 1; constexpr auto BOOTSZ1 = 2; - if (extendedFuse & (1 << BOOTSZ1 | 1 << BOOTSZ0)) + if (highFuse & (1 << BOOTSZ1) && highFuse & (1 << BOOTSZ0)) return 256 * 2; - else if (extendedFuse & (1 << BOOTSZ1)) + else if (highFuse & (1 << BOOTSZ1)) return 512 * 2; - else if (extendedFuse & (1 << BOOTSZ0)) + else if (highFuse & (1 << BOOTSZ0)) return 1024 * 2; return 2048 * 2; };