Skip to content

Integrate new features #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 50 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
21e28f1
added opta fixes, using latest POSIXStorage lib
cristidragomir97 Oct 3, 2023
083b2ce
added opta logger
cristidragomir97 Oct 4, 2023
12b6e76
added partitioning, did 'some' refactoring
cristidragomir97 Oct 12, 2023
f783e81
added full refactorings, but it fails to build for now
cristidragomir97 Oct 12, 2023
a5f54ee
fixed issues caused by refactorings
cristidragomir97 Oct 23, 2023
38f181d
Merge pull request #1 from cristidragomir97/refactorings
cristidragomir97 Oct 23, 2023
17f9203
Merge branch 'arduino-libraries:main' into main
cristidragomir97 Oct 23, 2023
541952e
added readPartitions, unified Logger for C33, H7 and opta
cristidragomir97 Oct 25, 2023
02e852f
fixed examples
cristidragomir97 Oct 26, 2023
07b405d
refactoring partitioning
cristidragomir97 Oct 26, 2023
9cd7a6e
Improve formatting
sebromero Oct 26, 2023
6d677f6
Improve documentation
sebromero Oct 26, 2023
bb22d70
Refactor variable name
sebromero Oct 26, 2023
f107ae1
Report success only if all partitions are correctly formatted
sebromero Oct 26, 2023
4e7931f
Simplify code by using guard clauses
sebromero Oct 26, 2023
b0a5061
Rename variable
sebromero Oct 26, 2023
5ee1f70
Remove unused code
sebromero Oct 26, 2023
852ef17
Add documentation
sebromero Oct 26, 2023
0331227
Simplify code
sebromero Oct 26, 2023
7024428
Remove superfluous empty lines
sebromero Oct 26, 2023
df9c8b6
Simplify code by using guard clauses
sebromero Oct 26, 2023
2ce00cd
Fix compiler warnings
sebromero Oct 26, 2023
6103551
Revert calls to printToSerialOrRS485
sebromero Oct 26, 2023
3d332ea
Use board config instead of custom defines
sebromero Oct 26, 2023
dd83662
Fix spelling mistakes
sebromero Oct 26, 2023
be4f8b0
Add missing return statements
sebromero Oct 27, 2023
99ffb53
Fix incorrect reference
sebromero Oct 27, 2023
688059b
Replace printToSerialOrRS485 with debugPrint
sebromero Oct 27, 2023
1940f36
Add missing import
sebromero Oct 27, 2023
1821d32
Use Boards file instead of redefining board features
sebromero Oct 27, 2023
6bb89a9
Merge pull request #24 from arduino-libraries/partitioning_refactorings
cristidragomir97 Oct 27, 2023
638a5ba
fixes on tests
cristidragomir97 Oct 27, 2023
79bbd80
added RS485 dependency in gituhub actions, fixed unused methods from …
cristidragomir97 Oct 27, 2023
817aeae
updated RS485 dependency in github action
cristidragomir97 Oct 27, 2023
943a875
fixes and tweaks
cristidragomir97 Oct 30, 2023
ac8699a
added debugPrint statements everywhere
cristidragomir97 Oct 31, 2023
2ea7e0c
fixed warningins
cristidragomir97 Oct 31, 2023
722bf6e
fixed bug on first-time internal storage usage
cristidragomir97 Nov 2, 2023
9f2b611
implemented static bool for logging
cristidragomir97 Nov 3, 2023
7f2e8e3
fixed logging
cristidragomir97 Nov 3, 2023
3b5be8d
cleaned up examples, fixed RS485, fixed spelling errors
cristidragomir97 Nov 3, 2023
4200218
updated readme and docs
cristidragomir97 Nov 3, 2023
26c8b0b
Update README.md
cristidragomir97 Nov 3, 2023
3a80cc5
Update Partitioning.cpp to skip partitions of 0x0B type that have 0 b…
cristidragomir97 Nov 6, 2023
08910eb
Update Partitioning.cpp to avoid empty partitions
cristidragomir97 Nov 6, 2023
50fb1fc
Readme improvements
aliphys Nov 7, 2023
b5b21e1
cosmetic and consistency fixes
cristidragomir97 Nov 7, 2023
9089fa7
Merge branch 'main' into partitioning_callbacks_opta
sebromero Nov 8, 2023
a10bdc8
Change storage variable name in example
sebromero Nov 8, 2023
9948840
Bump version number
sebromero Nov 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed bug on first-time internal storage usage
  • Loading branch information
cristidragomir97 committed Nov 2, 2023
commit 722bf6ecd5e9e2ac7f4bacf3eb4ff9e834a606d4
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

*/

#define UNIFIED_STORAGE_DEBUG
#define ARDUINO_UNIFIED_STORAGE_DEBUG
#include "Arduino_UnifiedStorage.h"

// Two instances are made for the USB and internal storage respectively
Expand Down
17 changes: 16 additions & 1 deletion examples/SimpleStorageWriteRead/SimpleStorageWriteRead.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@

*/


#include "Arduino_UnifiedStorage.h"

// Redirect Serial.print*() output to GDB instead of SerialUSB where it would conflict with ThreadDebug.
// NOTE: Calls to Serial.print*() will block waiting for GDB to be connected so only useful to use this redefine
// when actively debugging the program.



void printFolderContents(Folder dir, int indentation = 0) {
std::vector<Folder> directories = dir.getFolders();
std::vector<UFile> files = dir.getFiles();
Expand Down Expand Up @@ -57,15 +64,23 @@ void printFolderContents(Folder dir, int indentation = 0) {
// Uncomment one of the three lines below to select between SD card, USB or internal storage
//SDStorage unifiedStorage = SDStorage(); // Create an instance for interacting with SD card storage
//USBStorage unifiedStorage = USBStorage() // Create an instance for interacting with USB storage
InternalStorage internalStorage = InternalStorage();// Create an instance for interacting with internal Flash storage (default)
InternalStorage internalStorage = InternalStorage();

void setup() {


Serial.begin(115200);
while (!Serial);



internalStorage = InternalStorage();

if(!internalStorage.begin()){
Serial.println("Error mounting storage device.");
}



// Create a root directory in storage device
Folder root = internalStorage.getRootFolder();
Expand Down
4 changes: 1 addition & 3 deletions extras/tests/TestFolderOperations/TestFolderOperations.ino
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@


#include <Arduino_UnifiedStorage.h>

#define ARDUINO_UNIFIED_STORAGE_DEBUG
#include <Arduino_UnifiedStorage.h>

#if defined(HAS_USB)
USBStorage usb = USBStorage();
Expand Down
4 changes: 2 additions & 2 deletions src/InternalStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ InternalStorage::InternalStorage(){
std::vector<Partition> partitionsAvailable = Partitioning::readPartitions(QSPIFBlockDeviceType::get_default_instance());
if(partitionsAvailable.size() == 0){

debugPrint("[InternalStorage][INFO] No partitions found, restoring default partitions");
//debugPrint("[InternalStorage][INFO] No partitions found, restoring default partitions");
restoreDefaultPartitions();
} else {
int lastPartitionNumber = partitionsAvailable.size();
FileSystems lastPartitionFileSystem = partitionsAvailable.back().fileSystemType;
debugPrint("[InternalStorage][INFO] Found " + String(lastPartitionNumber) + " partitions, using last partition as internal storage");
//debugPrint("[InternalStorage][INFO] Found " + String(lastPartitionNumber) + " partitions, using last partition as internal storage");

this -> partitionNumber = lastPartitionNumber;
this -> fileSystemType = lastPartitionFileSystem;
Expand Down
6 changes: 5 additions & 1 deletion src/Partitioning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ bool Partitioning::isPartitionSchemeValid(BlockDeviceType * blockDevice, std::ve
for (size_t i = 1; i < partitions.size() + 1; ++i) {
Partition thisPartition = partitions[i - 1];

if(thisPartition.size % 64 == 0){
if(thisPartition.size < 0 && (thisPartition.size & (thisPartition.size - 1)) != 0){
return false;
}
totalSize += thisPartition.size;
Expand Down Expand Up @@ -96,17 +96,21 @@ bool Partitioning::partitionDrive(BlockDeviceType * blockDevice, std::vector<Par
blockDevice -> init();

if(!isPartitionSchemeValid(blockDevice, partitions)){
blockDevice -> deinit();
return false;
}

if(!eraseMBRSector(blockDevice)){
blockDevice -> deinit();
return false;
}

if(!createAndFormatPartitions(blockDevice, partitions)){
blockDevice -> deinit();
return false;
}

blockDevice -> deinit();
return true;
}

Expand Down
Loading