Comments (5)
I am not sure what this means:
Only occurs when a sub-folder of the same name as the the bitmap I'm trying to access exist together within the same working directory.
You can't have a sub-folder and file with the same name in a folder.
If you try to do this with Windows 10, it is not allowed an you get the error message:
There is already a folder with the same name as the file name you specified. Specify a different name.
from sdfat.
Hi Bill, thanks for your response. Sorry for not being clearer when describing the issue. Of course you cannot have two files/folders with exactly the same name in the same folder. What I meant was the file and folder have the same name when you exclude the file extension. With the extension included the filename is different to the folder. As an example the folder could be called:
abcdefghijklmno
and the file called
abcdefghijklmno.bmp
I hope this makes sense?
from sdfat.
Try this test program. When I run it, it prints this:
Type any character
0 abcdefghijklmno/
156 abcdefghijklmno.bmp
Done
#include <SPI.h>
#include "SdFat.h"
#define FOLDER_NAME "abcdefghijklmno"
#define FILE_NAME "abcdefghijklmno.bmp"
//SdFatSdio SD;
SdFatSdioEX SD;
File file;
void setup() {
Serial.begin(9600);
while (!Serial) {}
Serial.println("Type any character");
while (!Serial.available());
if (!SD.begin()) {
Serial.println("begin failed");
return;
}
if (!SD.exists(FOLDER_NAME)) {
if (!SD.mkdir(FOLDER_NAME)) {
Serial.println("mkdir failed");
return;
}
}
if (!SD.exists(FILE_NAME)) {
if (!file.open(FILE_NAME, O_WRITE | O_CREAT | O_TRUNC)) {
Serial.println("open write failed");
return;
}
for (int i = 100; i < 256; i++) {
file.write(i);
}
file.close();
}
if (!file.open(FILE_NAME, O_READ)) {
Serial.println("open read failed");
return;
}
for (int i = 100; i < 256; i++) {
if (file.read() != i) {
Serial.println("compare failed");
return;
}
}
SD.ls(LS_SIZE);
Serial.println("Done");
}
void loop() {}
from sdfat.
Hi Bill, yes this works for me also and thanks for putting it together. It prompted me to re-analyse my code in greater depth. I wrote my code to do different things with the images depending on whether a folder of the same name existed or not and in that section of the code I made a two very rookie mistakes! I didn't allocate a long enough char array for those filenames and upon analyzing my images on the SD card I found that additional information was saved to the file header which was not being skipped over by my code, hence the read error on images.
from sdfat.
So it turns out my issue was just with my novice coding abilities and not with your excellent library, thanks all the same for your responses and guidance on the matter. I will close this issue now.
All the best,
Pat
from sdfat.
Related Issues (20)
- Did not work at ESP32-CAM HOT 6
- MMC_ERASE HOT 2
- Wrapper to fs::FS to use SDfat in ESPAsyncWebserver HOT 6
- pico-sdk only rp2040 implementation HOT 7
- ESP32 S3 always fails to mount card HOT 10
- Unable to format flat Spiflash module with ESP8266 HOT 4
- Mount issues for a Windows-formatted card HOT 35
- SD NAND XTSD01G (surface mounted chip) not formating HOT 1
- Unable to share the same SPI bus with TFT_eSPI on ESP32 HOT 1
- Problems with multiple SD card HOT 3
- Long timeout calling begin() on Teensy 4.1 when no card present HOT 5
- SdFat 2.22 with USER_SPI1 pin + another USER_SPI2 in SPI_Mode3 HOT 2
- Arduino-Pico: huge slowdown with v2.2.2 (vs.2.1.1) HOT 5
- Problem with SdFat and TwoWire instance. HOT 3
- sd.begin(SPI_CONFIG) breaks my DMA ADC datalogger on the SAMD51 HOT 5
- Issue after latest update. HOT 17
- exFat sd cards not working with Sdinfo.ino example, only FAT32 card HOT 7
- Allocating bin file with 0s HOT 2
- CS_Pin has to be driven high on ESP32 (to be low at the SDCARD) because of some logic inbetween HOT 3
- Initialization fails with ESP32 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdfat.