From 89afbde58ad169624485e416aa7c3d19d8d8614c Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Sun, 24 Nov 2013 15:36:26 +0100 Subject: [PATCH] initialized log packages with 0xff instead of 0x0 to reduce flash wear --- flight/pios/common/pios_debuglog.c | 4 ++-- flight/pios/posix/pios_debuglog.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/flight/pios/common/pios_debuglog.c b/flight/pios/common/pios_debuglog.c index 79782e868..d87b655af 100644 --- a/flight/pios/common/pios_debuglog.c +++ b/flight/pios/common/pios_debuglog.c @@ -120,7 +120,7 @@ void PIOS_DEBUGLOG_UAVObject(uint32_t objid, uint16_t instid, size_t size, uint8 size = sizeof(buffer->Data); } buffer->Size = size; - memset(buffer->Data, 0, sizeof(buffer->Data)); + memset(buffer->Data, 0xff, sizeof(buffer->Data)); memcpy(buffer->Data, data, size); if (PIOS_FLASHFS_ObjSave(pios_user_fs_id, flightnum * 256, lognum, (uint8_t *)buffer, sizeof(DebugLogEntryData)) == 0) { @@ -142,7 +142,7 @@ void PIOS_DEBUGLOG_Printf(char *format, ...) va_list args; va_start(args, format); mutexlock(); - memset(buffer->Data, 0, sizeof(buffer->Data)); + memset(buffer->Data, 0xff, sizeof(buffer->Data)); vsnprintf((char *)buffer->Data, sizeof(buffer->Data), (char *)format, args); buffer->Flight = flightnum; #if defined(PIOS_INCLUDE_FREERTOS) diff --git a/flight/pios/posix/pios_debuglog.c b/flight/pios/posix/pios_debuglog.c index 79782e868..d87b655af 100644 --- a/flight/pios/posix/pios_debuglog.c +++ b/flight/pios/posix/pios_debuglog.c @@ -120,7 +120,7 @@ void PIOS_DEBUGLOG_UAVObject(uint32_t objid, uint16_t instid, size_t size, uint8 size = sizeof(buffer->Data); } buffer->Size = size; - memset(buffer->Data, 0, sizeof(buffer->Data)); + memset(buffer->Data, 0xff, sizeof(buffer->Data)); memcpy(buffer->Data, data, size); if (PIOS_FLASHFS_ObjSave(pios_user_fs_id, flightnum * 256, lognum, (uint8_t *)buffer, sizeof(DebugLogEntryData)) == 0) { @@ -142,7 +142,7 @@ void PIOS_DEBUGLOG_Printf(char *format, ...) va_list args; va_start(args, format); mutexlock(); - memset(buffer->Data, 0, sizeof(buffer->Data)); + memset(buffer->Data, 0xff, sizeof(buffer->Data)); vsnprintf((char *)buffer->Data, sizeof(buffer->Data), (char *)format, args); buffer->Flight = flightnum; #if defined(PIOS_INCLUDE_FREERTOS)