reduce footprint, save 5 byte

This commit is contained in:
Julius Lipp 2021-04-13 20:58:42 +02:00
parent 0fb3c704dc
commit 649535d4c4
2 changed files with 7 additions and 8 deletions

View File

@ -31,23 +31,25 @@ ApplicationProgramObject::ApplicationProgramObject(Memory& memory)
uint8_t* ApplicationProgramObject::save(uint8_t* buffer) uint8_t* ApplicationProgramObject::save(uint8_t* buffer)
{ {
property(PID_PROG_VERSION)->read(_programVersion); uint8_t programVersion[5];
buffer = pushByteArray(_programVersion, 5, buffer); property(PID_PROG_VERSION)->read(programVersion);
buffer = pushByteArray(programVersion, 5, buffer);
return TableObject::save(buffer); return TableObject::save(buffer);
} }
const uint8_t* ApplicationProgramObject::restore(const uint8_t* buffer) const uint8_t* ApplicationProgramObject::restore(const uint8_t* buffer)
{ {
buffer = popByteArray(_programVersion, 5, buffer); uint8_t programVersion[5];
property(PID_PROG_VERSION)->write(_programVersion); buffer = popByteArray(programVersion, 5, buffer);
property(PID_PROG_VERSION)->write(programVersion);
return TableObject::restore(buffer); return TableObject::restore(buffer);
} }
uint16_t ApplicationProgramObject::saveSize() uint16_t ApplicationProgramObject::saveSize()
{ {
return sizeof(_programVersion) + TableObject::saveSize(); return TableObject::saveSize() + 5; // sizeof(programVersion)
} }
uint8_t * ApplicationProgramObject::data(uint32_t addr) uint8_t * ApplicationProgramObject::data(uint32_t addr)

View File

@ -15,7 +15,4 @@ class ApplicationProgramObject : public TableObject
uint16_t getWord(uint32_t addr); uint16_t getWord(uint32_t addr);
uint32_t getInt(uint32_t addr); uint32_t getInt(uint32_t addr);
double getFloat(uint32_t addr, ParameterFloatEncodings encoding); double getFloat(uint32_t addr, ParameterFloatEncodings encoding);
private:
uint8_t _programVersion[5] = { 0, 0, 0, 0, 0};
}; };