Skip to content

Commit 69e37a4

Browse files
committed
Fix indentation and remove empty lines
1 parent 9296903 commit 69e37a4

File tree

1 file changed

+15
-31
lines changed

1 file changed

+15
-31
lines changed

Diff for: src/USBStorage.cpp

+15-31
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,19 @@
99
bool USBStorage::usb_available = false;
1010

1111
USBStorage::USBStorage(){
12-
#if defined(ARDUINO_PORTENTA_C33)
13-
register_hotplug_callback(DEV_USB, [](){
14-
usb_available = !usb_available;
15-
16-
});
12+
#if defined(ARDUINO_PORTENTA_C33)
13+
register_hotplug_callback(DEV_USB, [](){
14+
usb_available = !usb_available;
15+
});
1716
#endif
1817
}
1918

20-
2119
int USBStorage::begin(FileSystems fs){
2220
this -> fs = fs;
2321
this -> begin();
2422
}
2523

2624
int USBStorage::begin(){
27-
28-
29-
3025
int attempts = 0;
3126
int err = mount(DEV_USB, this->fs, MNT_DEFAULT);
3227

@@ -45,14 +40,12 @@ int USBStorage::begin(){
4540
return err == 0;
4641
}
4742

48-
4943
int USBStorage::unmount(){
5044
auto unmountResult = umount(DEV_USB);
5145

5246

5347
if(unmountResult == 0){
5448
this -> connected = false;
55-
} else {
5649
}
5750

5851
return unmountResult == 0;
@@ -62,7 +55,6 @@ Folder USBStorage::getRootFolder(){
6255
return Folder("/usb");
6356
}
6457

65-
6658
bool USBStorage::isAvailable(){
6759
return usb_available;
6860
}
@@ -72,34 +64,26 @@ bool USBStorage::isConnected(){
7264
}
7365

7466
void USBStorage::checkConnection(){
75-
#if defined(ARDUINO_PORTENTA_H7_M7)
7667
USBHost * host;
7768
USBDeviceConnected * dev;
69+
#if defined(ARDUINO_PORTENTA_H7_M7)
7870
unsigned long currentMillis = millis();
7971
boolean found = false;
8072

8173
if (currentMillis - previousMillis >= interval) {
82-
this -> previousMillis = currentMillis;
83-
84-
host = USBHost::getHostInst();
85-
86-
87-
if ((dev = host->getDevice(0)) != NULL) {
88-
usb_available = true;
89-
found = true;
90-
} else {
91-
usb_available = false;
92-
}
74+
this->previousMillis = currentMillis;
75+
host = USBHost::getHostInst();
76+
77+
if ((dev = host->getDevice(0)) != NULL){
78+
usb_available = true;
79+
found = true;
80+
} else{
81+
usb_available = false;
82+
}
9383
}
94-
95-
96-
97-
98-
#endif
84+
#endif
9985
}
10086

101-
102-
10387
int USBStorage::formatFAT(){
10488
this -> begin();
10589
this -> unmount();

0 commit comments

Comments
 (0)