diff --git a/src/lib/ebus/message.cpp b/src/lib/ebus/message.cpp index 021cde30..9a95b69b 100644 --- a/src/lib/ebus/message.cpp +++ b/src/lib/ebus/message.cpp @@ -497,12 +497,9 @@ result_t Message::prepareMaster(const unsigned char srcAddress, SymbolString& ma result = prepareMasterPart(master, input, separator, index); if (result != RESULT_OK) return result; - result = storeLastData(pt_masterData, master, index); - if (result < RESULT_OK) - return result; masterData.clear(); masterData.addAll(master); - return RESULT_OK; + return storeLastData(pt_masterData, masterData, index); } result_t Message::prepareMasterPart(SymbolString& master, istringstream& input, char separator, unsigned char index) @@ -558,7 +555,9 @@ result_t Message::storeLastData(SymbolString& master, SymbolString& slave) result_t Message::storeLastData(const PartType partType, SymbolString& data, unsigned char index) { - time(&m_lastUpdateTime); + if (data.size() > 0 && (this->m_dstAddress == BROADCAST || partType == pt_slaveData)) { + time(&m_lastUpdateTime); + } if (partType == pt_masterData) { switch (data.compareMaster(m_lastMasterData)) { case 1: // completely different diff --git a/src/lib/ebus/message.h b/src/lib/ebus/message.h index 1886b46c..6cd30082 100644 --- a/src/lib/ebus/message.h +++ b/src/lib/ebus/message.h @@ -396,14 +396,14 @@ public: SymbolString& getLastSlaveData() { return m_lastSlaveData; } /** - * Get the time when @a m_lastValue was last stored. - * @return the time when @a m_lastValue was last stored, or 0 if this message was not decoded yet. + * Get the time when this message was last seen with reasonable data. + * @return the time when this message was last seen, or 0. */ time_t getLastUpdateTime() { return m_lastUpdateTime; } /** - * Get the time when @a m_lastValue was last changed. - * @return the time when @a m_lastValue was last changed, or 0 if this message was not decoded yet. + * Get the time when the message data was last changed. + * @return the time when the message data was last changed, or 0 if this message was not decoded yet. */ time_t getLastChangeTime() { return m_lastChangeTime; }