Fixed AVRISP-MKII Clone failing to start application firmware once a TPI programming...
[pub/USBasp.git] / Projects / Incomplete / StandaloneProgrammer / Lib / DataflashManager.c
index f1f4c79..e13d632 100644 (file)
@@ -158,7 +158,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
                          return;
                }
 
                          return;
                }
 
-               /* Decrement the blocks remaining counter and reset the sub block counter */
+               /* Decrement the blocks remaining counter */
                TotalBlocks--;
        }
 
                TotalBlocks--;
        }
 
@@ -357,7 +357,7 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
 
                                /* Send the Dataflash buffer write command */
                                Dataflash_ToggleSelectedChipCS();
 
                                /* Send the Dataflash buffer write command */
                                Dataflash_ToggleSelectedChipCS();
-                               Dataflash_SendByte(DF_CMD_BUFF1WRITE);
+                               Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);
                                Dataflash_SendAddressBytes(0, 0);
                        }
 
                                Dataflash_SendAddressBytes(0, 0);
                        }
 
@@ -372,7 +372,7 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
                        BytesInBlockDiv16++;
                }
 
                        BytesInBlockDiv16++;
                }
 
-               /* Decrement the blocks remaining counter and reset the sub block counter */
+               /* Decrement the blocks remaining counter */
                TotalBlocks--;
        }
 
                TotalBlocks--;
        }