From 43fd3f330ce9dd4a8fd89f9aa7581c67f08af058 Mon Sep 17 00:00:00 2001 From: Bertrand Lemasle Date: Tue, 7 Aug 2018 18:26:32 +1200 Subject: [PATCH] Using a csv format to debug positions (-128 bytes) --- src/Debug.cpp | 8 +++++++- src/Positions.cpp | 21 ++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/Debug.cpp b/src/Debug.cpp index 098055e..1bb41bb 100644 --- a/src/Debug.cpp +++ b/src/Debug.cpp @@ -120,7 +120,13 @@ namespace debug { namespace details { inline void displayPosition(PositionEntry entry) { - Log.notice(F("%d%%, %dmV, %f�C, %ds, %d, %s\n"), entry.metadata.batteryLevel, entry.metadata.batteryVoltage, entry.metadata.temperature, entry.metadata.timeToFix, entry.metadata.status, entry.position); + Log.notice(F("%d,%d,%d,%d,%d,%s"), + entry.metadata.batteryLevel, + entry.metadata.batteryVoltage, + static_cast(entry.metadata.temperature * 100), + static_cast(entry.metadata.status), + entry.metadata.timeToFix, + entry.position); } } diff --git a/src/Positions.cpp b/src/Positions.cpp index 5feea1e..15ac889 100644 --- a/src/Positions.cpp +++ b/src/Positions.cpp @@ -113,7 +113,14 @@ namespace positions { hardware::i2c::powerOn(); hardware::i2c::eeprom.writeBlock(entryAddress, entry); - NOTICE_FORMAT("appendLast", "Saved @ %X : [%d%% @ %dmV] [%f�C] [TTF : %d, Status : %d, Position : %s]", entryAddress, entry.metadata.batteryLevel, entry.metadata.batteryVoltage, entry.metadata.temperature, entry.metadata.timeToFix, entry.metadata.status, entry.position); + NOTICE_FORMAT("appendLast", "Saved @ %X : %d,%d,%d,%d,%d,%s", + entryAddress, + entry.metadata.batteryLevel, + entry.metadata.batteryVoltage, + static_cast(entry.metadata.temperature * 100), + static_cast(entry.metadata.status), + entry.metadata.timeToFix, + entry.position); config->lastEntry++; if (config->lastEntry > details::maxEntryIndex) config->lastEntry = 0; @@ -130,13 +137,21 @@ namespace positions { uint16_t entryAddress = details::getEntryAddress(index); if (entryAddress == -1) return false; - VERBOSE_FORMAT("get", "Reading entry n�%d @ %X", index, entryAddress); + VERBOSE_FORMAT("get", "Reading entry %d @ %X", index, entryAddress); hardware::i2c::powerOn(); hardware::i2c::eeprom.readBlock(entryAddress, entry); hardware::i2c::powerOff(); - NOTICE_FORMAT("get", "Read from EEPROM @ %X : [%d%% @ %dmV] [%f�C] [TTF : %d, Status : %d, Position : %s]", entryAddress, entry.metadata.batteryLevel, entry.metadata.batteryVoltage, entry.metadata.temperature, entry.metadata.timeToFix, entry.metadata.status, entry.position); + NOTICE_FORMAT("get", "Read from EEPROM @ %X : %d,%d,%d,%d,%d,%s", + entryAddress, + entry.metadata.batteryLevel, + entry.metadata.batteryVoltage, + static_cast(entry.metadata.temperature * 100), + static_cast(entry.metadata.status), + entry.metadata.timeToFix, + entry.position); + return true; }