-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
readBytes problem #6
Comments
hey @HideakiAbe thank you for your feedback. I've edited your comment to make the code more readable. Can you please specify what OS / Arduino version / esp32-core version you're using ? |
So, after updating to esp32 core 2.0.0 and editing your script, I can't reproduce the error 🤔 [edit] My mistake, I didn't merge on the master the latest changes for 2.0.0 compliance. Please wait for propagation and update from the library manager, or pull the master from this repo. This is what I get in my serial console:
I have modified the #include <PSRamFS.h>
//#include "./pfs.h"
void setup() {
Serial.begin(115200);
esp32Info();
if (!PSRamFS.begin()) {
log_e("PSRamFS Mount Failed");
return;
}
if (PSRamFS.exists("/test.txt")) {
PSRamFS.remove("/test.txt");;
}
File t = PSRamFS.open("/test.txt", FILE_WRITE);
if (t) {
t.print("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
Serial.print("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
Serial.printf("\n/test.txt size= %d \n", t.size());
t.close();
} else {
Serial.println("Error: file could not be opened, halting");
while(1) vTaskDelay(1);
}
File r = PSRamFS.open("/test.txt", FILE_READ);
int rsize = r.size();
if (r) {
int c = 0;
char rbuf[32];
int len = 0;
int total = 0;
do {
len = r.readBytes(rbuf, sizeof(rbuf));
for (int i = 0; i < len; i++) {
Serial.print(rbuf[i]);
}
Serial.printf("\nlen=%d", len);
total += len;
} while (len);
t.close();
Serial.printf("\ntotal=%d", total);
if (total != rsize) {
Serial.printf("\nwe can read all data except file end..Z");
}
}
Serial.println("\nEND");
}
void loop() {
// put your main code here, to run repeatedly:
}
void esp32Info(void) {
Serial.println("---------------------------- -");
uint64_t chipid;
chipid = ESP.getEfuseMac(); //The chip ID is essentially its MAC address(length: 6 bytes).
Serial.printf("ESP32 Chip ID = % 04X\r\n", (uint16_t)(chipid >> 32)); //print High 2 bytes
Serial.printf("Chip Revision % d\r\n", ESP.getChipRevision());
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
Serial.printf("Number of Core: % d\r\n", chip_info.cores);
Serial.printf("CPU Frequency: % d MHz\r\n", ESP.getCpuFreqMHz());
Serial.printf("Flash Chip Size = % d byte\r\n", ESP.getFlashChipSize());
Serial.printf("Flash Frequency = % d Hz\r\n", ESP.getFlashChipSpeed());
Serial.printf("Free Heap Size = % d\r\n", esp_get_free_heap_size());
Serial.printf("Total PSRAM: %d\r\n", ESP.getPsramSize());
Serial.printf("Free PSRAM: %d\r\n", ESP.getFreePsram());
Serial.printf("ESP - IDF version = % s\r\n", esp_get_idf_version());
Serial.println();
} |
Hello thanks for ESP32-PsRamFS ramdisk program.
Im using this useful program.
When I used readBytes(char *,sizs_t) function ,l could not read last char of this file.
followin is test program
The text was updated successfully, but these errors were encountered: