DataFlash: slight efficiency improvement

fixes issue #314

thanks Dongfang!
This commit is contained in:
Andrew Tridgell 2013-07-23 09:46:02 +10:00
parent 63873d6af3
commit 2874ec67c7

View File

@ -50,7 +50,7 @@ void DataFlash_Block::WriteBlock(const void *pBuffer, uint16_t size)
// if we are at the start of a page we need to insert a
// page header
if (n > df_PageSize - sizeof(struct PageHeader)) {
n -= sizeof(struct PageHeader);
n = df_PageSize - sizeof(struct PageHeader);
}
struct PageHeader ph = { df_FileNumber, df_FilePage };
BlockWrite(df_BufferNum, df_BufferIdx, &ph, sizeof(ph), pBuffer, n);