From 4206297f41fb8a2e58a597b8e81645de70e26c11 Mon Sep 17 00:00:00 2001 From: Michael Carpenter Date: Wed, 29 Jan 2014 21:39:56 -0500 Subject: [PATCH] Change so memoryDirty/memoryClean signals from the freeemsplugin now properly watch for individual bytes to be "clean" or "dirty" --- plugins/freeems/emsdata.cpp | 10 ++++++ plugins/freeems/emsdata.h | 1 + plugins/freeems/freeemscomms.cpp | 57 +++++++++++++++++++++++++------- plugins/freeems/freeemscomms.h | 2 +- 4 files changed, 57 insertions(+), 13 deletions(-) diff --git a/plugins/freeems/emsdata.cpp b/plugins/freeems/emsdata.cpp index 4ffca59..c5540a0 100644 --- a/plugins/freeems/emsdata.cpp +++ b/plugins/freeems/emsdata.cpp @@ -973,3 +973,13 @@ int EmsData::backConvertAxis(double val,QList > metadata) } return (int)newval; } +MemoryLocation* EmsData::getLocalRamBlockInfo(unsigned short locationid) +{ + for (int i=0;ilocationid == locationid) + { + return m_ramMemoryList[i]; + } + } +} diff --git a/plugins/freeems/emsdata.h b/plugins/freeems/emsdata.h index b3294fa..1443735 100644 --- a/plugins/freeems/emsdata.h +++ b/plugins/freeems/emsdata.h @@ -106,6 +106,7 @@ class EmsData : public QObject } QList getTopLevelUniqueLocationIdList(); QList getUniqueLocationIdList(); + MemoryLocation* getLocalRamBlockInfo(unsigned short locationid); private: bool m_checkEmsDataInUse; diff --git a/plugins/freeems/freeemscomms.cpp b/plugins/freeems/freeemscomms.cpp index 466ef59..2071e64 100644 --- a/plugins/freeems/freeemscomms.cpp +++ b/plugins/freeems/freeemscomms.cpp @@ -454,14 +454,26 @@ int FreeEmsComms::burnBlockFromRamToFlash(unsigned short location,unsigned short req.sequencenumber = m_sequenceNumber; m_sequenceNumber++; m_reqList.append(req); - if (m_dirtyLocationIds.contains(location)) + + for (int i=emsData.getLocalRamBlockInfo(location)->ramAddress + offset;iramAddress+offset+size;i++) + { + if (m_dirtyRamAddresses.contains(i)) + { + m_dirtyRamAddresses.removeOne(i); + } + } + if (m_dirtyRamAddresses.size() == 0) + { + emit memoryClean(); + } + /*if (m_dirtyLocationIds.contains(location)) { m_dirtyLocationIds.removeOne(location); if (m_dirtyLocationIds.size() == 0) { emit memoryClean(); } - } + }*/ return m_sequenceNumber-1; } int FreeEmsComms::enableDatalogStream() @@ -506,11 +518,21 @@ int FreeEmsComms::updateBlockInRam(unsigned short location,unsigned short offset req.sequencenumber = m_sequenceNumber; m_sequenceNumber++; m_reqList.append(req); - if (!m_dirtyLocationIds.contains(location)) + + unsigned short ramaddress = emsData.getLocalRamBlockInfo(location)->ramAddress; + for (int i=ramaddress+offset;isize; + //emsData.getLocalRamBlockInfo(location)->ramAddress; + + for (int i=emsData.getLocalRamBlockInfo(location)->ramAddress + offset;iramAddress+offset+size;i++) { - m_dirtyLocationIds.removeOne(location); - if (m_dirtyLocationIds.size() == 0) + if (m_dirtyRamAddresses.contains(i)) { - emit memoryClean(); + m_dirtyRamAddresses.removeOne(i); } } + if (m_dirtyRamAddresses.size() == 0) + { + emit memoryClean(); + } return m_sequenceNumber-1; } int FreeEmsComms::retrieveBlockFromRam(unsigned short location, unsigned short offset, unsigned short size) @@ -1954,14 +1983,18 @@ void FreeEmsComms::copyFlashToRam(unsigned short locationid) } } updateBlockInRam(locationid,0,emsData.getLocalFlashBlock(locationid).size(),emsData.getLocalFlashBlock(locationid)); - if (m_dirtyLocationIds.contains(locationid)) + + for (int i=emsData.getLocalRamBlockInfo(locationid)->ramAddress;iramAddress+emsData.getLocalRamBlockInfo(locationid)->size;i++) { - m_dirtyLocationIds.removeOne(locationid); - if (m_dirtyLocationIds.size() == 0) + if (m_dirtyRamAddresses.contains(i)) { - emit memoryClean(); + m_dirtyRamAddresses.removeOne(i); } } + if (m_dirtyRamAddresses.size() == 0) + { + emit memoryClean(); + } } void FreeEmsComms::copyRamToFlash(unsigned short locationid) diff --git a/plugins/freeems/freeemscomms.h b/plugins/freeems/freeemscomms.h index 8d3c57d..4800f81 100644 --- a/plugins/freeems/freeemscomms.h +++ b/plugins/freeems/freeemscomms.h @@ -165,7 +165,7 @@ class FreeEmsComms : public EmsComms PacketDecoder *m_packetDecoder; QMap m_interrogationMetaDataMap; void sendNextInterrogationPacket(); - QList m_dirtyLocationIds; + QList m_dirtyRamAddresses; signals: void packetSent(unsigned short locationid,QByteArray header,QByteArray payload); void packetAcked(unsigned short locationid,QByteArray header,QByteArray payload);