Fix 8 bugs: SD 1-bit mode GPIO conflict, PNG file handle leak, audio stack overflow, null terminator, error degradation logic, modulo div-by-zero, upload file validation, screen clear before PNG draw. Improve web UI with progress bar and toast feedback.
This commit is contained in:
@@ -7,11 +7,11 @@ uint16_t SDCard_Size;
|
||||
uint16_t Flash_Size;
|
||||
|
||||
void SD_Init() {
|
||||
if(!SD_MMC.setPins(SD_CLK_PIN, SD_CMD_PIN, SD_D0_PIN, SD_D1_PIN, SD_D2_PIN, SD_D3_PIN)){
|
||||
if(!SD_MMC.setPins(SD_CLK_PIN, SD_CMD_PIN, SD_D0_PIN)){
|
||||
printf("SD MMC: Pin change failed!\r\n");
|
||||
return;
|
||||
}
|
||||
if (SD_MMC.begin("/sdcard", false, true)) {
|
||||
if (SD_MMC.begin("/sdcard", true, true)) { // true = 1-bit mode (avoids GPIO conflict on D3/CS)
|
||||
printf("SD card initialization successful (4-bit mode)!\r\n");
|
||||
} else {
|
||||
printf("SD card initialization failed!\r\n");
|
||||
@@ -81,7 +81,8 @@ uint16_t Folder_retrieval(const char* directory, const char* fileExtension, char
|
||||
File file = Path.openNextFile();
|
||||
while (file && fileCount < maxFiles) {
|
||||
if (!file.isDirectory() && strstr(file.name(), fileExtension)) {
|
||||
strncpy(File_Name[fileCount], file.name(), sizeof(File_Name[fileCount]));
|
||||
strncpy(File_Name[fileCount], file.name(), sizeof(File_Name[fileCount]) - 1);
|
||||
File_Name[fileCount][sizeof(File_Name[fileCount]) - 1] = '\0'; // Ensure null-termination
|
||||
if (strcmp(directory, "/") == 0) {
|
||||
snprintf(filePath, 100, "%s%s", directory, file.name());
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user