From 742d11bb63bfa7f107a7e7fb6956e4e8297c7172 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sun, 16 Mar 2014 09:36:39 +0100 Subject: commandline: fixed fast mode --- commandline/builds/Windows/micronucleus.exe | Bin 27150 -> 27150 bytes commandline/library/micronucleus_lib.c | 18 +++++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'commandline') diff --git a/commandline/builds/Windows/micronucleus.exe b/commandline/builds/Windows/micronucleus.exe index 4f17f99..45c8b2d 100644 Binary files a/commandline/builds/Windows/micronucleus.exe and b/commandline/builds/Windows/micronucleus.exe differ diff --git a/commandline/library/micronucleus_lib.c b/commandline/library/micronucleus_lib.c index 4961703..d6b4243 100644 --- a/commandline/library/micronucleus_lib.c +++ b/commandline/library/micronucleus_lib.c @@ -76,18 +76,18 @@ micronucleus* micronucleus_connect(int fast_mode) { if ((nucleus->version.major>=2)&&(!fast_mode)) { // firmware v2 reports more aggressive write times. Add 2ms if fast mode is not used. - nucleus->write_sleep = (buffer[3] & 127) + 2; - if (buffer[3]&128) { - // if bit 7 of write sleep time is set, divide the erase time by four to - // accomodate to the 4*page erase of the ATtiny841/441 - nucleus->erase_sleep = nucleus->write_sleep * nucleus->pages / 4; - } else { - nucleus->erase_sleep = nucleus->write_sleep * nucleus->pages; - } + nucleus->write_sleep = (buffer[3] & 127) + 2; } else { nucleus->write_sleep = (buffer[3] & 127); - nucleus->erase_sleep = nucleus->write_sleep * nucleus->pages; } + + // if bit 7 of write sleep time is set, divide the erase time by four to + // accomodate to the 4*page erase of the ATtiny841/441 + if (buffer[3]&128) { + nucleus->erase_sleep = nucleus->write_sleep * nucleus->pages / 4; + } else { + nucleus->erase_sleep = nucleus->write_sleep * nucleus->pages; + } } } } -- cgit v1.2.3