X-Git-Url: http://git.linex4red.de/pub/lufa.git/blobdiff_plain/35a0fe93848cc6e1a79d2e606a2e3f6a84ba5755..ab195ab1da1da75a3a23d47b56c66d14803a9de3:/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c?ds=sidebyside diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c index c9822d0a6..267e51850 100644 --- a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c +++ b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c @@ -139,6 +139,9 @@ uint8_t ISPTarget_WaitForProgComplete(const uint8_t ProgrammingMode, const uint1 ProgrammingStatus = ISPTarget_WaitWhileTargetBusy(); break; } + + if (ProgrammingStatus == STATUS_CMD_OK) + TimeoutMSRemaining = COMMAND_TIMEOUT_MS; return ProgrammingStatus; } @@ -159,10 +162,7 @@ uint8_t ISPTarget_WaitWhileTargetBusy(void) } while ((SPI_ReceiveByte() & 0x01) && TimeoutMSRemaining); - if (!(TimeoutMSRemaining)) - return STATUS_RDY_BSY_TOUT; - else - return STATUS_CMD_OK; + return ((TimeoutMSRemaining) ? STATUS_CMD_OK : STATUS_RDY_BSY_TOUT); } /** Sends a low-level LOAD EXTENDED ADDRESS command to the target, for addressing of memory beyond the