From becaad5584c7582676e60dfd4e59fd0056872ebe Mon Sep 17 00:00:00 2001 From: anschrammh Date: Sun, 3 Mar 2019 22:47:54 +0100 Subject: [PATCH] Added getSdCardHandler method to SdCardManager class --- documentation/app_class_diagram.mdj | 46 +++++++++++++++++++++++++---- src/app/SDCardManager.cpp | 5 ++++ src/app/SDCardManager.h | 1 + src/app/app.ino | 5 ++-- 4 files changed, 50 insertions(+), 7 deletions(-) diff --git a/documentation/app_class_diagram.mdj b/documentation/app_class_diagram.mdj index bd765fb..0bc0b93 100644 --- a/documentation/app_class_diagram.mdj +++ b/documentation/app_class_diagram.mdj @@ -169,7 +169,7 @@ "top": 812, "width": 624.67919921875, "height": 13, - "text": "-sdCard: SD", + "text": "-sdCard: SDClass", "horizontalAlignment": 0 }, { @@ -4268,7 +4268,7 @@ "top": 1174, "width": 335.98779296875, "height": 13, - "text": "-sdCardRef: SD&", + "text": "-sdCardRef: SDlass&", "horizontalAlignment": 0 } ], @@ -4321,13 +4321,30 @@ "height": 13, "text": "+const getSize(sizeUnit: const SizeUnit = GBYTE): double", "horizontalAlignment": 0 + }, + { + "_type": "UMLOperationView", + "_id": "AAAAAAFpRYJJAA467cY=", + "_parent": { + "$ref": "AAAAAAFpKneDcx8Vby4=" + }, + "model": { + "$ref": "AAAAAAFpRYJIxg4oepo=" + }, + "font": "Arial;13;0", + "left": 805, + "top": 1227, + "width": 335.98779296875, + "height": 13, + "text": "+getSdCardHandler(): SDClass&", + "horizontalAlignment": 0 } ], "font": "Arial;13;0", "left": 800, "top": 1192, "width": 345.98779296875, - "height": 38 + "height": 53 }, { "_type": "UMLReceptionCompartmentView", @@ -6209,7 +6226,7 @@ }, "name": "sdCard", "visibility": "private", - "type": "SD" + "type": "SDClass" }, { "_type": "UMLAttribute", @@ -7867,7 +7884,7 @@ }, "name": "sdCardRef", "visibility": "private", - "type": "SD&" + "type": "SDlass&" } ], "operations": [ @@ -7919,6 +7936,25 @@ "direction": "return" } ] + }, + { + "_type": "UMLOperation", + "_id": "AAAAAAFpRYJIxg4oepo=", + "_parent": { + "$ref": "AAAAAAFpKneDcR8MzCI=" + }, + "name": "getSdCardHandler", + "parameters": [ + { + "_type": "UMLParameter", + "_id": "AAAAAAFpRYK3Iw6tRwM=", + "_parent": { + "$ref": "AAAAAAFpRYJIxg4oepo=" + }, + "type": "SDClass&", + "direction": "return" + } + ] } ] }, diff --git a/src/app/SDCardManager.cpp b/src/app/SDCardManager.cpp index 309d9bb..8784fec 100644 --- a/src/app/SDCardManager.cpp +++ b/src/app/SDCardManager.cpp @@ -37,3 +37,8 @@ double SDCardManager::getSize(const SizeUnit sizeUnit) const return result; } +SDClass& SDCardManager::getSdCardHandler() +{ + return _sdCardRef; +} + diff --git a/src/app/SDCardManager.h b/src/app/SDCardManager.h index 7810e35..7e75534 100644 --- a/src/app/SDCardManager.h +++ b/src/app/SDCardManager.h @@ -8,6 +8,7 @@ class SDCardManager friend class SAB; public: double getSize(const SizeUnit sizeUnit = GBYTE) const; + SDClass& getSdCardHandler(); protected: SDCardManager(SDClass& sdCard); private: diff --git a/src/app/app.ino b/src/app/app.ino index 079b861..3506764 100644 --- a/src/app/app.ino +++ b/src/app/app.ino @@ -4,7 +4,7 @@ #include "views.h" SAB sab; -unsigned char *memoryEater = NULL; +long *memoryEater = NULL; unsigned long currentMs = 0; int mySize = 0; @@ -33,7 +33,8 @@ void loop() { dtp.dateTime = sab.getRtcManager().getDateTime(); sab.getScreenManager().displayView(1); - unsigned char *temp = (unsigned char *) realloc(memoryEater,sizeof(unsigned char) * ++mySize); + long *temp = (long *) realloc(memoryEater,sizeof(long) * ++mySize); + if(temp != NULL) memoryEater = temp; else