Why not add a few more PRs, really.
Here’s an extract from the resource test patch that reads data from flash to memory, edits it and stores back to flash:
class TestData {
public:
int value;
};
using TestMemoryResource = MemoryResource<TestData>;
using TestStorageResource = StorageResource<TestData>;
// ....
ResourceStorage storage;
//...
const TestStorageResource* res1 = storage.getResource<TestData>(TEST_RESOURCE_INDEX);
// Copy storage resource to memory resource
TestMemoryResource res2;
res2 = *res1;
// Edit and store updated resource
res2.setName("test2");
res2.payload.value = TOKEN2;
if (storage.storeResource(TEST_RESOURCE_INDEX, res2)){
debugMessage("Write OK");
}
else {
debugMessage("Write FAIL");
}