Skip to content

Commit 80a3fab

Browse files
authored
Merge pull request #196 from sparkfun/release_candidate
v2.8 : Consistent use of File32/ExFile/FsFile/File
2 parents 81445bd + cf67b76 commit 80a3fab

File tree

10 files changed

+74
-11
lines changed

10 files changed

+74
-11
lines changed
-386 KB
Binary file not shown.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ v2.8:
66

77
* Corrects the serial token timestamp printing - resolves #192
88
* The charsReceived debug print ("Total chars received: ") now excludes the length of the timestamps
9+
* Consistent use of File32/ExFile/FsFile/File. Don't use SdFile for temporary files
910

1011
v2.7:
1112
---------

Firmware/OpenLog_Artemis/OpenLog_Artemis.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
v2.8:
159159
Corrects the serial token timestamp printing - resolves #192
160160
The charsReceived debug print ("Total chars received: ") now excludes the length of the timestamps
161+
Consistent use of File32/ExFile/FsFile/File. Don't use SdFile for temporary files
161162
162163
*/
163164

Firmware/OpenLog_Artemis/logging.ino

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,16 @@ void msg(const char * message)
1111
//Updates EEPROM and then appends to the new log file.
1212
char* findNextAvailableLog(int &newFileNumber, const char *fileLeader)
1313
{
14-
SdFile newFile; //This will contain the file for SD writing
14+
//This will contain the file for SD writing
15+
#if SD_FAT_TYPE == 1
16+
File32 newFile;
17+
#elif SD_FAT_TYPE == 2
18+
ExFile newFile;
19+
#elif SD_FAT_TYPE == 3
20+
FsFile newFile;
21+
#else // SD_FAT_TYPE == 0
22+
File newFile;
23+
#endif // SD_FAT_TYPE
1524

1625
if (newFileNumber < 2) //If the settings have been reset, let's warn the user that this could take a while!
1726
{

Firmware/OpenLog_Artemis/nvm.ino

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,19 @@ bool loadSystemSettingsFromFile()
197197
{
198198
if (sd.exists("OLA_settings.txt"))
199199
{
200-
SdFile settingsFile; //FAT32
200+
#if SD_FAT_TYPE == 1
201+
File32 settingsFile;
202+
#elif SD_FAT_TYPE == 2
203+
ExFile settingsFile;
204+
#elif SD_FAT_TYPE == 3
205+
FsFile settingsFile;
206+
#else // SD_FAT_TYPE == 0
207+
File settingsFile;
208+
#endif // SD_FAT_TYPE
209+
201210
if (settingsFile.open("OLA_settings.txt", O_READ) == false)
202211
{
203-
SerialPrintln(F("Failed to open settings file"));
212+
SerialPrintln(F("Failed to open device settings file"));
204213
return (false);
205214
}
206215

Firmware/OpenLog_Artemis/productionTest.ino

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,16 @@ void productionTest()
488488
if (sd.exists("OLA_prod_test.txt"))
489489
sd.remove("OLA_prod_test.txt");
490490

491-
SdFile testFile; //FAT32
491+
#if SD_FAT_TYPE == 1
492+
File32 testFile;
493+
#elif SD_FAT_TYPE == 2
494+
ExFile testFile;
495+
#elif SD_FAT_TYPE == 3
496+
FsFile testFile;
497+
#else // SD_FAT_TYPE == 0
498+
File testFile;
499+
#endif // SD_FAT_TYPE
500+
492501
if (testFile.open("OLA_prod_test.txt", O_CREAT | O_APPEND | O_WRITE) == true)
493502
{
494503
#ifdef verboseProdTest

Firmware/OpenLog_Artemis/zmodem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ _PROTOTYPE(void bibi , (int n ));
169169
_PROTOTYPE(int wcs , (const char *oname));
170170
_PROTOTYPE(void saybibi, (void));
171171

172-
int wctxpn(char *name,SdFile *file);
172+
int wctxpn(char *name);
173173
int wcrx();
174174

175175
/* Ward Christensen / CP/M parameters - Don't change these! */

Firmware/OpenLog_Artemis/zmodem.ino

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,15 @@ V2.00
129129
extern int Filesleft;
130130
extern long Totalleft;
131131

132-
extern SdFile fout;
132+
#if SD_FAT_TYPE == 1
133+
extern File32 fout;
134+
#elif SD_FAT_TYPE == 2
135+
extern ExFile fout;
136+
#elif SD_FAT_TYPE == 3
137+
extern FsFile fout;
138+
#else // SD_FAT_TYPE == 0
139+
extern File fout;
140+
#endif // SD_FAT_TYPE
133141

134142
static bool oneTime = false; // Display the Tera Term Change Directory note only once (so it does not get on people's nerves!)
135143

@@ -171,9 +179,19 @@ void sdCardHelp(void)
171179
DSERIALprint(F("\r\n"));
172180
}
173181

174-
SdFile root; // Copied from SdFat OpenNext example
175-
SdFile fout;
176-
//dir_t *dir ;
182+
#if SD_FAT_TYPE == 1
183+
File32 root;
184+
File32 fout;
185+
#elif SD_FAT_TYPE == 2
186+
ExFile root;
187+
ExFile fout;
188+
#elif SD_FAT_TYPE == 3
189+
FsFile root;
190+
FsFile fout;
191+
#else // SD_FAT_TYPE == 0
192+
File root;
193+
File fout;
194+
#endif // SD_FAT_TYPE
177195

178196
int count_files(int *file_count, long *byte_count)
179197
{

Firmware/OpenLog_Artemis/zmodem_rz.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,15 @@ _PROTOTYPE(void bttyout , (int c ));
133133
#ifndef ARDUINO
134134
FILE *fout;
135135
#else
136-
extern SdFile fout;
136+
#if SD_FAT_TYPE == 1
137+
extern File32 fout;
138+
#elif SD_FAT_TYPE == 2
139+
extern ExFile fout;
140+
#elif SD_FAT_TYPE == 3
141+
extern FsFile fout;
142+
#else // SD_FAT_TYPE == 0
143+
extern File fout;
144+
#endif // SD_FAT_TYPE
137145
#endif
138146

139147
// Dylan (monte_carlo_ecm, bitflipper, etc.) - Moved this to a global variable to enable

Firmware/OpenLog_Artemis/zmodem_sz.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,15 @@ _PROTOTYPE(int zsendcmd , (char *buf , int blen ));
188188
#ifndef ARDUINO
189189
FILE *fout;
190190
#else
191-
extern SdFile fout;
191+
#if SD_FAT_TYPE == 1
192+
extern File32 fout;
193+
#elif SD_FAT_TYPE == 2
194+
extern ExFile fout;
195+
#elif SD_FAT_TYPE == 3
196+
extern FsFile fout;
197+
#else // SD_FAT_TYPE == 0
198+
extern File fout;
199+
#endif // SD_FAT_TYPE
192200
#endif
193201

194202
int wcs(const char *oname)

0 commit comments

Comments
 (0)