From f9b2274c91be17772a812f405a83a20a0c944bf4 Mon Sep 17 00:00:00 2001 From: dhineshkumarmcci Date: Tue, 13 Jul 2021 20:00:04 +0530 Subject: [PATCH 1/2] fix #309: change return type of `cFram::saveField()` to `bool` --- src/Catena_Fram.h | 6 +++--- src/lib/Catena_Fram.cpp | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Catena_Fram.h b/src/Catena_Fram.h index 73b0c95..0c46e78 100644 --- a/src/Catena_Fram.h +++ b/src/Catena_Fram.h @@ -113,19 +113,19 @@ class cFram : public cPersistentStorage char **argv ); - void saveField( + bool saveField( cFramStorage::StandardKeys uKey, const uint8_t *pValue, size_t nValue ); template - void saveField( + bool saveField( cFramStorage::StandardKeys uKey, const T &field ) { - this->saveField(uKey, (const uint8_t *)&field, sizeof(field)); + return this->saveField(uKey, (const uint8_t *)&field, sizeof(field)); }; bool getField( diff --git a/src/lib/Catena_Fram.cpp b/src/lib/Catena_Fram.cpp index 8a529bb..4fc44ef 100644 --- a/src/lib/Catena_Fram.cpp +++ b/src/lib/Catena_Fram.cpp @@ -615,7 +615,7 @@ McciCatena::cFram::writeItemData( return fResult; } -void McciCatena::cFram::saveField( +bool McciCatena::cFram::saveField( cFramStorage::StandardKeys uKey, const uint8_t *pValue, size_t nValue @@ -623,15 +623,27 @@ void McciCatena::cFram::saveField( { cFram::Cursor cursor(this, uKey); + bool fResult; + + fResult = true; if (! cursor.create()) { gLog.printf(gLog.kError, "%s: can't save uKey(0x%x) %u bytes\n", __FUNCTION__, uKey, nValue ); + fResult = false; + } + + if (! cursor.put(pValue, nValue)) + { + gLog.printf(gLog.kError, "%s: can't put uKey(0xx) %u bytes\n", + __func__, uKey, nValue + ); + fResult = false; } - cursor.put(pValue, nValue); + return fResult; } bool McciCatena::cFram::getField( From a9a80a2cb7ec4254199264606b8c5376128bd857 Mon Sep 17 00:00:00 2001 From: dhineshkumarmcci Date: Tue, 13 Jul 2021 20:46:03 +0530 Subject: [PATCH 2/2] This is v0.21.3-1 --- README.md | 3 +++ src/CatenaBase.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 619ce17..76cf975 100644 --- a/README.md +++ b/README.md @@ -1445,6 +1445,9 @@ This sketch demonstrates the use of the Catena FSM class to implement the `Turns | [`catena-mcciadk`](https://github.com/mcci-catena/Catena-mcciadk) | 0.2.1 | 0.1.2 | Needed for miscellaneous definitions | ## Release History +- HEAD includes the following changes. + + - fix [#309](https://github.com/mcci-catena/Catena-Arduino-Platform/issues/309): add debug message to `cFram::saveField()` and set `bool` as return type. (version 0.21.3-1) - v0.21.2 includes the following changes, non breaking, all bug fixes. diff --git a/src/CatenaBase.h b/src/CatenaBase.h index 58c71f7..611a167 100644 --- a/src/CatenaBase.h +++ b/src/CatenaBase.h @@ -57,7 +57,7 @@ Copyright notice: (((major) << 24u) | ((minor) << 16u) | ((patch) << 8u) | (local)) #define CATENA_ARDUINO_PLATFORM_VERSION \ - CATENA_ARDUINO_PLATFORM_VERSION_CALC(0, 21, 2, 0) /* v0.21.2 */ + CATENA_ARDUINO_PLATFORM_VERSION_CALC(0, 21, 3, 1) /* v0.21.3-1 */ #define CATENA_ARDUINO_PLATFORM_VERSION_GET_MAJOR(v) \ (((v) >> 24u) & 0xFFu)